@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(); }
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() ; }
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; }
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); }
@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 (); } } } ); }
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); } }
static private final IWorkbenchPage unsafeGetWorkbenchPage() { IWorkbenchPage page = null; if (PlatformUI.isWorkbenchRunning()) { IWorkbench wb = PlatformUI.getWorkbench(); IWorkbenchWindow win = wb.getActiveWorkbenchWindow(); page = win.getActivePage(); } return page; }
/***/ @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; }
@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); } }
@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); }
@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); }
/** * 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); } } } }
@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; } } }
/** * 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"))); }
private void initN4Context() { if (isWorkbenchRunning()) { final IWorkbench workbench = getWorkbench(); workbench.getDisplay().asyncExec(() -> { final IContextService service = workbench.getService(IContextService.class); service.activateContext(N4_CONTEXT_ID); }); } }
@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(); } }); }
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 ); } }
/** * Returns the current workbench, if active. * @return the workbench */ public IWorkbench getWorkbench() { if (this.isWorkbenchRunning()==true) { return PlatformUI.getWorkbench(); } return null; }
/** * 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; }
@Override public void init(IWorkbench workbench, IStructuredSelection selection) { if(selection.isEmpty()){ // do nothing }else{ selectClassPage.init(selection); } }
/** * 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"))); }
/** * 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; }
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); } } }
@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); }
/** * 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"))); }
/** * This just records the information. */ @Override public void init(IWorkbench workbench, IStructuredSelection selection) { this.workbench = workbench; this.selection = selection; setWindowTitle(Messages.NewConfigurationWizard_WindowTitle); }
@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); }
/** * {@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"))); }
/** * 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"))); }
/** * 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"))); }
/** * 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; }
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; }
/** * 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"))); }
/** * 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"))); }
/** * 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$ }
@Override public void init ( final IWorkbench workbench, final IStructuredSelection selection ) { setNeedsProgressMonitor ( true ); this.selection = selection; }
@Override public void init ( final IWorkbench workbench, final IStructuredSelection selection ) { setNeedsProgressMonitor ( true ); setWindowTitle ( Messages.getString ( "WriteAttributesOperationWizard.Title" ) ); //$NON-NLS-1$ this.selection = selection; }
/** * 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"))); }
/** * 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"))); }
public void init ( final IWorkbench workbench, final IStructuredSelection selection ) { final Object o = selection.getFirstElement (); if ( o instanceof QueryListWrapper ) { this.wrapper = (QueryListWrapper)o; } }