Java Code Examples for org.eclipse.swt.widgets.Tree#addDisposeListener()
The following examples show how to use
org.eclipse.swt.widgets.Tree#addDisposeListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TreeViewPalettePage.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * Creates the palette viewer and its control. * * @see Page#createControl(org.eclipse.swt.widgets.Composite) */ public void createControl( Composite parent ) { tree = new Tree( parent, SWT.NONE ); treeCommon.setTree( tree ); treeCommon.setExpressionViewer( targetViewer ); treeCommon.createDefaultExpressionTree( ); treeCommon.addMouseTrackListener( ); treeCommon.addMouseListener( ); treeCommon.addDragSupportToTree( ); treeCommon.addDropSupportToViewer( ); // Add tool tips tree.setToolTipText( "" ); //$NON-NLS-1$ tree.addDisposeListener( new DisposeListener( ) { public void widgetDisposed( DisposeEvent e ) { treeCommon.removeDropSupportToViewer( ); } } ); }
Example 2
Source File: AbstractSegmentsStatisticsViewer.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Constructor * * @param parent * the parent composite * @param dataProviderId * the data provider extension point ID. * @since 3.0 */ public AbstractSegmentsStatisticsViewer(Composite parent, @Nullable String dataProviderId) { super(parent, false); setLabelProvider(new SegmentStoreStatisticsLabelProvider()); fTablePopupMenuManager = new MenuManager(); fTablePopupMenuManager.setRemoveAllWhenShown(true); fTablePopupMenuManager.addMenuListener(manager -> { TreeViewer viewer = getTreeViewer(); ISelection selection = viewer.getSelection(); if (selection instanceof IStructuredSelection) { IStructuredSelection sel = (IStructuredSelection) selection; if (manager != null) { appendToTablePopupMenu(manager, sel); } } }); Menu tablePopup = fTablePopupMenuManager.createContextMenu(getTreeViewer().getTree()); Tree tree = getTreeViewer().getTree(); tree.setMenu(tablePopup); tree.addDisposeListener(e -> { if (fModule != null) { fModule.dispose(); } }); fProviderId = dataProviderId; }