Java Code Examples for org.eclipse.ui.IWorkbench
The following are top voted examples for showing how to use
org.eclipse.ui.IWorkbench. These examples are extracted from open source projects.
You can vote up the examples you like and your votes will be used in our system to generate
more good examples.
Example 1
Project: n4js File: ADocSpecExportWizard.java View source code | 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"); configOutputPage = new SpecConfigOutputPage("Configuration Page"); processOutputPage = new SpecProcessPage("Process Page"); taskGenAdoc = new TaskGenerateAdoc(jsDoc2SpecProcessor, resourceSetProvider, n4JSCore, selection, configAdocPage, processAdocPage); taskWriteFiles = new TaskWriteFiles(processOutputPage, taskGenAdoc); addVisibilityListeners(); }
Example 2
Project: gw4e.project File: GW4EPreferencePage.java View source code | 6 votes |
private SWTBotShell showPreferenceDialogMAC() { final IWorkbench workbench = PlatformUI.getWorkbench(); workbench.getDisplay().asyncExec(new Runnable() { public void run() { IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); if (window != null) { Menu appMenu = workbench.getDisplay().getSystemMenu(); for (MenuItem item : appMenu.getItems()) { if (item.getText().startsWith("Preferences")) { Event event = new Event(); event.time = (int) System.currentTimeMillis(); event.widget = item; event.display = workbench.getDisplay(); item.setSelection(true); item.notifyListeners(SWT.Selection, event); break; } } } } }); return getPreferenceDialog() ; }
Example 3
Project: avro-schema-editor File: SchemaEditorPropertyTester.java View source code | 6 votes |
protected AvroSchemaEditor getEditor() { IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); if (window != null) { IWorkbenchPage workbenchPage = window.getActivePage(); if (workbenchPage != null) { IWorkbenchPart activePart = workbenchPage.getActivePart(); if (activePart instanceof IWithAvroSchemaEditor) { return ((IWithAvroSchemaEditor) activePart).getEditor(); } } } return null; }
Example 4
Project: eZooKeeper File: FileEditor.java View source code | 6 votes |
public static IEditorPart editFile(File file, boolean preferIdeEditor) throws IOException, PartInitException { if (file == null || !file.exists() || !file.isFile() || !file.canRead()) { throw new IOException("Invalid file: '" + file + "'"); } IWorkbench workBench = PlatformUI.getWorkbench(); IWorkbenchPage page = workBench.getActiveWorkbenchWindow().getActivePage(); IPath location = Path.fromOSString(file.getAbsolutePath()); IFileStore fileStore = EFS.getLocalFileSystem().getStore(location); FileStoreEditorInput fileStoreEditorInput = new FileStoreEditorInput(fileStore); String editorId = IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID; if (preferIdeEditor) { IEditorDescriptor editorDescriptor = workBench.getEditorRegistry().getDefaultEditor(file.getName()); if (editorDescriptor != null) { editorId = editorDescriptor.getId(); } } return page.openEditor(fileStoreEditorInput, editorId); }
Example 5
Project: neoscada File: Application.java View source code | 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 6
Project: avro-schema-editor File: SearchNodeControl.java View source code | 6 votes |
protected void search(String pattern, SearchType type, boolean withRef) { IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); IWorkbenchPage workbenchPage = workbenchWindow.getActivePage(); IEditorPart editorPart = workbenchPage.getActiveEditor(); if (editorPart instanceof IWithAvroSchemaEditor) { AvroSchemaEditor schemaEditor = ((IWithAvroSchemaEditor) editorPart).getEditor(); AvroContext masterContext = schemaEditor.getContext().getMaster(); SearchNodeContext searchNodeContext = masterContext.getSearchNodeContext(); if (pattern == null || pattern.trim().isEmpty()) { searchNodeContext.reset(); } else if (searchNodeContext.searchNodes(type, pattern, withRef)) { AvroNode node = searchNodeContext.next(); schemaEditor.getContentPart() .getSchemaViewer(AvroContext.Kind.MASTER) .setSelection(new StructuredSelection(node), true); } refreshCommands(editorPart, SearchNodePropertyTester.PROPERTIES); } }
Example 7
Project: n4js File: EditorsUtil.java View source code | 5 votes |
static private final IWorkbenchPage unsafeGetWorkbenchPage() { IWorkbenchPage page = null; if (PlatformUI.isWorkbenchRunning()) { IWorkbench wb = PlatformUI.getWorkbench(); IWorkbenchWindow win = wb.getActiveWorkbenchWindow(); page = win.getActivePage(); } return page; }
Example 8
Project: n4js File: AbstractBuilderTest.java View source code | 5 votes |
/***/ @SuppressWarnings("restriction") protected IWorkbenchPage getActivePage() { IWorkbenchPage page = null; if (org.eclipse.ui.internal.Workbench.getInstance() != null) { IWorkbench wb = PlatformUI.getWorkbench(); IWorkbenchWindow window = wb.getActiveWorkbenchWindow(); // Could be null if using Timeout test rule and does not run on main thread. if (null != window) { page = window.getActivePage(); } } return page; }
Example 9
Project: Hydrograph File: JobRunPreference.java View source code | 5 votes |
@Override public void init(IWorkbench workbench) { getPreferenceStore().setDefault(SAVE_JOB_BEFORE_RUN_PREFRENCE, MessageDialogWithToggle.PROMPT); getPreferenceStore().setDefault(LOG_LEVEL_PREFERENCE,DEFUALT_LOG_LEVEL); String value = Activator.getDefault().getPreferenceStore() .getString(SAVE_JOB_BEFORE_RUN_PREFRENCE); if (StringUtils.equals(MessageDialogWithToggle.ALWAYS, value)) { getPreferenceStore().setValue(SAVE_JOB_BEFORE_RUN_PREFRENCE, value); } else { getPreferenceStore().setValue(SAVE_JOB_BEFORE_RUN_PREFRENCE, MessageDialogWithToggle.PROMPT); } String log_level_value= Activator.getDefault().getPreferenceStore().getString(JobRunPreference.LOG_LEVEL_PREFERENCE); if (StringUtils.isNotBlank(log_level_value)) { getPreferenceStore().setValue(LOG_LEVEL_PREFERENCE, log_level_value); } else { getPreferenceStore().setValue(LOG_LEVEL_PREFERENCE, DEFUALT_LOG_LEVEL); } String consoleBufferValue = Activator.getDefault().getPreferenceStore().getString(Constants.CONSOLE_BUFFER_SIZE_PREFERANCE_NAME); if(StringUtils.isNotBlank(consoleBufferValue)){ getPreferenceStore().setValue(Constants.CONSOLE_BUFFER_SIZE_PREFERANCE_NAME, consoleBufferValue); }else{ getPreferenceStore().setValue(Constants.CONSOLE_BUFFER_SIZE_PREFERANCE_NAME, Constants.DEFUALT_CONSOLE_BUFFER_SIZE); } }
Example 10
Project: gw4e.project File: ConvertToFileCreationWizard.java View source code | 5 votes |
@Override public void init(IWorkbench workbench, IStructuredSelection selection) { this.workbench = workbench; this.selection = selection; setWindowTitle((MessageUtil.getString("GraphWalker_Conversion_File"))); //$NON-NLS-1$ setDefaultPageImageDescriptor(WIZARD_BANNER); }
Example 11
Project: n4js File: NFARExportWizard.java View source code | 5 votes |
@Override public void init(IWorkbench workbench, IStructuredSelection currentSelection) { this.selection = currentSelection; setWindowTitle(NFARExportMessages.WizardTitle_export); setDefaultPageImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin( "org.eclipse.ui.ide", "$nl$/icons/full/wizban/exportzip_wiz.png"));//$NON-NLS-1$ setNeedsProgressMonitor(true); }
Example 12
Project: n4js File: ManualAssociationAwareWorkingSetManager.java View source code | 5 votes |
/** * Resets the state of all Eclipse based working sets that belong to the 'Resources' type. */ private void resetEclipseWorkingSetsBaseOnCurrentState() { try { if (getWorkbench() == null || getWorkbench().getWorkingSetManager() == null) { return; // happens during shutdown } // Removed listener otherwise due to the Eclipse based working set deletion // we would delete our content. getWorkbench().getWorkingSetManager().removePropertyChangeListener(this); deleteEclipseResourcesWorkingSets(); final IWorkingSetManager manager = getWorkbench().getWorkingSetManager(); for (final WorkingSet workingSet : getAllWorkingSets()) { if (!OTHERS_WORKING_SET_ID.equals(workingSet.getId())) { org.eclipse.ui.internal.WorkingSet eclipseWorkingSet = createEclipseWorkingSet(workingSet); eclipseWorkingSet.setId(WorkingSetManagerModificationStrategy.RESOURCE_WORKING_SET_ID); manager.addWorkingSet(eclipseWorkingSet); } } } finally { IWorkbench wb = getWorkbench(); if (wb != null) { IWorkingSetManager wsm = wb.getWorkingSetManager(); if (wsm != null) { // null-safe re-adding (can be null during shutdown) wsm.addPropertyChangeListener(this); } } } }
Example 13
Project: n4js File: WorkingSetEditWizard.java View source code | 5 votes |
@Override public void init(final IWorkbench workbench, final IStructuredSelection selection) { if (selection != null && !selection.isEmpty()) { final Object firstElement = selection.getFirstElement(); if (firstElement instanceof WorkingSet) { editedWorkingSet = (WorkingSet) firstElement; } } }
Example 14
Project: OCCI-Studio File: InfrastructureModelWizard.java View source code | 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(InfrastructureEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(InfrastructureEditorPlugin.INSTANCE.getImage("full/wizban/NewInfrastructure"))); }
Example 15
Project: n4js File: N4JSApplicationWorkbenchWindowAdvisor.java View source code | 5 votes |
private void initN4Context() { if (isWorkbenchRunning()) { final IWorkbench workbench = getWorkbench(); workbench.getDisplay().asyncExec(() -> { final IContextService service = workbench.getService(IContextService.class); service.activateContext(N4_CONTEXT_ID); }); } }
Example 16
Project: n4js File: N4JSApplication.java View source code | 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 17
Project: gw4e.project File: FilterTests.java View source code | 5 votes |
private void resetWorkbench() { try { IViewReference[] views = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getViewReferences(); for (IViewReference iViewReference : views) { if ( iViewReference.getTitle().equals( "Welcome" ) ) { iViewReference.getPage().hideView(iViewReference); break; } } IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); IWorkbenchPage page = workbenchWindow.getActivePage(); Shell activeShell = Display.getCurrent().getActiveShell(); if ( activeShell != null && activeShell != workbenchWindow.getShell() ) { activeShell.close(); } page.closeAllEditors( false ); page.resetPerspective(); String defaultPerspectiveId = workbench.getPerspectiveRegistry().getDefaultPerspective(); workbench.showPerspective( defaultPerspectiveId, workbenchWindow ); page.resetPerspective(); } catch ( WorkbenchException e ) { throw new RuntimeException( e ); } }
Example 18
Project: AgentWorkbench File: UiBridge.java View source code | 5 votes |
/** * Returns the current workbench, if active. * @return the workbench */ public IWorkbench getWorkbench() { if (this.isWorkbenchRunning()==true) { return PlatformUI.getWorkbench(); } return null; }
Example 19
Project: AgentWorkbench File: UiBridge.java View source code | 5 votes |
/** * Returns the active workbench window. * @return the active workbench window */ public IWorkbenchWindow getActiveWorkbenchWindow() { IWorkbench iwb = this.getWorkbench(); if (iwb!=null) { return iwb.getActiveWorkbenchWindow(); } return null; }
Example 20
Project: bdf2 File: POJO2DataTypeWizard.java View source code | 5 votes |
@Override public void init(IWorkbench workbench, IStructuredSelection selection) { if(selection.isEmpty()){ // do nothing }else{ selectClassPage.init(selection); } }
Example 21
Project: SimQRI File: MetamodelModelWizard.java View source code | 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(MetamodelEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(MetamodelEditorPlugin.INSTANCE.getImage("full/wizban/NewMetamodel"))); }
Example 22
Project: eclipse-bash-editor File: EclipseUtil.java View source code | 5 votes |
/** * Returns workbench or <code>null</code> * * @return workbench or <code>null</code> */ private static IWorkbench getWorkbench() { if (!PlatformUI.isWorkbenchRunning()) { return null; } IWorkbench workbench = PlatformUI.getWorkbench(); return workbench; }
Example 23
Project: codelens-eclipse File: EditorTracker.java View source code | 5 votes |
private void init() { if (PlatformUI.isWorkbenchRunning()) { IWorkbench workbench = CodeLensEditorPlugin.getDefault().getWorkbench(); if (workbench != null) { IWorkbenchWindow[] windows = workbench.getWorkbenchWindows(); for (IWorkbenchWindow window : windows) { windowOpened(window); } CodeLensEditorPlugin.getDefault().getWorkbench().addWindowListener(this); } } }
Example 24
Project: Hydrograph File: ExecutionTrackPreference.java View source code | 5 votes |
@Override public void init(IWorkbench workbench) { IPreferenceStore preferenceStore = Activator.getDefault().getPreferenceStore(); preferenceStore.setDefault(ExecutionPreferenceConstants.EXECUTION_TRACKING, true); preferenceStore.setDefault(ExecutionPreferenceConstants.TRACKING_LOG_PATH, TrackingDisplayUtils.INSTANCE.getInstallationPath()); setPreferenceStore(preferenceStore); }
Example 25
Project: gemoc-studio-modeldebugging File: TracingannotationsModelWizard.java View source code | 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(TracingannotationsEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(TracingannotationsEditorPlugin.INSTANCE.getImage("full/wizban/NewTracingannotations"))); }
Example 26
Project: OCCI-Studio File: NewDiagramWizard.java View source code | 5 votes |
/** * This just records the information. */ @Override public void init(IWorkbench workbench, IStructuredSelection selection) { this.workbench = workbench; this.selection = selection; setWindowTitle(Messages.NewConfigurationWizard_WindowTitle); }
Example 27
Project: gw4e.project File: GeneratorToFileCreationWizard.java View source code | 5 votes |
@Override public void init(IWorkbench workbench, IStructuredSelection selection) { this.workbench = workbench; setWindowTitle((MessageUtil.getString("GraphWalker_Generator_File"))); //$NON-NLS-1$ setDefaultPageImageDescriptor(WIZARD_BANNER); List models = selection.toList(); model = (IFile) models.get(0); ids = (List<String>) models.get(1); }
Example 28
Project: gemoc-studio-modeldebugging File: NewGemocSiriusProjectWizard.java View source code | 5 votes |
/** * {@inheritDoc} * * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, * org.eclipse.jface.viewers.IStructuredSelection) */ public void init(final IWorkbench wkbch, final IStructuredSelection sel) { this.workbench = wkbch; setWindowTitle("New Viewpoint Specification Project"); setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE .getImageDescriptor(SiriusEditorPlugin.INSTANCE .getImage("full/wizban/banner_viewpoint_specification_project.gif"))); }
Example 29
Project: OCCI-Studio File: SlaModelWizard.java View source code | 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(SlaEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(SlaEditorPlugin.INSTANCE.getImage("full/wizban/NewSla"))); }
Example 30
Project: time4sys File: NfpModelWizard.java View source code | 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(NfpEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(NfpEditorPlugin.INSTANCE.getImage("full/wizban/NewNfp"))); }
Example 31
Project: eclipse-batch-editor File: EclipseUtil.java View source code | 5 votes |
/** * Returns active workbench shell - or <code>null</code> * * @return active workbench shell - or <code>null</code> */ public static Shell getActiveWorkbenchShell() { IWorkbench workbench = getWorkbench(); if (workbench == null) { return null; } IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); if (window == null) { return null; } Shell shell = window.getShell(); return shell; }
Example 32
Project: eclipse-batch-editor File: EclipseUtil.java View source code | 5 votes |
public static IWorkbenchWindow getActiveWorkbenchWindow() { IWorkbench workbench = getWorkbench(); if (workbench == null) { return null; } IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow(); if (workbenchWindow != null) { return workbenchWindow; } /* fall back - try to execute in UI */ WorkbenchWindowRunnable wwr = new WorkbenchWindowRunnable(); getSafeDisplay().syncExec(wwr); return wwr.workbenchWindowFromUI; }
Example 33
Project: OCCI-Studio File: OCCIModelWizard.java View source code | 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(OCCIEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(OCCIEditorPlugin.INSTANCE.getImage("full/wizban/NewOCCI"))); }
Example 34
Project: time4sys File: SrmModelWizard.java View source code | 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(SrmEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(SrmEditorPlugin.INSTANCE.getImage("full/wizban/NewSrm"))); }
Example 35
Project: neoscada File: ProtocolModelWizard.java View source code | 5 votes |
/** * This just records the information. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void init ( IWorkbench workbench, IStructuredSelection selection ) { this.workbench = workbench; this.selection = selection; setWindowTitle ( NextGenerationProtocolEditorPlugin.INSTANCE.getString ( "_UI_Wizard_label" ) ); //$NON-NLS-1$ setDefaultPageImageDescriptor ( ExtendedImageRegistry.INSTANCE.getImageDescriptor ( NextGenerationProtocolEditorPlugin.INSTANCE.getImage ( "full/wizban/NewProtocol" ) ) ); //$NON-NLS-1$ }
Example 36
Project: neoscada File: WriteOperationWizard.java View source code | 5 votes |
@Override public void init ( final IWorkbench workbench, final IStructuredSelection selection ) { setNeedsProgressMonitor ( true ); this.selection = selection; }
Example 37
Project: neoscada File: WriteAttributesOperationWizard.java View source code | 5 votes |
@Override public void init ( final IWorkbench workbench, final IStructuredSelection selection ) { setNeedsProgressMonitor ( true ); setWindowTitle ( Messages.getString ( "WriteAttributesOperationWizard.Title" ) ); //$NON-NLS-1$ this.selection = selection; }
Example 38
Project: time4sys File: MappingModelWizard.java View source code | 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(MappingEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(MappingEditorPlugin.INSTANCE.getImage("full/wizban/NewMapping"))); }
Example 39
Project: gemoc-studio File: GexpressionsModelWizard.java View source code | 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(GexpressionsEditorPlugin.INSTANCE.getString("_UI_Wizard_label")); setDefaultPageImageDescriptor(ExtendedImageRegistry.INSTANCE.getImageDescriptor(GexpressionsEditorPlugin.INSTANCE.getImage("full/wizban/NewGexpressions"))); }
Example 40
Project: neoscada File: CreateQueryWizard.java View source code | 5 votes |
public void init ( final IWorkbench workbench, final IStructuredSelection selection ) { final Object o = selection.getFirstElement (); if ( o instanceof QueryListWrapper ) { this.wrapper = (QueryListWrapper)o; } }