if (target instanceof ContentViewer) {
ContentViewer viewer = (ContentViewer) target;
String[] propertyNames = JFacesHelper.getViewerProperties(viewer);
if (target instanceof AbstractTreeViewer) {
IContentProvider contentProvider = (IContentProvider) viewer.getContentProvider();
if (contentProvider instanceof ObservableTreeContentProvider) {
ObservableTreeContentProvider xwtContentProvider = (ObservableTreeContentProvider) contentProvider;
xwtContentProvider.updateContext(viewer, value);
}
if (contentProvider instanceof ObservableTreeContentProvider) {
ObservableTreeContentProvider listContentProvider = (ObservableTreeContentProvider) contentProvider;
viewer.setLabelProvider(new ObservableMapLabelProvider(
viewer, listContentProvider.getKnownElements(),
propertyNames));
}
}
else {
IContentProvider contentProvider = viewer.getContentProvider();
if (value instanceof List<?> || value.getClass().isArray()) {
if (contentProvider == null) {
contentProvider = new ObservableListContentProvider();
viewer.setContentProvider(contentProvider);
}