Java Code Examples for org.eclipse.swt.widgets.Composite#addDisposeListener()
The following examples show how to use
org.eclipse.swt.widgets.Composite#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: MenuStylesDialog.java From birt with Eclipse Public License 1.0 | 6 votes |
private void initListeners( Composite c ) { c.addDisposeListener( new DisposeListener( ) { public void widgetDisposed( DisposeEvent e ) { // Only save when it's needed updateProperties( MenuStylesKeyType.get( fComboStyle.getSelectionIndex( ) ) ); } } ); fComboStyle.addListener( SWT.Selection, this ); fBtnAdd.addListener( SWT.Selection, this ); fBtnRemove.addListener( SWT.Selection, this ); fTable.addListener( SWT.Resize, this ); fTable.addListener( SWT.Selection, this ); fTable.addListener( SWT.KeyDown, this ); }
Example 2
Source File: PyContentViewer.java From Pydev with Eclipse Public License 1.0 | 6 votes |
PyContentViewer(Composite parent, CompareConfiguration mp) { fSourceViewer = new SourceViewer(parent, null, SWT.LEFT_TO_RIGHT | SWT.H_SCROLL | SWT.V_SCROLL); IPreferenceStore store = PyDevUiPrefs.getChainedPrefStore(); final ColorAndStyleCache c = new ColorAndStyleCache(store); // Ideally we wouldn't pass null for the grammarVersionProvider... although // I haven't been able to get to this code at all (is this something still needed?) // It seems that Eclipse (in 4.5m5 at least) never gets to use the org.eclipse.compare.contentViewers // as it seems to use what's provided by org.eclipse.compare.contentMergeViewers or the // editor directly... if that's not the case, first we need to discover how that's still needed. fSourceViewer.configure(new PyEditConfigurationWithoutEditor(c, store, null)); fSourceViewer.setEditable(false); parent.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { c.dispose(); } }); }
Example 3
Source File: HintTextGroup.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
public Composite createControl(Composite parent) { fTopComposite= new Composite(parent, SWT.NONE); fTopComposite.setFont(parent.getFont()); GridData gridData= new GridData(GridData.FILL_BOTH); PixelConverter converter= new PixelConverter(parent); gridData.heightHint= converter.convertHeightInCharsToPixels(12); gridData.widthHint= converter.convertWidthInCharsToPixels(25); GridLayout gridLayout= new GridLayout(); gridLayout.marginWidth= 0;//-converter.convertWidthInCharsToPixels(2); gridLayout.marginHeight= 0;//= -4; fTopComposite.setLayout(gridLayout); fTopComposite.setLayoutData(gridData); fTopComposite.setData(null); fTopComposite.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { Collection<Image> collection= fImageMap.values(); Iterator<Image> iterator= collection.iterator(); while(iterator.hasNext()) { Image image= iterator.next(); image.dispose(); } } }); return fTopComposite; }
Example 4
Source File: TimeGraphLegend.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); addStateGroups(composite); setTitle(Messages.TmfTimeLegend_LEGEND); setDialogHelpAvailable(false); setHelpAvailable(false); // Set the minimum size to avoid 0-sized legends from user resize parent.getShell().setMinimumSize(150, 150); composite.addDisposeListener((e) -> { fResourceManager.dispose(); }); return composite; }
Example 5
Source File: MiniSelector.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
private void create(Composite parent) { displayExecutor = DisplayExecutor.create(parent.getDisplay()); comboViewer = new ComboViewer(parent, SWT.READ_ONLY | SWT.DROP_DOWN); comboViewer.setComparator(new ViewerComparator()); comboViewer.setLabelProvider(new LabelProvider() { @Override public String getText(Object element) { if (element instanceof GcpProject) { GcpProject project = (GcpProject) element; return project.getName() + " (" + project.getId() + ")"; } return super.getText(element); } }); comboViewer.setContentProvider(ArrayContentProvider.getInstance()); comboViewer.setInput(EMPTY_PROJECTS); parent.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent event) { cancelFetch(); } }); fetch(); }
Example 6
Source File: LocalAppEngineServerWizardFragment.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
@Override public Composite createComposite(Composite parent, IWizardHandle wizard) { wizard.setTitle(Messages.getString("CREATE_APP_ENGINE_RUNTIME_WIZARD_TITLE")); wizard.setDescription(Messages.getString("CREATE_APP_ENGINE_RUNTIME_WIZARD_DESCRIPTION")); Composite cloudSdkComposite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 1; cloudSdkComposite.setLayout(layout); Label label = new Label(cloudSdkComposite, SWT.NONE); label.setText(Messages.getString("RUNTIME_WIZARD_CLOUD_SDK_NOT_FOUND")); cloudSdkButton = new Button(cloudSdkComposite, SWT.CHECK); cloudSdkButton.setText(Messages.getString("OPEN_CLOUD_SDK_PREFERENCE_BUTTON")); cloudSdkButton.addSelectionListener(new CloudSdkButtonListener()); parent.addDisposeListener(new OpenPreferencePage()); return cloudSdkComposite; }
Example 7
Source File: VerticalList.java From scava with Eclipse Public License 2.0 | 6 votes |
public void add(Composite composite) { composite.setParent(this); composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); composite.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { if( composite.getParent() == VerticalList.this ) { remove(composite); } } }); notifyParentScrolledComposite(); }
Example 8
Source File: CallbackDialog.java From neoscada with Eclipse Public License 1.0 | 6 votes |
private Composite createComposite ( final Composite wrapper ) { this.dbc = new DataBindingContext ( DisplayRealm.getRealm ( wrapper.getDisplay () ) ); wrapper.addDisposeListener ( new DisposeListener () { @Override public void widgetDisposed ( final DisposeEvent e ) { CallbackDialog.this.dbc.dispose (); } } ); final Composite composite = new Composite ( wrapper, SWT.NONE ); composite.setLayout ( new GridLayout ( 2, false ) ); for ( final CallbackWidgetFactory factory : this.factories ) { factory.createGridWidgets ( this.dbc, composite ); } return composite; }
Example 9
Source File: N4JSTestedProjectWizardPage.java From n4js with Eclipse Public License 1.0 | 6 votes |
@Override public void createControl(Composite parent) { Composite listComposite = new Composite(parent, NONE); listComposite.setLayout(new FillLayout()); ListViewer projectListViewer = new ListViewer(listComposite, SWT.BORDER | SWT.MULTI); projectListViewer.setContentProvider(ArrayContentProvider.getInstance()); projectListViewer.setInput(getNonTestProjects()); // Data binding DataBindingContext databindingContext = new DataBindingContext(); parent.addDisposeListener(e -> databindingContext.dispose()); databindingContext.bindList(ViewerProperties.multipleSelection().observe(projectListViewer), PojoProperties.list(N4JSProjectInfo.class, N4JSProjectInfo.TESTED_PROJECT_PROP_NAME) .observe(projectInfo)); setControl(listComposite); }
Example 10
Source File: AttributePage.java From birt with Eclipse Public License 1.0 | 5 votes |
public void buildUI( Composite parent ) { container = new Composite( parent, SWT.NONE ); container.addDisposeListener( new DisposeListener( ) { public void widgetDisposed( DisposeEvent e ) { deRegisterEventManager( ); } } ); if ( sections == null ) sections = new SortMap( ); }
Example 11
Source File: TmfPieChartViewer.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * @param parent * The parent composite that will hold the viewer */ public TmfPieChartViewer(Composite parent) { super(parent, SWT.NONE); fGlobalPCname = Messages.TmfStatisticsView_GlobalSelectionPieChartName; fTimeRangePCname = Messages.TmfStatisticsView_TimeRangeSelectionPieChartName; fOthersSliceName = Messages.TmfStatisticsView_PieChartOthersSliceName; parent.addDisposeListener(e -> { fColorScheme.dispose(); }); initContent(); }
Example 12
Source File: GamaViewPart.java From gama with GNU General Public License v3.0 | 5 votes |
@Override public void createPartControl(final Composite composite) { this.rootComposite = composite; composite.addDisposeListener(this); if (needsOutput() && getOutput() == null) { return; } this.setParentComposite(GamaToolbarFactory.createToolbars(this, composite)); ownCreatePartControl(getParentComposite()); // activateContext(); // toggle.run(); }
Example 13
Source File: BuiltInConflictsCompareInput.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public Control createContents(Composite parent) { parent.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { handleInternalDispose(); } }); return super.createContents(parent); }
Example 14
Source File: DialogPackageExplorer.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
public Control createControl(Composite parent) { fPackageViewer= new TreeViewer(parent, SWT.MULTI); fPackageViewer.setComparer(WorkingSetModel.COMPARER); fPackageViewer.addFilter(new PackageFilter()); fPackageViewer.setComparator(new ExtendedJavaElementSorter()); fPackageViewer.addDoubleClickListener(new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { Object element= ((IStructuredSelection)event.getSelection()).getFirstElement(); if (fPackageViewer.isExpandable(element)) { fPackageViewer.setExpandedState(element, !fPackageViewer.getExpandedState(element)); } else { if (element instanceof CPListElementAttribute) { CPListElementAttribute attribute= (CPListElementAttribute)element; if (attribute.getKey().equals(CPListElement.OUTPUT)) { fActionGroup.getEditOutputFolderAction().run(); } } } } }); MenuManager menuMgr= new MenuManager("#PopupMenu"); //$NON-NLS-1$ menuMgr.setRemoveAllWhenShown(true); menuMgr.addMenuListener(this); fContextMenu= menuMgr.createContextMenu(fPackageViewer.getTree()); fPackageViewer.getTree().setMenu(fContextMenu); parent.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { fContextMenu.dispose(); } }); return fPackageViewer.getControl(); }
Example 15
Source File: ProjectCompareTree.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * Create an instance. */ public ProjectCompareTree(Composite parent, int style, ProjectCompareTreeHelper projectCompareTreeHelper) { super(parent, style); this.projectCompareTreeHelper = projectCompareTreeHelper; parent.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { onDispose(); } }); col_diff_error_fg = new Color(parent.getDisplay(), 255, 40, 40); col_diff_conformant_fg = new Color(parent.getDisplay(), 60, 127, 95); col_classifier_bg = new Color(parent.getDisplay(), 200, 220, 250); final Tree tree = getTree(); for (int n = 0; n < NUM_OF_COLUMNS; n++) { final TreeColumn colN = new TreeColumn(tree, SWT.LEFT); if (n == 0) colN.setWidth(300); // make API column a bit wider else colN.setWidth(200); } tree.setHeaderVisible(true); tree.setLinesVisible(true); setLabelProvider(new MyLabelProvider()); setContentProvider(new MyContentProvider()); setComparison(null, null, null); }
Example 16
Source File: CheckBoxExpressionViewer.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected void createControl(final Composite composite, final int style, final TabbedPropertySheetWidgetFactory widgetFactory) { mc = new MagicComposite(composite, SWT.INHERIT_DEFAULT); mc.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(0, 0).spacing(0, 0).create()); checkBoxControl = new Button(mc, SWT.CHECK); if (widgetFactory != null) { widgetFactory.adapt(checkBoxControl, true, true); } checkBoxControl .setLayoutData(GridDataFactory.fillDefaults().grab(false, true).hint(SWT.DEFAULT, 30).indent(16, 0) .align(SWT.BEGINNING, SWT.CENTER).create()); control = new Composite(mc, SWT.INHERIT_DEFAULT); if (widgetFactory != null) { widgetFactory.adapt(control); } control.addDisposeListener(disposeListener); control.setLayoutData(GridDataFactory.fillDefaults().grab(false, true).align(SWT.BEGINNING, SWT.CENTER).create()); control.setLayout(GridLayoutFactory.fillDefaults().numColumns(2).margins(0, 0).spacing(0, 0).create()); createTextControl(style, widgetFactory); createToolbar(style, widgetFactory); if ((style & SWT.BORDER) != 0) {//Not in a table createSwitchEditorControl(widgetFactory); } addDecorator(composite); mc.show(checkBoxControl); mc.hide(control); }
Example 17
Source File: XFindPanel.java From xds-ide with Eclipse Public License 1.0 | 4 votes |
public XFindPanel(final Composite parent, IEditorPart editorPart) { super(parent, SWT.NONE); statusLine = new StatusLine(editorPart.getEditorSite()); setVisible(false); if (editorPart != null) { target = (IFindReplaceTarget) editorPart.getAdapter(IFindReplaceTarget.class); isRegExSupported = (target instanceof IFindReplaceTargetExtension3); } final IPreferenceStore store = XFindPlugin.getDefault().getPreferenceStore(); if (!store.contains(XFIND_PANEL_PLACEMENT)) { store.setDefault(XFIND_PANEL_PLACEMENT, XFIND_PANEL_PLACEMENT_TOP); } if (store.getInt(XFIND_PANEL_PLACEMENT) == XFIND_PANEL_PLACEMENT_BOTTOM) { moveBelow(null); } else { moveAbove(null); } createContents(); loadHistory(store); store.addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(final PropertyChangeEvent event) { Display.getDefault().syncExec(new Runnable() { @Override public void run() { if (XFIND_PANEL_PLACEMENT.equals(event.getProperty())) { if (store.getInt(XFIND_PANEL_PLACEMENT) == XFIND_PANEL_PLACEMENT_BOTTOM) { moveBelow(null); } else { moveAbove(null); } parent.layout(); } } }); } }); parent.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { saveHistory(store); } }); }
Example 18
Source File: ChartLegend.java From olca-app with Mozilla Public License 2.0 | 4 votes |
ChartLegend(Composite parent) { composite = new Composite(parent, SWT.NONE); UI.gridData(composite, true, true); UI.gridLayout(composite, 1); composite.addDisposeListener((e) -> imageRegistry.dispose()); }
Example 19
Source File: HsImageLabel.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
public Composite createControl(Composite parent) { parent.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { dispose(); } }); Composite content = new Composite(parent, SWT.NONE); GridLayout contentLayout = new GridLayout(2, false); contentLayout.marginWidth = 0; contentLayout.marginHeight = 0; content.setLayout(contentLayout); content.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); this.control = content; imageLabel = createImageLabel(content); if (imageLabel != null) { imageLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); } Composite composite = new Composite(content, SWT.NONE); GridLayout comLayout = new GridLayout(); comLayout.marginWidth = 0; comLayout.marginHeight = 0; composite.setLayout(comLayout); composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); descriptionLabel = createDescriptionLabel(composite); if (descriptionLabel != null) { descriptionLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); } body = new Composite(composite, SWT.NONE); GridLayout gd = new GridLayout(); gd.marginRight = 0; gd.marginHeight = 0; body.setLayout(gd); if (body != null) { body.setLayoutData(new GridData(GridData.FILL_BOTH)); } return body; }
Example 20
Source File: MOOSEFormEditor.java From ice with Eclipse Public License 1.0 | 4 votes |
/** * Creates the content used for the plant view. * * @param section * The {@code Section} that should contain the plant view. * @param toolkit * The {@code FormToolkit} used to decorate widgets as necessary. */ private void populatePlantViewSection(Section section, FormToolkit toolkit) { // Get the background color to use later. Color background = section.getBackground(); // Create an analysis composite to contain a ToolBar and an // analysis-based view. Composite analysisComposite = new Composite(section, SWT.NONE); analysisComposite.setBackground(background); analysisComposite.setLayout(new GridLayout(1, false)); // Set the overall client of the plant view's Section. section.setClient(analysisComposite); // Create a ToolBarManager so we can add JFace Actions to it. ToolBarManager toolBarManager = new ToolBarManager(SWT.RIGHT); // Fill the ToolBar with customized controls. fillPlantViewToolBar(toolBarManager); toolBarManager.update(true); // Add it to the view. ToolBar toolBar = toolBarManager.createControl(analysisComposite); toolBar.setBackground(background); toolBar.setLayoutData( new GridData(SWT.FILL, SWT.BEGINNING, true, false)); // Create the plant composite. TreeComposite components = findComponentBlock(); factory.setTree(components); PlantComposite plant = factory.getPlant(); //Get the factory and create a plant view from the composite ViewFactory viewFactory = new ViewFactory(); viewFactory.setVizServiceFactory((BasicVizServiceFactory) VizServiceFactoryHolder.getFactory()); plantView = viewFactory.createPlantView(plant); // Render the plant view in the analysis Composite. Composite plantComposite = plantView.createComposite(analysisComposite); plantComposite.setBackground(background); plantComposite .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); // Make sure the factory/plant is reset when the plant view is disposed. plantComposite.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { factory.setTree(new TreeComposite()); } }); return; }