/** * This method creates, adds and returns a tree listener that will keep track of the expanded/collapsed state of the * TreeItems. This state will then be stored in the TreeMemory singleton. * * @param tree * The tree to add the listener to * @return The created/added TreeListener */ public static final TreeListener addTreeListener( final Tree tree, final String treeName ) { TreeListener treeListener = new TreeListener() { public void treeExpanded( TreeEvent e ) { TreeItem treeItem = (TreeItem) e.item; String[] path = ConstUI.getTreeStrings( treeItem ); TreeMemory treeMemory = TreeMemory.getInstance(); treeMemory.storeExpanded( treeName, path, true ); } public void treeCollapsed( TreeEvent e ) { TreeItem treeItem = (TreeItem) e.item; String[] path = ConstUI.getTreeStrings( treeItem ); TreeMemory treeMemory = TreeMemory.getInstance(); treeMemory.storeExpanded( treeName, path, false ); } }; tree.addTreeListener( treeListener ); return treeListener; }
wTree.addTreeListener( new TreeListener() {
coreObjectsTree.addTreeListener( new TreeAdapter() { @Override public void treeExpanded( TreeEvent treeEvent ) {
@Override protected void addTreeListener(Control c, TreeListener listener) { ((Tree) c).addTreeListener(listener); }
@Override protected void addTreeListener(Control c, TreeListener listener) { ((Tree) c).addTreeListener(listener); }
public void run() { fTree.addTreeListener(JavaThreadEventHandler.this); } });
protected void addTreeListener(Control c, TreeListener listener) { ((Tree) c).addTreeListener(listener); }
tree.addTreeListener(treeListener);
public void addListeners(Object control, EventAdapter adapter) { if(control instanceof Tree) { ((Tree)control).addSelectionListener(adapter); ((Tree)control).addTreeListener(adapter); } else throw new IllegalArgumentException("unsupported control type: "+control.getClass().getName()); }
/** * */ private void addExpansionListener() { viewer.getTree().addTreeListener(new TreeAdapter() { @Override public void treeCollapsed(TreeEvent e) { removeExpandedCategory((MarkerCategory) e.item.getData()); } @Override public void treeExpanded(TreeEvent e) { addExpandedCategory((MarkerCategory) e.item.getData()); } }); }
@Override protected void layout(Composite composite, boolean flushCache) { super.layout(composite, flushCache); if( addListener ) { addListener=false; ((Tree)getControl(composite)).addTreeListener(listener); } }
@Override protected void layout(Composite composite, boolean flushCache) { super.layout(composite, flushCache); if( addListener ) { addListener=false; ((Tree)getControl(composite)).addTreeListener(listener); } }
protected void layout(Composite composite, boolean flushCache) { super.layout(composite, flushCache); if( addListener ) { addListener=false; ((Tree)getControl(composite)).addTreeListener(listener); } }
/** * Constructor for creating a sub-provider * @param parentProvider the parent provider * @param parentNode the root node of the model built by this provider * @param configuration the sync page configuration * @param set the sync info set from which the model is built */ protected AbstractSynchronizeModelProvider(AbstractSynchronizeModelProvider parentProvider, ISynchronizeModelElement parentNode, ISynchronizePageConfiguration configuration, SyncInfoSet set) { Assert.isNotNull(set); Assert.isNotNull(parentNode); this.root = parentNode; this.set = set; this.configuration = configuration; if (parentProvider == null) { // The update handler will register for sync change events // with the sync set when the handler is activated updateHandler = new SynchronizeModelUpdateHandler(this); getTree().addTreeListener(this); } else { // We will use the parent's update handler and register for changes with the given set updateHandler = parentProvider.updateHandler; set.addSyncSetChangedListener(this); } }
/** * Constructor for creating a sub-provider * @param parentProvider the parent provider * @param parentNode the root node of the model built by this provider * @param configuration the sync page configuration * @param set the sync info set from which the model is built */ protected AbstractSynchronizeModelProvider(AbstractSynchronizeModelProvider parentProvider, ISynchronizeModelElement parentNode, ISynchronizePageConfiguration configuration, SyncInfoSet set) { Assert.isNotNull(set); Assert.isNotNull(parentNode); this.root = parentNode; this.set = set; this.configuration = configuration; if (parentProvider == null) { // The update handler will register for sync change events // with the sync set when the handler is activated updateHandler = new SynchronizeModelUpdateHandler(this); getTree().addTreeListener(this); } else { // We will use the parent's update handler and register for changes with the given set updateHandler = parentProvider.updateHandler; set.addSyncSetChangedListener(this); } }
public static void create(ActionContext actionContext){ Thing self = actionContext.getObject("self"); String cachePath = (String) self.doAction("getCachePath", actionContext); if("".equals(cachePath)){ cachePath = null; } TreeExpandCache cache = new TreeExpandCache(cachePath); Tree tree = actionContext.getObject("parent"); tree.addTreeListener(cache); actionContext.g().put(self.getMetadata().getName(), cache); } }
/** * Creates a runtime classpath viewer with the given parent. * * @param parent the parent control */ public RuntimeClasspathViewer(Composite parent) { super(parent); GridData data = new GridData(GridData.FILL_BOTH); data.horizontalSpan = 3; data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; data.heightHint = getTree().getItemHeight(); getTree().setLayoutData(data); getTree().addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent event) { if (updateSelection(RuntimeClasspathAction.REMOVE, (IStructuredSelection)getSelection()) && event.character == SWT.DEL && event.stateMask == 0) { List<?> selection= getSelectionFromWidget(); getClasspathContentProvider().removeAll(selection); notifyChanged(); } } }); getTree().addTreeListener(new TreeListener() { public void treeExpanded(TreeEvent e) { refresh(); } public void treeCollapsed(TreeEvent e) { } }); setAutoExpandLevel(5); }
treeItem.getParent().addTreeListener(new TreeListener() { @Override public void treeExpanded(TreeEvent e) {
fViewer.getTree().addTreeListener(new TreeListener(){
fViewer.getTree().addTreeListener(new TreeListener(){