public static void updateMainWindowTitle(IWorkbenchWindow window) { IProject activeProject = DBeaverCore.getInstance().getProjectRegistry().getActiveProject(); IProduct product = Platform.getProduct(); String title = product == null ? "Unknown" : product.getName(); // $NON-NLS-1$ if (activeProject != null) { title += " - " + activeProject.getName(); // $NON-NLS-1$ } IWorkbenchPage activePage = window.getActivePage(); if (activePage != null) { IEditorPart activeEditor = activePage.getActiveEditor(); if (activeEditor != null) { title += " - [ " + activeEditor.getTitle() + " ]"; } } window.getShell().setText(title); }
private void openSchemaFile(final IFile file) { final IWorkbenchWindow ww = PDEPlugin.getActiveWorkbenchWindow(); Display d = ww.getShell().getDisplay(); d.asyncExec( new Runnable() { @Override public void run() { try { String editorId = IPDEUIConstants.SCHEMA_EDITOR_ID; ww.getActivePage().openEditor(new FileEditorInput(file), editorId); } catch (PartInitException e) { PDEPlugin.logException(e); } } }); }
protected void runSootAsProcess(String cmd) { SootProcessRunner op; try { newProcessStarting(); op = new SootProcessRunner(Display.getCurrent(), cmd, sootClasspath); if (window == null) { window = SootPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow(); } new ProgressMonitorDialog(window.getShell()).run(true, true, op); } catch (InvocationTargetException e1) { // handle exception } catch (InterruptedException e2) { // handle cancelation System.out.println(e2.getMessage()); } }