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);
}
if (propertyNames != null && propertyNames.length > 0 && hasDefaultLabelProvider(viewer)
&& contentProvider instanceof ObservableListContentProvider) {
ObservableListContentProvider listContentProvider = (ObservableListContentProvider) contentProvider;
viewer.setLabelProvider(new ObservableMapLabelProvider(
viewer, listContentProvider.getKnownElements(),
propertyNames));
}
} else if (value instanceof Set<?>) {
if (contentProvider == null) {
contentProvider = new ObservableSetContentProvider();
viewer.setContentProvider(contentProvider);
}
if (propertyNames != null && propertyNames.length > 0 && hasDefaultLabelProvider(viewer)
&& contentProvider instanceof ObservableSetContentProvider) {
ObservableSetContentProvider setContentProvider = (ObservableSetContentProvider) contentProvider;
viewer.setLabelProvider(new ObservableMapLabelProvider(
viewer, setContentProvider.getKnownElements(), propertyNames));
}
}
}
}