private void addTrimContribution(String idContrib, ArrayList<MToolBarContribution> contributions, ArrayList<MTrimContribution> trimContributions, IConfigurationElement element, String parentId, String tpath, String tgroup) { final String elementId = MenuHelper.getId(element); MTrimContribution trimContribution = MenuFactoryImpl.eINSTANCE.createTrimContribution(); trimContribution.getTags().add(ContributionsAnalyzer.MC_TOOLBAR); trimContribution.getTags().add("scheme:toolbar"); //$NON-NLS-1$ if (idContrib != null && idContrib.length() > 0) { trimContribution.setElementId(idContrib + "/" + elementId); //$NON-NLS-1$ } else { trimContribution.setElementId(elementId); } trimContribution.setParentId(parentId); trimContribution.setPositionInParent("after=additions"); //$NON-NLS-1$ trimContribution.setVisibleWhen(createVisibleWhen()); MToolBar tb = MenuFactoryImpl.eINSTANCE.createToolBar(); tb.setElementId(tpath); tb.getTransientData().put("Name", MenuHelper.getLabel(this.configElement)); //$NON-NLS-1$ tb.getTransientData().put("ActionSet", id); //$NON-NLS-1$ trimContribution.getChildren().add(tb); trimContributions.add(trimContribution); }
public TrimKey(MTrimContribution mc) { super(mc.getParentId(), mc.getPositionInParent(), mc.getTags(), (MCoreExpression) mc .getVisibleWhen(), null); this.contribution = mc; mc.setWidget(this); }
private void processTrimChildren(ArrayList<MTrimContribution> trimContributions, ArrayList<MToolBarContribution> toolBarContributions, IConfigurationElement element) { IConfigurationElement[] toolbars = element .getChildren(IWorkbenchRegistryConstants.TAG_TOOLBAR); if (toolbars.length == 0) { return; } MTrimContribution trimContribution = MenuFactoryImpl.eINSTANCE.createTrimContribution(); String idContrib = MenuHelper.getId(configElement); if (idContrib != null && idContrib.length() > 0) { trimContribution.setElementId(idContrib); } String query = location.getQuery(); boolean hasAdditions = AFTER_ADDITIONS.equals(query); processTrimLocation(trimContribution); trimContribution.getTags().add("scheme:" + location.getScheme()); //$NON-NLS-1$ for (IConfigurationElement toolbar : toolbars) { MToolBar item = MenuFactoryImpl.eINSTANCE.createToolBar(); item.setElementId(MenuHelper.getId(toolbar)); item.getTransientData().put("Name", MenuHelper.getLabel(toolbar)); //$NON-NLS-1$ processToolbarChildren(toolBarContributions, toolbar, item.getElementId(), AFTER_ADDITIONS, false); trimContribution.getChildren().add(item); } if (hasAdditions) { trimContributions.add(0, trimContribution); } else { trimContributions.add(trimContribution); } }