public static MCommand getCommandById(MApplication app, String cmdId) { return app.getCommand(cmdId); }
private Map<String, String> getMinMaxPersistedState() { if (minMaxPersistedState != null) { return minMaxPersistedState; } for (MAddon addon : application.getAddons()) { if ("MinMax Addon".equals(addon.getElementId())) { //$NON-NLS-1$ minMaxPersistedState = addon.getPersistedState(); break; } } return minMaxPersistedState; }
private MWindow getWindow() { if (workbenchWindow != null) return workbenchWindow; if (application.getSelectedElement() != null) return application.getSelectedElement(); List<MWindow> windows = application.getChildren(); if (windows.size() != 0) return windows.get(0); return null; }
public void restoreDefaultModel() { application.getTags().clear(); application.getPersistedState().clear(); application.getSnippets().clear(); application.getDescriptors().clear(); application.getChildren().clear(); application.getChildren().addAll(defaultWindows); }
@Override public void stop() { if (this.app != null) { this.app.getContext().set("__efx_engine_shutdown", Boolean.TRUE); //$NON-NLS-1$ for (MWindow w : this.app.getChildren()) { ElementRenderer<MUIElement, Object> r = getRenderer(w); if (r != null) { removeGui(w); } } } }
private static boolean isFirstE4WorkbenchRun(MApplication app) { return app.getContext().containsKey(E4Workbench.NO_SAVED_MODEL_FOUND); }
private boolean checkContribution(IEclipseContext lclContext) { if (!(model instanceof MContribution)) { return false; } MContribution contrib = (MContribution) model; if (contrib.getObject() == null) { contrib.setObject(contribFactory.create( contrib.getContributionURI(), lclContext)); } return contrib.getObject() != null; }
protected MCommand findCommand(String commandId) { for (MCommand cmd : application.getCommands()) { if (commandId.equals(cmd.getElementId())) { return cmd; } } return null; }
@Override public Color getForeground(Object element) { if (element instanceof MApplicationElement) { String elementId = ((MApplicationElement) element).getElementId(); MPerspective activePerspective = modelService.getActivePerspective(window); if(partService.isPartOrPlaceholderInPerspective(elementId, activePerspective)){ return dimmedForeground; } } return null; } }
private static void setSearchContribution(MApplication app, boolean enabled) { for (MTrimContribution contribution : app.getTrimContributions()) { if ("org.eclipse.ui.ide.application.trimcontribution.QuickAccess".contains(contribution //$NON-NLS-1$ .getElementId())) { // allows us to handle the case where someone opens a workspace // with Luna and then with Kepler contribution.setToBeRendered(enabled); } } }
@Override public Object compute(IEclipseContext context) { MApplicationElement mApplicationElement = context.get(MApplicationElement.class); if (mApplicationElement == null) { return null; } else { return new MementoImpl(mApplicationElement.getPersistedState()); } }
private void executeItem(Event trigger) { final IEclipseContext lclContext = getContext(model); if (!checkContribution(lclContext)) { return; } MContribution contrib = (MContribution) model; IEclipseContext staticContext = getStaticContext(trigger); ContextInjectionFactory.invoke(contrib.getObject(), Execute.class, getExecutionContext(lclContext), staticContext, null); }
protected MCategory findCategory(String id) { final List<MCategory> categories = application.getCategories(); for (MCategory cat : categories) { if (id.equals(cat.getElementId())) { return cat; } } return null; }
private void defineBindingTables() { for (MBindingTable bindingTable : this.application.getBindingTables()) { defineBindingTable(bindingTable); } }
private void createCategories() { for (MCategory catModel : application.getCategories()) { createCategory(catModel); } }
private void createCommands() { for (MCommand cmdModel : application.getCommands()) { createCommand(cmdModel); } }
public MenuFactoryGenerator(MApplication application, IEclipseContext appContext, IConfigurationElement configElement, String attribute) { this.application = application; // this.appContext = appContext; assert appContext.equals(this.application.getContext()); this.configElement = configElement; this.location = new MenuLocationURI(attribute); }
private Map<String, String> getMinMaxPersistedState() { if (minMaxPersistedState != null) { return minMaxPersistedState; } for (MAddon addon : application.getAddons()) { if ("MinMax Addon".equals(addon.getElementId())) { //$NON-NLS-1$ minMaxPersistedState = addon.getPersistedState(); break; } } return minMaxPersistedState; } }
private void init(MApplication appElement) { Activator.trace(Policy.DEBUG_WORKBENCH, "init() workbench", null); //$NON-NLS-1$ IEclipseContext context = appElement.getContext(); if (context != null) { context.set(ExpressionContext.ALLOW_ACTIVATION, Boolean.TRUE); } }
@Override public Object compute(IEclipseContext context, String contextKey) { ILocaleChangeService lcService = ContextInjectionFactory.make( LocaleChangeServiceImpl.class, context); // add the new object to the application context MApplication application = context.get(MApplication.class); IEclipseContext ctx = application.getContext(); ctx.set(ILocaleChangeService.class, lcService); return lcService; } }