@Override public boolean isDefined() { return wrappedContext.isDefined(); }
/** * Remove the action set. * * @param desc */ private void removeActionSet(IActionSetDescriptor desc) { Context actionSetContext = contextService.getContext(desc.getId()); if (actionSetContext.isDefined()) { actionSetContext.undefine(); } children.remove(desc); }
/** * 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$ } }
@Override public final void contextChanged(final ContextEvent contextEvent) { if (contextEvent.isDefinedChanged()) { final Context context = contextEvent.getContext(); final String contextId = context.getId(); final boolean contextIdAdded = context.isDefined(); if (contextIdAdded) { definedHandleObjects.add(context); } else { definedHandleObjects.remove(context); } if (isListenerAttached()) { fireContextManagerChanged(new ContextManagerEvent(this, contextId, contextIdAdded, false, null)); } } }
@Override public final void contextChanged(final ContextEvent contextEvent) { if (contextEvent.isDefinedChanged()) { final Context context = contextEvent.getContext(); final String contextId = context.getId(); final boolean contextIdAdded = context.isDefined(); if (contextIdAdded) { definedHandleObjects.add(context); } else { definedHandleObjects.remove(context); } if (isListenerAttached()) { fireContextManagerChanged(new ContextManagerEvent(this, contextId, contextIdAdded, false, null)); } } }
@Override public final void contextChanged(final ContextEvent contextEvent) { if (contextEvent.isDefinedChanged()) { final Context context = contextEvent.getContext(); final String contextId = context.getId(); final boolean contextIdAdded = context.isDefined(); if (contextIdAdded) { definedHandleObjects.add(context); } else { definedHandleObjects.remove(context); } if (isListenerAttached()) { fireContextManagerChanged(new ContextManagerEvent(this, contextId, contextIdAdded, false, null)); } } }
if (!context.isDefined()) { context.define(name, description, parentId);
/** * Updates the label next to the context that says "extends" if the context * is a child of another context. If the context is not a child of another * context, then the label is simply blank. */ private void updateLabelContextExtends() { final String contextId = getContextId(); if (contextId != null) { final Context context = contextService.getContext(getContextId()); if (context.isDefined()) { try { final String parentId = context.getParentId(); if (parentId != null) { final String name = (String) contextUniqueNamesById .get(parentId); if (name != null) { labelContextExtends.setText(MessageFormat.format( Util.translateString(RESOURCE_BUNDLE, "extends"), //$NON-NLS-1$ name)); return; } } } catch (final NotDefinedException e) { // Do nothing } } } labelContextExtends.setText(Util.ZERO_LENGTH_STRING); }
@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); } }
.getParameterizedCommand(); final Command command = parameterizedCommand.getCommand(); if ((!context.isDefined()) && (!command.isDefined())) { continue;
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); } }
if (!actionSetContext.isDefined()) { actionSetContext.define(MenuHelper.getLabel(configElement), MenuHelper.getDescription(configElement), "org.eclipse.ui.contexts.actionSet"); //$NON-NLS-1$
if (!context.isDefined()) { context.define(context.getId(), null, null);