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); }
@Override public void changeApplicationLocale(Locale locale) { // the TranslationService.LOCALE context parameter is specified as String // so we put the String representation of the given Locale to the context this.application.getContext().set(TranslationService.LOCALE, locale); // update model updateLocalization(this.application.getChildren()); // fire event broker.post(LOCALE_CHANGE, locale); }
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 dispose() { ControlContributionRegistry.clear(); application.getMenuContributions().removeAll(menuContributions); application.getToolBarContributions().removeAll(toolBarContributions); application.getTrimContributions().removeAll(trimContributions); menuContributions.clear(); cacheEntries.clear(); super.dispose(); } @Override
window.setWidth(size.x); window.setHeight(size.y); application.getChildren().add(window); application.setSelectedElement(window); if (application.getSelectedElement() == window) { application.getContext().set(ISources.ACTIVE_WORKBENCH_WINDOW_NAME, result); application.getContext().set(ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME, result.getShell());
private boolean detectWorkbenchCorruption(MApplication application) { if (application.getChildren().isEmpty()) { WorkbenchPlugin.log( "When auto-saving the workbench model, there were no top-level windows. " //$NON-NLS-1$ + " Skipped saving the model.", //$NON-NLS-1$ new Exception()); // log a stack trace to assist debugging return true; } return false; }
private boolean shouldActivate(@NonNull MPartStack stackToActivate) { if (inContentProcessing(stackToActivate)) { return false; } if (this.application != null) { IEclipseContext applicationContext = this.application.getContext(); IEclipseContext activeChild = applicationContext.getActiveChild(); if (activeChild == null || activeChild.get(MWindow.class) != this.application.getSelectedElement() || this.application.getSelectedElement() != this.modelService.getTopLevelWindowFor(stackToActivate)) { return false; } } return true; }
List<MCommand> commands = application.getCommands(); Set<MCommand> toBeRemoved = new HashSet<>(); for (MCommand command : commands) { return; List<MHandler> handlers = application.getHandlers(); Iterator<MHandler> i = handlers.iterator(); int removed = 0; List<MBindingContext> bindingContexts = application.getBindingContexts(); MBindingContext dialogAndWindow = null; for (MBindingContext c : bindingContexts) { List<MBindingTable> bindingTables = application.getBindingTables(); MBindingTable dAWTable = null; for (MBindingTable table : bindingTables) {
for (MPartDescriptor desc : application.getDescriptors()) { for (MPart part : modelService.findElements(application, desc.getElementId(), MPart.class, null)) { if (part.getLabel() == null) { for (MUIElement snippet : application.getSnippets()) { if (snippet instanceof MPerspective) { setPerspectiveIcon(perspectiveRegistry, (MPerspective) snippet); for (MWindow window : application.getChildren()) { moveStickyViews(stickyViews, window);
void createApplication() { List<MWindow> windows = application.getChildren(); for (WindowReader windowReader : reader.getWindowReaders()) { WindowBuilder windowBuilder = builderFactory.createWindowBuilder(windowReader); MWindow window = windowBuilder.createWindow(); windows.add(window); if (windowBuilder.isSelected()) { application.setSelectedElement(window); } Object list = window.getTransientData().remove(WindowBuilder.PERSPECTIVES); if (list instanceof List<?>) { List<MPerspective> perspectiveList = (List<MPerspective>) list; for (MPerspective perspective : perspectiveList) { importToolbarsLocation(perspective); } } } addClosedPerspectives(); addMRU(); }
commandById.setElementId(commandId); commandById.setCommandName(commandId); application.getCommands().add(commandById); ICommandImageService commandImageService = application.getContext().get( ICommandImageService.class); ImageDescriptor descriptor = commandImageService == null ? null : commandImageService
if (app.getChildren().isEmpty()) { Object oldValue = event.getProperty(UIEvents.EventTags.OLD_VALUE); WorkbenchPlugin.log("The final top level window " + oldValue //$NON-NLS-1$ List<MPartDescriptor> currentDescriptors = application.getDescriptors(); for (MPartDescriptor desc : currentDescriptors) { descriptor.setContributionURI(CompatibilityPart.COMPATIBILITY_EDITOR_URI); descriptor.setCategory("org.eclipse.e4.primaryDataStack"); //$NON-NLS-1$ application.getDescriptors().add(descriptor);
@Execute void process(final MApplication application, IEclipseContext context) { gatherContexts(application.getRootContext()); gatherCommands(application.getCommands()); gatherTables(application.getBindingTables()); application.getTags().add( EBindingService.ACTIVE_SCHEME_TAG + ':' + bindingManager.getActiveScheme().getId());
@Override public MPartDescriptor getPartDescriptor(String id) { MApplication application = appContext.get(MApplication.class); // If the id contains a ':' use the part before it as the descriptor id int colonIndex = id == null ? -1 : id.indexOf(':'); String descId = colonIndex == -1 ? id : id.substring(0, colonIndex); for (MPartDescriptor descriptor : application.getDescriptors()) { if (descriptor.getElementId().equals(descId)) { return descriptor; } } return null; }
@Override public Void call(Boolean param) { if (param.booleanValue()) { MUIElement parentME = element.getParent(); if (parentME instanceof MApplication) { MApplication app = (MApplication) parentME; app.setSelectedElement(element); element.getContext().activate(); } else if (parentME == null) { parentME = (MUIElement) ((EObject) element).eContainer(); if (parentME instanceof MContext) { element.getContext().activate(); } } } return null; } });
@Override public void removeContributionFactory(AbstractContributionFactory factory) { Object contribution; if ((contribution = factoriesToContributions.remove(factory)) != null) { MApplication app = e4Context.get(MApplication.class); if (app == null) return; if (contribution instanceof MMenuContribution) { app.getMenuContributions().remove(contribution); } else if (contribution instanceof MToolBarContribution) { app.getToolBarContributions().remove(contribution); } } }
private void defineBindingTables() { for (MBindingTable bindingTable : this.application.getBindingTables()) { defineBindingTable(bindingTable); } }
/** * @param element */ public void processContribution(MToolBar toolbarModel, String elementId) { final ArrayList<MToolBarContribution> toContribute = new ArrayList<MToolBarContribution>(); ContributionsAnalyzer.XXXgatherToolBarContributions(toolbarModel, application.getToolBarContributions(), elementId, toContribute); generateContributions(toolbarModel, toContribute); }