@Override public Image getImage(Object element) { return getColumnImage(element, 0); }
@Override public String getText(Object element) { return getColumnText(element, 0); }
/** * Binds the viewer to the specified input, using the specified label * properties to generate labels. * * @param viewer * the viewer to set up * @param input * the input to set on the viewer * @param labelProperties * the respective properties to use for labels in each of the * viewer's columns */ public static void bind(StructuredViewer viewer, IObservableList input, IValueProperty... labelProperties) { ObservableListContentProvider contentProvider = new ObservableListContentProvider(); if (viewer.getInput() != null) viewer.setInput(null); viewer.setContentProvider(contentProvider); viewer.setLabelProvider(new ObservableMapLabelProvider(Properties .observeEach(contentProvider.getKnownElements(), labelProperties))); if (input != null) viewer.setInput(input); }
/** * Binds the viewer to the specified input, using the specified label * properties to generate labels. * * @param viewer * the viewer to set up * @param input * the input to set on the viewer * @param labelProperties * the respective properties to use for labels in each of the * viewer's columns */ public static void bind(StructuredViewer viewer, IObservableSet input, IValueProperty... labelProperties) { ObservableSetContentProvider contentProvider = new ObservableSetContentProvider(); if (viewer.getInput() != null) viewer.setInput(null); viewer.setContentProvider(contentProvider); viewer.setLabelProvider(new ObservableMapLabelProvider(Properties .observeEach(contentProvider.getKnownElements(), labelProperties))); if (input != null) viewer.setInput(input); }
/** * Binds the viewer to the specified input, using the specified children * property to generate child nodes, and the specified label properties to * generate labels. * * @param viewer * the tree viewer to set up * @param input * the input to set on the viewer * @param childrenProperty * the property to use as the children of an element * @param labelProperties * the respective properties to use for labels in each of the * viewer's columns */ public static void bind(AbstractTreeViewer viewer, Object input, ISetProperty childrenProperty, IValueProperty... labelProperties) { Realm realm = DisplayRealm.getRealm(viewer.getControl().getDisplay()); ObservableSetTreeContentProvider contentProvider = new ObservableSetTreeContentProvider( childrenProperty.setFactory(realm), null); if (viewer.getInput() != null) viewer.setInput(null); viewer.setContentProvider(contentProvider); viewer.setLabelProvider(new ObservableMapLabelProvider(Properties .observeEach(contentProvider.getKnownElements(), labelProperties))); if (input != null) viewer.setInput(input); } }
/** * Binds the viewer to the specified input, using the specified children * property to generate child nodes, and the specified label properties to * generate labels. * * @param viewer * the tree viewer to set up * @param input * the input to set on the viewer * @param childrenProperty * the property to use as the children of an element * @param labelProperties * the respective properties to use for labels in each of the * viewer's columns */ public static void bind(AbstractTreeViewer viewer, Object input, IListProperty childrenProperty, IValueProperty... labelProperties) { Realm realm = DisplayRealm.getRealm(viewer.getControl().getDisplay()); ObservableListTreeContentProvider contentProvider = new ObservableListTreeContentProvider( childrenProperty.listFactory(realm), null); if (viewer.getInput() != null) viewer.setInput(null); viewer.setContentProvider(contentProvider); viewer.setLabelProvider(new ObservableMapLabelProvider(Properties .observeEach(contentProvider.getKnownElements(), labelProperties))); if (input != null) viewer.setInput(input); }