protected static void addNativeCheckbox(ViewerCell cell, Object element, Object value, TreeEditorDisposeListener listener) { TreeItem currentItem = (TreeItem) cell.getItem(); ExecutionSlot execSlot = (ExecutionSlot) element; String cellKey = ((CompositeSlot) execSlot.eContainer()).getName() + "." + execSlot.getName(); if (viewerCells.get(cellKey) == null || viewerCells.get(cellKey).isDisposed() || (viewerCells.get(cellKey).getSelection() != ((Boolean) value).booleanValue())) { manageEditorDisposal(currentItem, listener); TreeEditor editor = createEditor(currentItem); Composite comp = createEditorComposite(currentItem); final Button button = createNativeCheckboxCellWidget(element, comp); editor.setEditor(comp, currentItem, cell.getColumnIndex()); // update editor content viewerCells.put(cellKey, button); } }
@Override protected Control createDialogArea(Composite parent){ ScrolledComposite scroll = new ScrolledComposite(parent, SWT.BORDER | SWT.V_SCROLL); Composite comp = new Composite(scroll, SWT.NONE); scroll.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true)); scroll.setContent(comp); comp.setLayout(new GridLayout()); comp.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); tree = new Tree(comp, SWT.NONE); tree.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false)); final TreeEditor editor = new TreeEditor(tree); editor.grabHorizontal = true; editor.grabVertical = true; MultilinePaintListener mlListener = new MultilinePaintListener(); tree.addListener(SWT.MeasureItem, mlListener); tree.addListener(SWT.PaintItem, mlListener); tree.addListener(SWT.EraseItem, mlListener); addNodes(di, null); comp.setSize(comp.computeSize(SWT.DEFAULT, SWT.DEFAULT)); return scroll; }
private void editResult(final TreeEditor te) { if (tree.getSelectionCount() == 1) { final TreeItem i = tree.getSelection()[0]; if (i.getItemCount() == 0) { final Reader r = new Reader(mainTrie, shell, SWT.None); setFont(r, READER_FONT_DELTA); te.minimumHeight = getReaderSize(r); r.setParent(tree); final Fact t = (Fact)i.getData(); r.setText(t.key); r.selectAll(); r.setFocus(); te.setEditor(r, i); storeCallback = () -> { final String k = r.currentInput(); if (k != t.key) { updateTries(t, k); } r.dispose(); storeCallback = GUI.this::storeInput; }; r.addListener(SWT.KeyDown, (e) -> { if (e.keyCode == 27) { r.dispose(); storeCallback = GUI.this::storeInput; } }); } } }
protected void disposeTreeEditor() { if (currentItem.getData(EDITOR_DATA) != null) { TreeEditor editor = (TreeEditor) currentItem.getData(EDITOR_DATA); editor.getEditor().dispose(); editor.dispose(); } }
protected static TreeEditor createEditor(TreeItem currentItem) { TreeEditor editor = new TreeEditor(currentItem.getParent()); editor.grabVertical = true; editor.grabHorizontal = true; currentItem.setData(TreeEditorDisposeListener.EDITOR_DATA, editor); return editor; }
public TreeTableViewer(TreeTableComposite treeComposite, TreeTableColumnConfiguration<ITreeTableColumn> configuration, IWorkbenchPartSite site) { super(); this.treeComposite = treeComposite; Tree tree = treeComposite.getTree(); this.treeEditor = new TreeEditor(tree); this.configuration = configuration; this.site = site; hookControl(tree); uneditable = new Color(null, 160, 160, 160); setUseHashlookup(true); setSort(configuration.getSortColumn(), configuration.getSortDirection()); configuration.addConfigurationListener(listener); }
/** * @since 4.4.0.5 */ public static void setEditorItem(ControlEditor editor, Control input, int column, TableItemOrTreeItem item) { if (item instanceof TreeItemDelegate) { ((TreeEditor) editor).setEditor(input, (TreeItem) item.getItem(), column); } else { ((TableEditor) editor).setEditor(input, (TableItem) item.getItem(), column); } }
private void addRenameTowTreeScriptItems(){ lastItem = new TreeItem [1]; editor = new TreeEditor (wTree); wTree.addListener (SWT.Selection, new Listener () { public void handleEvent (Event event) { final TreeItem item = (TreeItem)event.item; renameFunction(item); } }); }
private void addRenameToTreeScriptItems() { lastItem = new TreeItem[1]; editor = new TreeEditor(wTree); wTree.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { final TreeItem item = (TreeItem) event.item; renameFunction(item); } }); }
private void addRenameTowTreeScriptItems() { lastItem = new TreeItem[1]; editor = new TreeEditor( wTree ); wTree.addListener( SWT.Selection, new Listener() { public void handleEvent( Event event ) { final TreeItem item = (TreeItem) event.item; renameFunction( item ); } } ); }
private void addRenameToTreeScriptItems() { lastItem = new TreeItem[1]; editor = new TreeEditor( wTree ); wTree.addListener( SWT.Selection, new Listener() { public void handleEvent( Event event ) { final TreeItem item = (TreeItem) event.item; renameFunction( item ); } } ); }
/** * RenameAction */ public RenameAction() { // RND:refresh() navigatorTree = ViewerRegistry.getViewer().getTree(); treeEditor = new TreeEditor(navigatorTree); }
/** * to handle rename action on creation * * @param selectedEObject */ public RenameAction(EObject eobj) { navigatorTree = ViewerRegistry.getViewer().getTree(); treeEditor = new TreeEditor(navigatorTree); selectedEObject = eobj; }
public static ControlEditor createTableOrTreeEditor(TableOrTreeSWT tableOrTree) { return (tableOrTree instanceof TreeDelegate) ? new TreeEditor( (Tree) tableOrTree.getComposite()) : new TableEditor( (Table) tableOrTree.getComposite()); }
public Control createControl( Composite parent ) { container = new Composite( parent, SWT.NONE ); GridLayout layout = UIUtil.createGridLayoutWithoutMargin( 1, false ); layout.marginTop = 2; layout.marginWidth = layout.marginBottom = 1; container.setLayout( layout ); container.setLayoutData( new GridData( GridData.FILL_BOTH ) ); initSortingType( ); viewer = new CustomTreeViewer( container, SWT.FULL_SELECTION ); tableTree = viewer.getTree( ); GridData gd = new GridData( GridData.FILL_BOTH ); tableTree.setLayoutData( gd ); tableTree.setHeaderVisible( true ); tableTree.setLinesVisible( true ); viewer.setContentProvider( provider.getContentProvier( ) ); TreeViewerColumn tvc1 = new TreeViewerColumn( viewer, SWT.NONE ); tvc1.getColumn( ).setText( COLUMN_TITLE_PROPERTY ); tvc1.getColumn( ).setWidth( 300 ); tvc1.setLabelProvider( new DelegatingStyledCellLabelProvider( provider.getNameLabelProvier( ) ) ); TreeViewerColumn tvc2 = new TreeViewerColumn( viewer, SWT.NONE ); tvc2.getColumn( ).setText( COLUMN_TITLE_VALUE ); tvc2.getColumn( ).setWidth( 400 ); tvc2.setLabelProvider( new DelegatingStyledCellLabelProvider( provider.getValueLabelProvier( ) ) ); AlphabeticallyViewSorter sorter = new AlphabeticallyViewSorter( ); sorter.setAscending( true ); viewer.setSorter( sorter ); hookControl( ); // create a new table tree editor tableTreeEditor = new TreeEditor( tableTree ); // create the editor listener createEditorListener( ); MementoBuilder builder = new MementoBuilder( ); if ( ( propertySheetMemento = builder.getRootMemento( ) .getChild( IPageLayout.ID_PROP_SHEET ) ) == null ) { propertySheetMemento = builder.getRootMemento( ) .createChild( IPageLayout.ID_PROP_SHEET, MementoElement.Type_View ); } if ( ( viewerMemento = propertySheetMemento.getChild( propertyViewerID ) ) == null ) { viewerMemento = propertySheetMemento.createChild( propertyViewerID, MementoElement.Type_Viewer ); } return container; }
/** * @param viewer * the viewer the editor is attached to * @param focusCellManager * the cell focus manager if one used or <code>null</code> * @param editorActivationStrategy * the strategy used to decide about the editor activation * @param feature * the feature mask */ TreeViewerEditor(TreeViewer viewer, SWTFocusCellManager focusCellManager, ColumnViewerEditorActivationStrategy editorActivationStrategy, int feature) { super(viewer, editorActivationStrategy, feature); treeEditor = new TreeEditor(viewer.getTree()); this.focusCellManager = focusCellManager; }
/** * Creates a new action. * * @param shell * the shell for any dialogs * @param tree * the tree * @deprecated see {@link #RenameResourceAction(IShellProvider, Tree)} */ public RenameResourceAndCloseEditorAction(Shell shell, Tree tree) { this(shell); this.navigatorTree = tree; this.treeEditor = new TreeEditor(tree); }
/** * Creates a new action. * * @param provider * the shell provider for any dialogs * @param tree * the tree * @since 3.4 */ public RenameResourceAndCloseEditorAction(IShellProvider provider, Tree tree) { this(provider); this.navigatorTree = tree; this.treeEditor = new TreeEditor(tree); }