public MenuKey(MMenuContribution mc) { super( mc.getParentId(), mc.getPositionInParent(), mc.getTags(), (MCoreExpression) mc.getVisibleWhen(), mc.getTransientData().get(FACTORY)); this.contribution = mc; mc.setWidget(this); }
public void mergeIntoModel( ArrayList<MMenuContribution> menuContributions, ArrayList<MToolBarContribution> toolBarContributions, ArrayList<MTrimContribution> trimContributions) { if (location.getPath() == null || location.getPath().length() == 0) { WorkbenchPlugin.log( "MenuFactoryGenerator.mergeIntoModel: Invalid menu URI: " + location); // $NON-NLS-1$ return; } if (inToolbar()) { if (MenuAdditionCacheEntry.isInWorkbenchTrim(location)) { // processTrimChildren(trimContributions, toolBarContributions, // configElement); } else { String query = location.getQuery(); if (query == null || query.length() == 0) { query = "after=additions"; // $NON-NLS-1$ } processToolbarChildren(toolBarContributions, configElement, location.getPath(), query); } return; } MMenuContribution menuContribution = MenuFactoryImpl.eINSTANCE.createMenuContribution(); String idContrib = MenuHelper.getId(configElement); if (idContrib != null && idContrib.length() > 0) { menuContribution.setElementId(idContrib); } if ("org.eclipse.ui.popup.any".equals(location.getPath())) { // $NON-NLS-1$ menuContribution.setParentId("popup"); // $NON-NLS-1$ } else { menuContribution.setParentId(location.getPath()); } String query = location.getQuery(); if (query == null || query.length() == 0) { query = "after=additions"; // $NON-NLS-1$ } menuContribution.setPositionInParent(query); menuContribution.getTags().add("scheme:" + location.getScheme()); // $NON-NLS-1$ String filter = ContributionsAnalyzer.MC_MENU; if ("popup".equals(location.getScheme())) { // $NON-NLS-1$ filter = ContributionsAnalyzer.MC_POPUP; } menuContribution.getTags().add(filter); menuContribution.setVisibleWhen(MenuHelper.getVisibleWhen(configElement)); ContextFunction generator = new ContributionFactoryGenerator(configElement, 0); menuContribution.getTransientData().put(ContributionRecord.FACTORY, generator); menuContributions.add(menuContribution); }