/** * 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); }
/** * 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); } }
/** * Updates the viewer in response to the current frame changing. * * @param frame the new value for the current frame */ protected void frameChanged(TreeFrame frame) { viewer.getControl().setRedraw(false); viewer.setInput(frame.getInput()); viewer.setExpandedElements(frame.getExpandedElements()); viewer.setSelection(frame.getSelection(), true); viewer.getControl().setRedraw(true); }
for (Object element : elementsOrPaths) { if (equals(element, input)) { setInput(null); return;
Object element = elementsOrPaths[i]; if (equals(element, input)) { setInput(null); return;
Object element = elementsOrPaths[i]; if (equals(element, input)) { setInput(null); return;