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 void dispose() { ControlContributionRegistry.clear(); application.getMenuContributions().removeAll(menuContributions); application.getToolBarContributions().removeAll(toolBarContributions); application.getTrimContributions().removeAll(trimContributions); menuContributions.clear(); cacheEntries.clear(); super.dispose(); } @Override
private static String getToolbarLabel(MApplication application, String elementId) { String name; if (IWorkbenchActionConstants.TOOLBAR_FILE.equalsIgnoreCase(elementId)) { return WorkbenchMessages.WorkbenchWindow_FileToolbar; } if (IWorkbenchActionConstants.TOOLBAR_EDIT.equalsIgnoreCase(elementId)) { return WorkbenchMessages.WorkbenchWindow_EditToolbar; } if (IWorkbenchActionConstants.TOOLBAR_NAVIGATE.equalsIgnoreCase(elementId)) { return WorkbenchMessages.WorkbenchWindow_NavigateToolbar; } if (IWorkbenchActionConstants.TOOLBAR_HELP.equalsIgnoreCase(elementId)) { return WorkbenchMessages.WorkbenchWindow_HelpToolbar; } List<MTrimContribution> trimContributions = application.getTrimContributions(); for (MTrimContribution mtb : trimContributions) { for (MTrimElement e : mtb.getChildren()) { if (e.getElementId().equals(elementId)) { name = getTransientName(e); if (name != null) { return name; } } } } return null; }
@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); }
@Override public void processContents(MElementContainer<MUIElement> me) { if (!(((MUIElement) me) instanceof MTrimBar)) return; super.processContents(me); IEclipseContext ctx = getContext(me); ExpressionContext eContext = new ExpressionContext(ctx); MElementContainer<?> trimObj = me; MTrimBar trimModel = (MTrimBar) trimObj; ArrayList<MTrimContribution> toContribute = new ArrayList<>(); ContributionsAnalyzer.gatherTrimContributions(trimModel, application.getTrimContributions(), trimModel.getElementId(), toContribute, eContext); addTrimContributions(trimModel, toContribute, ctx, eContext); }
@Override public void processContents(MElementContainer<MUIElement> me) { if (!(((MUIElement) me) instanceof MTrimBar)) return; super.processContents(me); IEclipseContext ctx = getContext(me); ExpressionContext eContext = new ExpressionContext(ctx); MElementContainer<?> trimObj = me; MTrimBar trimModel = (MTrimBar) trimObj; ArrayList<MTrimContribution> toContribute = new ArrayList<MTrimContribution>(); ContributionsAnalyzer.gatherTrimContributions(trimModel, application.getTrimContributions(), trimModel.getElementId(), toContribute, eContext); addTrimContributions(trimModel, toContribute, ctx, eContext); }
appCopy.getTrimContributions().clear();