/** * @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); }
@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); } } }
@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
@Override protected void read() { super.read(); readAdditions(); ArrayList<MMenuContribution> tmp = new ArrayList<>(menuContributions); menuContributions.clear(); ContributionsAnalyzer.mergeContributions(tmp, menuContributions); application.getMenuContributions().addAll(menuContributions); ArrayList<MToolBarContribution> tmpToolbar = new ArrayList<>( toolBarContributions); toolBarContributions.clear(); ContributionsAnalyzer.mergeToolBarContributions(tmpToolbar, toolBarContributions); application.getToolBarContributions().addAll(toolBarContributions); ArrayList<MTrimContribution> tmpTrim = new ArrayList<>(trimContributions); trimContributions.clear(); ContributionsAnalyzer.mergeTrimContributions(tmpTrim, trimContributions); application.getTrimContributions().addAll(trimContributions); }
private void processToolbarChildren(AbstractContributionFactory factory, MenuLocationURI location, String parentId, String position) { MToolBarContribution toolBarContribution = MenuFactoryImpl.eINSTANCE .createToolBarContribution(); toolBarContribution.setElementId(factory.getNamespace() + ":" + factory.hashCode()); //$NON-NLS-1$ toolBarContribution.setParentId(parentId); toolBarContribution.setPositionInParent(position); toolBarContribution.getTags().add("scheme:" + location.getScheme()); //$NON-NLS-1$ ContextFunction generator = new ContributionFactoryGenerator(factory, 1); toolBarContribution.getTransientData().put(ToolBarContributionRecord.FACTORY, generator); factoriesToContributions.put(factory, toolBarContribution); MApplication app = e4Context.get(MApplication.class); app.getToolBarContributions().add(toolBarContribution); }
@Override public void processContents(MElementContainer<MUIElement> container) { // We've delegated further rendering to the ContributionManager // it's their fault the menu items don't show up! IEclipseContext ctx = getContext(container); ExpressionContext eContext = new ExpressionContext(ctx); ArrayList<MToolBarContribution> toContribute = new ArrayList<MToolBarContribution>(); MElementContainer<?> toolbarObj = container; MToolBar toolbarModel = (MToolBar) toolbarObj; ContributionsAnalyzer.gatherToolBarContributions(toolbarModel, application.getToolBarContributions(), toolbarModel.getElementId(), toContribute, eContext); ToolBarRenderer.addToolBarContributions(toolbarModel, toContribute, ctx, eContext, pendingCleanup); }
/** * @param toolbarModel * @param elementId */ public void processContribution(MToolBar toolbarModel, String elementId) { ToolBarManager manager = getManager(toolbarModel); if (manager != null && manager.getControl() != null) { addCleanupDisposeListener(toolbarModel, manager.getControl()); } final ArrayList<MToolBarContribution> toContribute = new ArrayList<>(); ContributionsAnalyzer.XXXgatherToolBarContributions(toolbarModel, application.getToolBarContributions(), elementId, toContribute); generateContributions(toolbarModel, toContribute); }
@Override public void processContents(MElementContainer<MUIElement> container) { super.processContents(container); IEclipseContext ctx = getContext(container); ExpressionContext eContext = new ExpressionContext(ctx); ArrayList<MToolBarContribution> toContribute = new ArrayList<MToolBarContribution>(); MElementContainer<?> toolbarObj = container; MToolBar toolbarModel = (MToolBar) toolbarObj; ContributionsAnalyzer.gatherToolBarContributions(toolbarModel, application.getToolBarContributions(), toolbarModel.getElementId(), toContribute, eContext); addToolBarContributions(toolbarModel, toContribute, ctx, eContext, pendingCleanup); }
appCopy.getToolBarContributions().clear(); appCopy.getTrimContributions().clear();