org.eclipse.ui.IWorkbench Java Examples
The following examples show how to use
org.eclipse.ui.IWorkbench.
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: UIUtils.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
/** * Opens the internal help in the Studio's internal browser. * * @param url * @return A boolean value indicating a successful operations or not. */ public static boolean openHelpInBrowser(String url) { IWorkbench workbench = PlatformUI.getWorkbench(); if (workbench != null) { IWorkbenchHelpSystem helpSystem = workbench.getHelpSystem(); URL resolvedURL = helpSystem.resolve(url, true); if (resolvedURL != null) { return openInBroswer(resolvedURL, true, IWorkbenchBrowserSupport.AS_EDITOR | IWorkbenchBrowserSupport.STATUS); } else { IdeLog.logError(UIPlugin.getDefault(), "Unable to resolve the Help URL for " + url); //$NON-NLS-1$ return false; } } return false; }
Example #2
Source File: TmfOpenTraceHelper.java From tracecompass with Eclipse Public License 2.0 | 6 votes |
/** * Returns the editor with the specified input. Returns null if there is no * opened editor with that input. If restore is requested, the method finds and * returns the editor even if it is not restored yet after a restart. * * @param input * the editor input * @param restore * true if the editor should be restored * @return an editor with input equals to <code>input</code> */ private static IEditorPart findEditor(IEditorInput input, boolean restore) { final IWorkbench wb = PlatformUI.getWorkbench(); final IWorkbenchPage activePage = wb.getActiveWorkbenchWindow().getActivePage(); for (IEditorReference editorReference : activePage.getEditorReferences()) { try { IEditorInput editorInput = editorReference.getEditorInput(); if (editorInput.equals(input)) { return editorReference.getEditor(restore); } } catch (PartInitException e) { // do nothing } } return null; }
Example #3
Source File: Navigator.java From olca-app with Mozilla Public License 2.0 | 6 votes |
/** * Returns the instance of the navigation view or NULL if there is# no such * instance available. */ public static Navigator getInstance() { IWorkbench workbench = PlatformUI.getWorkbench(); if (workbench == null) return null; IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); if (window == null) return null; IWorkbenchPage page = window.getActivePage(); if (page == null) return null; IViewPart part = page.findView(ID); if (part instanceof Navigator) return (Navigator) part; return null; }
Example #4
Source File: Utils.java From EasyShell with Eclipse Public License 2.0 | 6 votes |
private static void executeCommand(IWorkbench workbench, String commandName, Map<String, Object> params) { if (workbench == null) { workbench = PlatformUI.getWorkbench(); } // get command ICommandService commandService = (ICommandService)workbench.getService(ICommandService.class); Command command = commandService != null ? commandService.getCommand(commandName) : null; // get handler service //IBindingService bindingService = (IBindingService)workbench.getService(IBindingService.class); //TriggerSequence[] triggerSequenceArray = bindingService.getActiveBindingsFor("de.anbos.eclipse.easyshell.plugin.commands.open"); IHandlerService handlerService = (IHandlerService)workbench.getService(IHandlerService.class); if (command != null && handlerService != null) { ParameterizedCommand paramCommand = ParameterizedCommand.generateCommand(command, params); try { handlerService.executeCommand(paramCommand, null); } catch (Exception e) { Activator.logError(Activator.getResourceString("easyshell.message.error.handlerservice.execution"), paramCommand.toString(), e, true); } } }
Example #5
Source File: OpenJavaPerspectiveAction.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
@Override public void run() { IWorkbench workbench= JavaPlugin.getDefault().getWorkbench(); IWorkbenchWindow window= workbench.getActiveWorkbenchWindow(); IWorkbenchPage page= window.getActivePage(); IAdaptable input; if (page != null) input= page.getInput(); else input= ResourcesPlugin.getWorkspace().getRoot(); try { workbench.showPerspective(JavaUI.ID_PERSPECTIVE, window, input); } catch (WorkbenchException e) { ExceptionHandler.handle(e, window.getShell(), ActionMessages.OpenJavaPerspectiveAction_dialog_title, ActionMessages.OpenJavaPerspectiveAction_error_open_failed); } }
Example #6
Source File: UIHelper.java From tlaplus with MIT License | 6 votes |
/** * Opens the new window containing the new perspective * * @param perspectiveId * new perspective * @param input * IAdaptable, or null if no input * @return IWorkbenchWindow instance * */ public static IWorkbenchWindow openPerspectiveInNewWindow(String perspectiveId, IAdaptable input) { IWorkbench workbench = Activator.getDefault().getWorkbench(); IWorkbenchWindow window = null; try { // avoids flicking, from implementation above window = workbench.openWorkbenchWindow(perspectiveId, input); // show intro if (InitialPerspective.ID.equals(perspectiveId) && workbench.getIntroManager().hasIntro()) { // IIntroPart intro = workbench.getIntroManager().showIntro(window, true); } } catch (WorkbenchException e) { // TODO Auto-generated catch block e.printStackTrace(); } return window; }
Example #7
Source File: KeyAssistHandler.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
public Object execute(ExecutionEvent event) throws ExecutionException { final IWorkbench workbench = PlatformUI.getWorkbench(); IBindingService bindingService = (IBindingService) workbench.getService(IBindingService.class); BindingService service = (BindingService) bindingService; ArrayList<Binding> lstBinding = new ArrayList<Binding>(Arrays.asList(bindingService.getBindings())); List<String> lstRemove = Constants.lstRemove; Iterator<Binding> it = lstBinding.iterator(); while (it.hasNext()) { Binding binding = it.next(); ParameterizedCommand pCommand = binding.getParameterizedCommand(); if (pCommand == null || lstRemove.contains(pCommand.getCommand().getId())) { it.remove(); } } service.getKeyboard().openKeyAssistShell(lstBinding); return null; }
Example #8
Source File: Starter.java From IndentGuide with MIT License | 6 votes |
public void earlyStartup() { PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() { public void run() { IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); if (window != null) { IWorkbenchPage page = window.getActivePage(); if (page != null) { IEditorPart part = page.getActiveEditor(); if (part != null) { addListener(part); } } window.getPartService().addPartListener(new PartListener()); } workbench.addWindowListener(new WindowListener()); } }); }
Example #9
Source File: ADocSpecExportWizard.java From n4js with Eclipse Public License 1.0 | 6 votes |
@Override public void init(IWorkbench targetWorkbench, IStructuredSelection currentSelection) { this.selection = currentSelection; List<?> selectedResources = IDE.computeSelectedResources(currentSelection); if (!selectedResources.isEmpty()) { this.selection = new StructuredSelection(selectedResources); } setWindowTitle("AsciiDoc Specification Export"); setNeedsProgressMonitor(true); configAdocPage = new SpecConfigAdocPage("Configuration Page"); processAdocPage = new SpecProcessPage("Process Page"); comparePage = new SpecComparePage("Compare Page", "Adoc"); summaryPage = new SpecExportCodeSummaryPage("Summary Page"); processOutputPage = new SpecProcessPage("Process Page"); taskGenAdoc = new TaskGenerateAdoc(jsDoc2SpecProcessor, resourceSetProvider, n4JSCore, selection, configAdocPage, processAdocPage); taskWriteFiles = new TaskWriteFiles(processOutputPage, taskGenAdoc); addVisibilityListeners(); }
Example #10
Source File: RefactorRenameHandler.java From tesb-studio-se with Apache License 2.0 | 6 votes |
public boolean isEnabled() { if (!handler.isEnabled()) { return false; } // disable the command when editor is readonly. IWorkbench workbench = PlatformUI.getWorkbench(); if (workbench == null) { return false; } IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); if (window == null) { return false; } IWorkbenchPage activePage = window.getActivePage(); if (activePage == null) { return false; } IEditorPart activeEditor = activePage.getActiveEditor(); if (activeEditor != null && activeEditor instanceof LocalWSDLEditor) { LocalWSDLEditor wsdlEditor = (LocalWSDLEditor) activeEditor; return !wsdlEditor.isEditorInputReadOnly(); } return false; }
Example #11
Source File: DeploymentModelWizard.java From neoscada with Eclipse Public License 1.0 | 5 votes |
/** * This just records the information. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void init ( IWorkbench workbench, IStructuredSelection selection ) { this.workbench = workbench; this.selection = selection; setWindowTitle ( WorldEditorPlugin.INSTANCE.getString ( "_UI_Wizard_label" ) ); //$NON-NLS-1$ setDefaultPageImageDescriptor ( ExtendedImageRegistry.INSTANCE.getImageDescriptor ( WorldEditorPlugin.INSTANCE.getImage ( "full/wizban/NewDeployment" ) ) ); //$NON-NLS-1$ }
Example #12
Source File: NewReportWizard.java From birt with Eclipse Public License 1.0 | 5 votes |
public void init( IWorkbench workbench, IStructuredSelection selection ) { // check existing open project IWorkspaceRoot root = ResourcesPlugin.getWorkspace( ).getRoot( ); IProject projects[] = root.getProjects( ); boolean foundOpenProject = false; for ( int i = 0; i < projects.length; i++ ) { if ( projects[i].isOpen( ) ) { foundOpenProject = true; break; } } if ( !foundOpenProject ) { MessageDialog.openError( getShell( ), Messages.getString( "NewReportWizard.title.Error" ), //$NON-NLS-1$ Messages.getString( "NewReportWizard.error.NoProject" ) ); //$NON-NLS-1$ // abort wizard. There is no clean way to do it. /** * Remove the exception here 'cause It's safe since the wizard won't * create any file without an open project. */ // throw new RuntimeException( ); } // OK this.selection = selection; setWindowTitle( NEW ); }
Example #13
Source File: H5ValuePage.java From dawnsci with Eclipse Public License 1.0 | 5 votes |
private static IWorkbenchPage getActivePage() { final IWorkbench bench = PlatformUI.getWorkbench(); if (bench == null) return null; final IWorkbenchWindow window = bench.getActiveWorkbenchWindow(); if (window == null) return null; return window.getActivePage(); }
Example #14
Source File: VisualInterfaceModelWizard.java From neoscada with Eclipse Public License 1.0 | 5 votes |
/** * This just records the information. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public void init ( final IWorkbench workbench, final IStructuredSelection selection ) { this.workbench = workbench; this.selection = selection; setWindowTitle ( VisualInterfaceEditorPlugin.INSTANCE.getString ( "_UI_Wizard_label" ) ); //$NON-NLS-1$ setDefaultPageImageDescriptor ( ExtendedImageRegistry.INSTANCE.getImageDescriptor ( VisualInterfaceEditorPlugin.INSTANCE.getImage ( "full/wizban/NewVisualInterface.png" ) ) ); //$NON-NLS-1$ }
Example #15
Source File: DetailViewModelWizard.java From neoscada with Eclipse Public License 1.0 | 5 votes |
/** * This just records the information. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void init ( IWorkbench workbench, IStructuredSelection selection ) { this.workbench = workbench; this.selection = selection; setWindowTitle ( DetailViewEditorPlugin.INSTANCE.getString ( "_UI_Wizard_label" ) ); //$NON-NLS-1$ setDefaultPageImageDescriptor ( ExtendedImageRegistry.INSTANCE.getImageDescriptor ( DetailViewEditorPlugin.INSTANCE.getImage ( "full/wizban/NewDetailView" ) ) ); //$NON-NLS-1$ }
Example #16
Source File: RunAppEngineShortcutTest.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
@Test public void testRunAppEngine_hiddenEvenIfAppEngineProjectFileIsOpen() throws CoreException { IProject emptyProject = emptyProjectCreator.getProject(); // Create an empty file in the App Engine project, and open it in an editor. IProject appEngineProject = appEngineProjectCreator.getProject(); IFile file = appEngineProject.getFile("textfile.txt"); file.create(new ByteArrayInputStream(new byte[0]), IFile.FORCE, null); IWorkbench workbench = PlatformUI.getWorkbench(); assertNotNull(WorkbenchUtil.openInEditor(workbench, file)); assertFalse(appEngineMenuExists(emptyProject)); }
Example #17
Source File: WorkbenchUtil.java From google-cloud-eclipse with Apache License 2.0 | 5 votes |
/** * Open the specified file in the editor. * * @param workbench the active workbench * @param file the file to open */ public static IEditorPart openInEditor(IWorkbench workbench, IFile file) { IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); if (window != null && file != null) { IWorkbenchPage page = window.getActivePage(); try { return IDE.openEditor(page, file, true); } catch (PartInitException ex) { // ignore; we don't have to open the file } } return null; }
Example #18
Source File: ImportWizard.java From olca-app with Mozilla Public License 2.0 | 5 votes |
@Override public void init(IWorkbench workbench, IStructuredSelection selection) { setWindowTitle(M.ILCD_NetworkImport); setDefaultPageImageDescriptor(RcpActivator.imageDescriptorFromPlugin( RcpActivator.PLUGIN_ID, "/icons/network_wiz.png")); setNeedsProgressMonitor(true); processSearchPage = new ProcessSearchPage(); }
Example #19
Source File: TeamAction.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Convenience method for getting the current shell. * * @return the shell */ public Shell getShell() { if (shell != null) { return shell; } else { IWorkbench workbench = SVNUIPlugin.getPlugin().getWorkbench(); if (workbench == null) return null; IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); if (window == null) return null; return window.getShell(); } }
Example #20
Source File: KeyController2.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("restriction") public void filterDupliteBind(){ IWorkbench workbench = PlatformUI.getWorkbench(); IBindingService bindingService = (IBindingService) workbench.getService(IBindingService.class); BindingService service =(BindingService)bindingService; BindingManager bindingManager = service.getBindingManager(); //service.getBindingManager(). Binding[] bindings = bindingManager.getBindings(); List<Binding> bindTemp = new ArrayList<Binding>(); List<String> ids = new ArrayList<String>(); for(Binding bind : bindings){ if(null ==bind){ continue; } ParameterizedCommand command = bind.getParameterizedCommand(); if(null == command){ continue; } String id = command.getId(); if(!ids.contains(id)){ ids.add(id); bindTemp.add(bind); } } bindingManager.setBindings(bindTemp.toArray(new Binding[ids.size()])); }
Example #21
Source File: NewItemWizard.java From ice with Eclipse Public License 1.0 | 5 votes |
/** * This is called when initialized by the Eclipse workbench (i.e., via the * basic new wizard). */ @Override public void init(IWorkbench workbench, IStructuredSelection selection) { // Save the window workbenchWindow = workbench.getActiveWorkbenchWindow(); // Get and save the project. This just casts to IResource since // IProjects are IResources and doing otherwise would require additional // checks. Object element = selection.getFirstElement(); if (element instanceof IResource) { project = ((IResource) element).getProject(); } }
Example #22
Source File: ChangeConverter.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected ChangeConverter(String name, Predicate<Change> changeFilter, RefactoringIssueAcceptor issues, ResourceURIConverter uriConverter, IWorkbench workbench) { currentChange = new CompositeChange(name); this.issues = issues; this.changeFilter = changeFilter; this.resourceUriConverter = uriConverter; this.workbench = workbench; }
Example #23
Source File: BreakpointConditionEditor.java From Pydev with Eclipse Public License 1.0 | 5 votes |
public void dispose() { if (fViewer.isEditable()) { IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchCommandSupport commandSupport = workbench.getCommandSupport(); commandSupport.removeHandlerSubmission(submission); } fViewer.getDocument().removeDocumentListener(fDocumentListener); fViewer.dispose(); }
Example #24
Source File: DotnetExportWizard.java From aCute with Eclipse Public License 2.0 | 5 votes |
@Override public void init(IWorkbench workbench, IStructuredSelection selection) { setWindowTitle(Messages.DotnetExportWizard_exportProject); Iterator<Object> selectionIterator = selection.iterator(); IFile projectFile = null; while (selectionIterator.hasNext() && projectFile == null) { IResource resource = (IResource) selectionIterator.next(); projectFile = getProjectFile(resource.getProject()); } wizardPage = new DotnetExportWizardPage(projectFile); }
Example #25
Source File: ImportTraceWizard.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
@Override public void init(IWorkbench workbench, IStructuredSelection selection) { fSelection = selection; setWindowTitle(Messages.ImportTraceWizard_DialogTitle); setDefaultPageImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, ICON_PATH)); setNeedsProgressMonitor(true); }
Example #26
Source File: FindingsSettings.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
@Override public void init(IWorkbench workbench){ setPreferenceStore(new SettingsPreferenceStore(CoreHub.globalCfg)); setMessage("Globale Befunde Einstellungen"); // initialize the model if (FindingsServiceComponent.getService() != null) { FindingsServiceComponent.getService().findById("", IObservation.class); } else { getLogger().warn("FindingsService is null - not found."); setErrorMessage("Befunde Service konnte nicht geladen werden."); } }
Example #27
Source File: FilenameDifferentiator.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public void dispose() { IWorkbench workbench = null; try { workbench = PlatformUI.getWorkbench(); } catch (Exception e) { // ignore } if (workbench != null) { IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); if (window != null) { IWorkbenchPage page = window.getActivePage(); if (page != null) { page.removePartListener(this); } } } if (baseNames != null) { baseNames.clear(); baseNames = null; } }
Example #28
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 #29
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 #30
Source File: GlobalizeModelWizard.java From neoscada with Eclipse Public License 1.0 | 5 votes |
/** * This just records the information. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void init ( IWorkbench workbench, IStructuredSelection selection ) { this.workbench = workbench; this.selection = selection; setWindowTitle ( GlobalizeEditorPlugin.INSTANCE.getString ( "_UI_Wizard_label" ) ); //$NON-NLS-1$ setDefaultPageImageDescriptor ( ExtendedImageRegistry.INSTANCE.getImageDescriptor ( GlobalizeEditorPlugin.INSTANCE.getImage ( "full/wizban/NewGlobalize" ) ) ); //$NON-NLS-1$ }