/** * Adds an action set. * @param desc */ private void addActionSet(ActionSetDescriptor desc) { children.add(desc); Context actionSetContext = contextService.getContext(desc.getId()); if (!actionSetContext.isDefined()) { actionSetContext.define(desc.getLabel(), desc.getDescription(), "org.eclipse.ui.contexts.actionSet"); //$NON-NLS-1$ } }
context.define(name, description, parentId);
@Override public void addToModel(ArrayList<MMenuContribution> menuContributions, ArrayList<MToolBarContribution> toolBarContributions, ArrayList<MTrimContribution> trimContributions) { String idContrib = MenuHelper.getId(configElement); visibleWhen = createExpression(configElement); EContextService contextService = application.getContext().get(EContextService.class); Context actionSetContext = contextService.getContext(idContrib); if (!actionSetContext.isDefined()) { actionSetContext.define(MenuHelper.getLabel(configElement), MenuHelper.getDescription(configElement), "org.eclipse.ui.contexts.actionSet"); //$NON-NLS-1$ } String parentId = parent.getAttribute(IWorkbenchRegistryConstants.ATT_TARGET_ID); addContribution(idContrib, menuContributions, configElement, isMenu, parentId); if (!isMenu) { addToolBarContribution(idContrib, toolBarContributions, trimContributions, configElement, parentId); } }
private void defineContexts(MBindingContext parent, MBindingContext current) { if (current.getName() == null || current.getElementId() == null) { logger.error("Binding context name or id is null for: " + current); //$NON-NLS-1$ return; } Context context = contextManager.getContext(current.getElementId()); if (!context.isDefined()) { String localizedName = LocalizationHelper.getLocalized(current.getName(), current, application.getContext()); String localizedDescriptor = LocalizationHelper.getLocalized(current.getDescription(), current, application.getContext()); context.define(localizedName, localizedDescriptor, parent == null ? null : parent.getElementId()); } for (MBindingContext child : current.getChildren()) { defineContexts(current, child); } }
Context actionSetContext = contextService.getContext(idContrib); if (!actionSetContext.isDefined()) { actionSetContext.define(MenuHelper.getLabel(configElement), MenuHelper.getDescription(configElement), "org.eclipse.ui.contexts.actionSet"); //$NON-NLS-1$
context.define(context.getId(), null, null);