@Override public IExtensionTracker getExtensionTracker() { if (model == null || model.getContext() == null) { return null; } return model.getContext().get(IExtensionTracker.class); }
/** * Clean up the action bars. */ public void dispose() { coolBarManager.dispose(); menuManager.dispose(); statusLineManager.dispose(); windowModel.getContext().deactivate(); windowModel.getContext().dispose(); ((Shell) windowModel.getWidget()).dispose(); app.getChildren().remove(windowModel); }
@Override public void setActivePage(final IWorkbenchPage in) { if (getActivePage() != in) { if (in == null) { firePageClosed(); } page = (WorkbenchPage) in; model.getContext().set(IWorkbenchPage.class, page); partService.setPage(page); updateActionSets(); // submitGlobalActions(); } }
public CoolBarToTrimManager(MApplication app, MTrimmedWindow window, List<MTrimElement> workbenchTrimElements, IRendererFactory rf) { application = app; this.window = window; rendererFactory = rf; this.workbenchTrimElements = workbenchTrimElements; toolbarExtensions = new ArrayList<>(); modelService = window.getContext().get(EModelService.class); topTrim = (MTrimBar) modelService.find(MAIN_TOOLBAR_ID, window); if (topTrim == null) { topTrim = modelService.getTrim(window, SideValue.TOP); topTrim.setElementId(MAIN_TOOLBAR_ID); } topTrim.setToBeRendered(false); MToolBar mToolBar = modelService.createModelElement(MToolBar.class); renderer = (ToolBarManagerRenderer) rendererFactory.getRenderer(mToolBar, null); }
private IWorkbenchPage busyOpenPage(String perspectiveId, IAdaptable input) throws WorkbenchException { IPerspectiveDescriptor descriptor = workbench.getPerspectiveRegistry() .findPerspectiveWithId(perspectiveId); if (descriptor == null) { throw new WorkbenchException(NLS.bind( WorkbenchMessages.WorkbenchPage_ErrorCreatingPerspective, perspectiveId)); } if (page == null) { page = new WorkbenchPage(this, input); model.getContext().set(IWorkbenchPage.class.getName(), page); try { ContextInjectionFactory.inject(page, model.getContext()); } catch (InjectionException e) { throw new WorkbenchException(e.getMessage(), e); } firePageOpened(); partService.setPage(page); } else { IWorkbenchWindow window = getWorkbench().openWorkbenchWindow(perspectiveId, input); return window.getActivePage(); } perspective = descriptor; page.setPerspective(perspective); firePageActivated(); return page; }
IEclipseContext windowContext = model.getContext(); serviceLocator.registerService(IWorkbenchLocationService.class, new WorkbenchLocationService(IServiceScopes.WINDOW_SCOPE, getWorkbench(), this, serviceLocator.registerService(IActionCommandMappingService.class, mappingService); selectionService = ContextInjectionFactory.make(SelectionService.class, model.getContext()); serviceLocator.registerService(ISelectionService.class, selectionService); IServiceScopes.WINDOW_SCOPE, this, model.getContext()); serviceLocator.registerService(ICommandService.class, slaveCmdService); serviceLocator.registerService(IUpdateService.class, slaveCmdService); .make(ContextService.class, model.getContext()); serviceLocator.registerService(IContextService.class, cxs);
private void configureShell(Shell shell, IEclipseContext context) { String title = getWindowConfigurer().basicGetTitle(); if (title != null) { shell.setText(TextProcessor.process(title, TEXT_DELIMITERS)); } workbench.getHelpSystem().setHelp(shell, IWorkbenchHelpContextIds.WORKBENCH_WINDOW); IContextService contextService = context.get(IContextService.class); contextService.registerShell(shell, IContextService.TYPE_WINDOW); if (model.getContext().get(E4Workbench.NO_SAVED_MODEL_FOUND) != null) { Point initialSize = getWindowConfigurer().getInitialSize(); Rectangle bounds = shell.getBounds(); // actually set the shell size, so that setting the // menuBar on the shell doesn't override the model changes. bounds.width = initialSize.x; bounds.height = initialSize.y; shell.setBounds(bounds); } }
.createGui(bar, winShell, window.getContext()); window.getContext());
.createGui(bar, winShell, window.getContext()); window.getContext());
LegacyHandlerService windowHs = (LegacyHandlerService) model.getContext().get(IHandlerService.class); windowHs.dispose(); final IHandlerService handlerService = workbench.getService(IHandlerService.class);
customizeActionBars.windowModel.getContext()); customizeActionBars.windowModel.getContext());
runnable.run(new NullProgressMonitor()); } else { EPartService partService = model.getContext().get(EPartService.class); final MPart curActive = partService.getActivePart(); boolean wasCancelEnabled = manager.isCancelEnabled(); boolean enableMainMenu = false; IBindingService bs = model.getContext().get(IBindingService.class); boolean keyFilterEnabled = bs.isKeyFilterEnabled(); List<Control> toEnable = new ArrayList<>();
final IEclipseContext windowContext = model.getContext(); HandlerServiceImpl.push(windowContext.getParent(), null); toolbarOverride = new ToolbarOverrides(page); ContextInjectionFactory.inject(page, model.getContext()); windowContext.set(IWorkbenchPage.class, page); model.setMainMenu(mainMenu); final Menu menu = (Menu) engine.createGui(mainMenu, model.getWidget(), model.getContext()); shell.setMenuBar(menu);