Java Code Examples for org.eclipse.ui.IWorkbench#getDisplay()
The following examples show how to use
org.eclipse.ui.IWorkbench#getDisplay() .
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: Application.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@Override public void stop () { if ( !PlatformUI.isWorkbenchRunning () ) { return; } final IWorkbench workbench = PlatformUI.getWorkbench (); final Display display = workbench.getDisplay (); display.syncExec ( new Runnable () { @Override public void run () { if ( !display.isDisposed () ) { workbench.close (); } } } ); }
Example 2
Source File: Application.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@Override public void stop () { if ( !PlatformUI.isWorkbenchRunning () ) { return; } final IWorkbench workbench = PlatformUI.getWorkbench (); final Display display = workbench.getDisplay (); display.syncExec ( new Runnable () { @Override public void run () { if ( !display.isDisposed () ) { workbench.close (); } } } ); }
Example 3
Source File: RcpApplication.java From olca-app with Mozilla Public License 2.0 | 6 votes |
@Override public void stop() { final IWorkbench workbench = PlatformUI.getWorkbench(); if (workbench == null) { return; } final Display display = workbench.getDisplay(); display.syncExec(new Runnable() { @Override public void run() { if (!display.isDisposed()) { workbench.close(); } } }); }
Example 4
Source File: SyncUtil.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
public void reconcileAllEditors(IWorkbench workbench, final boolean saveAll, final IProgressMonitor monitor) { for (IWorkbenchWindow window : workbench.getWorkbenchWindows()) { for (IWorkbenchPage page : window.getPages()) { for (IEditorReference editorReference : page.getEditorReferences()) { if (monitor.isCanceled()) return; final IEditorPart editor = editorReference.getEditor(false); if (editor != null) { if (editor instanceof XtextEditor) { waitForReconciler((XtextEditor) editor); } if (saveAll) { Display display = workbench.getDisplay(); display.syncExec(new Runnable() { @Override public void run() { if (editor.isDirty()) { editor.doSave(monitor); } } }); } } } } } }
Example 5
Source File: Application.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
public void stop() { final IWorkbench workbench = PlatformUI.getWorkbench(); if (workbench == null) return; final Display display = workbench.getDisplay(); display.syncExec(new Runnable() { public void run() { if (!display.isDisposed()) workbench.close(); } }); }
Example 6
Source File: DebuggerTestUtils.java From Pydev with Eclipse Public License 1.0 | 5 votes |
/** * Creates a run in debug mode for the debug editor */ public void launchEditorInDebug() { final IWorkbench workBench = PydevPlugin.getDefault().getWorkbench(); Display display = workBench.getDisplay(); // Make sure to run the UI thread. display.syncExec(new Runnable() { @Override public void run() { JythonLaunchShortcut launchShortcut = new JythonLaunchShortcut(); launchShortcut.launch(debugEditor, "debug"); } }); }
Example 7
Source File: Application.java From slr-toolkit with Eclipse Public License 1.0 | 5 votes |
public void stop() { if (!PlatformUI.isWorkbenchRunning()) return; final IWorkbench workbench = PlatformUI.getWorkbench(); final Display display = workbench.getDisplay(); display.syncExec(new Runnable() { public void run() { if (!display.isDisposed()) workbench.close(); } }); }
Example 8
Source File: Application.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
public void stop() { if (!PlatformUI.isWorkbenchRunning()) return; final IWorkbench workbench = PlatformUI.getWorkbench(); final Display display = workbench.getDisplay(); display.syncExec(new Runnable() { public void run() { if (!display.isDisposed()) workbench.close(); } }); }
Example 9
Source File: Application.java From gama with GNU General Public License v3.0 | 5 votes |
@Override public void stop() { final IWorkbench workbench = PlatformUI.getWorkbench(); if ( workbench == null ) { return; } final Display display = workbench.getDisplay(); display.syncExec(() -> { if ( !display.isDisposed() ) { workbench.close(); } }); }
Example 10
Source File: Application.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
public void stop() { final IWorkbench workbench = PlatformUI.getWorkbench(); if (workbench == null) return; final Display display = workbench.getDisplay(); display.syncExec(new Runnable() { public void run() { if (!display.isDisposed()) workbench.close(); } }); }
Example 11
Source File: Application.java From tlaplus with MIT License | 5 votes |
public void stop() { final IWorkbench workbench = PlatformUI.getWorkbench(); if (workbench == null) return; final Display display = workbench.getDisplay(); display.syncExec(new Runnable() { public void run() { if (!display.isDisposed()) workbench.close(); } }); }
Example 12
Source File: Application.java From MergeProcessor with Apache License 2.0 | 5 votes |
/** * @see org.eclipse.equinox.app.IApplication#stop() */ @Override public void stop() { // stop, hammer time if (!PlatformUI.isWorkbenchRunning()) return; final IWorkbench workbench = PlatformUI.getWorkbench(); final Display display = workbench.getDisplay(); display.syncExec(() -> { if (!display.isDisposed()) { workbench.close(); } }); }
Example 13
Source File: CloudSdkUpdateNotification.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
@VisibleForTesting CloudSdkUpdateNotification( IWorkbench workbench, CloudSdkVersion sdkVersion, Runnable updateRunnable) { super(workbench.getDisplay()); this.workbench = workbench; this.sdkVersion = sdkVersion; this.updateRunnable = updateRunnable; }
Example 14
Source File: WorkbenchUtil.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
/** * Opens the specified url in a Web browser instance in a UI thread. * * @param urlPath the URL to display * @param browserId if an instance of a browser with the same id is already opened, it will be * returned instead of creating a new one. Passing null will create a new instance with a * generated id. * @param name a name displayed on the tab of the internal browser * @param tooltip the text for a tooltip on the <code>name</code> of the internal browser */ public static void openInBrowserInUiThread(final String urlPath, final String browserId, final String name, final String tooltip) { final IWorkbench workbench = PlatformUI.getWorkbench(); Job launchBrowserJob = new UIJob(workbench.getDisplay(), name) { @Override public IStatus runInUIThread(IProgressMonitor monitor) { return openInBrowser(workbench, urlPath, browserId, name, tooltip); } }; launchBrowserJob.schedule(); }
Example 15
Source File: Application.java From orion.server with Eclipse Public License 1.0 | 5 votes |
public void stop() { if (!PlatformUI.isWorkbenchRunning()) return; final IWorkbench workbench = PlatformUI.getWorkbench(); final Display display = workbench.getDisplay(); display.syncExec(new Runnable() { public void run() { if (!display.isDisposed()) workbench.close(); } }); }
Example 16
Source File: Application.java From neoscada with Eclipse Public License 1.0 | 5 votes |
public void stop() { if (!PlatformUI.isWorkbenchRunning()) return; final IWorkbench workbench = PlatformUI.getWorkbench(); final Display display = workbench.getDisplay(); display.syncExec(new Runnable() { public void run() { if (!display.isDisposed()) workbench.close(); } }); }
Example 17
Source File: N4JSApplication.java From n4js with Eclipse Public License 1.0 | 5 votes |
@Override public void stop() { final IWorkbench workbench = PlatformUI.getWorkbench(); if (workbench == null) return; final Display display = workbench.getDisplay(); display.syncExec(new Runnable() { @Override public void run() { if (!display.isDisposed()) workbench.close(); } }); }
Example 18
Source File: ExamplesApplication.java From nebula with Eclipse Public License 2.0 | 5 votes |
@Override public void stop() { final IWorkbench workbench = PlatformUI.getWorkbench(); if (workbench == null) { return; } final Display display = workbench.getDisplay(); display.syncExec(() -> { if (!display.isDisposed()) { workbench.close(); } }); }
Example 19
Source File: CloudSdkInstallNotification.java From google-cloud-eclipse with Apache License 2.0 | 4 votes |
@VisibleForTesting CloudSdkInstallNotification(IWorkbench workbench, Runnable installRunnable) { super(workbench.getDisplay()); this.workbench = workbench; this.installRunnable = installRunnable; }
Example 20
Source File: PyCodeCoverageTestWorkbench.java From Pydev with Eclipse Public License 1.0 | 4 votes |
public void testPyCodeCoverageView() throws Exception { final PyCodeCoverageView view = PyCodeCoverageView.getView(true); //At this point it should have no folder selected and the option to run things in coverage should be //set to false. assertTrue(!PyCoveragePreferences.getAllRunsDoCoverage()); assertTrue(PyCodeCoverageView.getChosenDir() == null); assertTrue(!view.allRunsGoThroughCoverage.getSelection()); assertTrue(!PyCoveragePreferences.getInternalAllRunsDoCoverage()); view.allRunsGoThroughCoverage.setSelection(true); view.allRunsGoThroughCoverage.notifyListeners(SWT.Selection, new Event()); assertTrue(PyCoveragePreferences.getInternalAllRunsDoCoverage()); assertTrue(!PyCoveragePreferences.getAllRunsDoCoverage()); view.setSelectedContainer(sourceFolder); TreeViewer treeViewer = view.getTreeViewer(); ITreeContentProvider cp = (ITreeContentProvider) treeViewer.getContentProvider(); Object[] elements = cp.getElements(treeViewer.getInput()); assertEquals(1, elements.length); ILabelProvider labelProvider = (ILabelProvider) treeViewer.getLabelProvider(); assertEquals("pack_cov", labelProvider.getText(elements[0])); TestCaseUtils.assertContentsEqual(getInitialCoverageText(), view.getCoverageText()); Object[] expandedElements = treeViewer.getExpandedElements(); assertEquals(0, expandedElements.length); treeViewer.expandAll(); expandedElements = treeViewer.getExpandedElements(); assertEquals(1, expandedElements.length); view.executeRefreshAction(new NullProgressMonitor()); expandedElements = treeViewer.getExpandedElements(); assertEquals(1, expandedElements.length); assertTrue(PyCoveragePreferences.getAllRunsDoCoverage()); final IWorkbench workBench = PydevPlugin.getDefault().getWorkbench(); Display display = workBench.getDisplay(); // Make sure to run the UI thread. final PyEdit modCovEditor = (PyEdit) PyOpenEditor.doOpenEditor(modCov); try { display.syncExec(new Runnable() { @Override public void run() { LaunchShortcut launchShortcut = new LaunchShortcut(); launchShortcut.launch(modCovEditor, "run"); } }); final String modCovCoverageText = StringUtils.replaceNewLines(getModCovCoverageText(), "\n"); //Should be enough time for the refresh to happen! goToManual(10000, new ICallback<Boolean, Object>() { @Override public Boolean call(Object arg) { return modCovCoverageText.equals(StringUtils.replaceNewLines(view.getCoverageText(), "\n")); } }); TestCaseUtils.assertContentsEqual(modCovCoverageText, view.getCoverageText()); //goToManual(); } finally { try { modCovEditor.close(false); } catch (Exception e) { //ignore anything here } } }