Examples of IContextActivation


Examples of org.eclipse.ui.contexts.IContextActivation

    }

    // Build the list of submissions.
    final List activations = new ArrayList();
    Expression expression;
    IContextActivation dialogWindowActivation;
    switch (type) {
    case IContextService.TYPE_DIALOG:
      expression = new ActiveShellExpression(shell);
      dialogWindowActivation = new ContextActivation(
          IContextService.CONTEXT_ID_DIALOG_AND_WINDOW, expression,
          contextService);
      activateContext(dialogWindowActivation);
      activations.add(dialogWindowActivation);
      final IContextActivation dialogActivation = new ContextActivation(
          IContextService.CONTEXT_ID_DIALOG, expression,
          contextService);
      activateContext(dialogActivation);
      activations.add(dialogActivation);
      break;
    case IContextService.TYPE_NONE:
      break;
    case IContextService.TYPE_WINDOW:
      expression = new ActiveShellExpression(shell);
      dialogWindowActivation = new ContextActivation(
          IContextService.CONTEXT_ID_DIALOG_AND_WINDOW, expression,
          contextService);
      activateContext(dialogWindowActivation);
      activations.add(dialogWindowActivation);
      final IContextActivation windowActivation = new ContextActivation(
          IContextService.CONTEXT_ID_WINDOW, expression,
          contextService);
      activateContext(windowActivation);
      activations.add(windowActivation);
      break;
    default:
      throw new IllegalArgumentException("The type is not recognized: " //$NON-NLS-1$
          + type);
    }

    // Check to see if the activations are already present.
    boolean returnValue = false;
    final Collection previousActivations = (Collection) registeredWindows
        .get(shell);
    if (previousActivations != null) {
      returnValue = true;
      final Iterator previousActivationItr = previousActivations
          .iterator();
      while (previousActivationItr.hasNext()) {
        final IContextActivation activation = (IContextActivation) previousActivationItr
            .next();
        deactivateContext(activation);
      }
    }
View Full Code Here

Examples of org.eclipse.ui.contexts.IContextActivation

     */
    final Collection changedContextIds = new ArrayList(
        activationsToRecompute.size());
    final Iterator activationItr = activationsToRecompute.iterator();
    while (activationItr.hasNext()) {
      final IContextActivation activation = (IContextActivation) activationItr
          .next();
      final boolean currentActive = evaluate(activation);
      activation.clearResult();
      final boolean newActive = evaluate(activation);
      if (newActive != currentActive) {
        changedContextIds.add(activation.getContextId());
      }
    }

    try {
      contextManager.addActiveContext(DEFER_EVENTS);
      /*
       * For every context identifier with a changed activation, we
       * resolve conflicts and trigger an update.
       */
      final Iterator changedContextIdItr = changedContextIds.iterator();
      while (changedContextIdItr.hasNext()) {
        final String contextId = (String) changedContextIdItr.next();
        final Object value = contextActivationsByContextId
            .get(contextId);
        if (value instanceof IContextActivation) {
          final IContextActivation activation = (IContextActivation) value;
          updateContext(contextId, evaluate(activation));
        } else if (value instanceof Collection) {
          updateContext(contextId, containsActive((Collection) value));
        } else {
          updateContext(contextId, false);
View Full Code Here

Examples of org.eclipse.ui.contexts.IContextActivation

      registeredWindows.remove(shell);

      final Iterator previousActivationItr = previousActivations
          .iterator();
      while (previousActivationItr.hasNext()) {
        final IContextActivation activation = (IContextActivation) previousActivationItr
            .next();
        deactivateContext(activation);
      }
      return true;
    }
View Full Code Here

Examples of org.eclipse.ui.contexts.IContextActivation

    }
    if (enabledSubmission.getActiveWorkbenchPartSite() != null) {
      sourcePriorities |= ISources.ACTIVE_SITE;
    }

    final IContextActivation activation = contextService.activateContext(
        enabledSubmission.getContextId(),
        new LegacyHandlerSubmissionExpression(enabledSubmission
            .getActivePartId(), enabledSubmission.getActiveShell(),
            enabledSubmission.getActiveWorkbenchPartSite()));
    if (activationsBySubmission == null) {
View Full Code Here

Examples of org.eclipse.ui.contexts.IContextActivation

      return;
    }

    final Object value = activationsBySubmission.remove(enabledSubmission);
    if (value instanceof IContextActivation) {
      final IContextActivation activation = (IContextActivation) value;
      contextService.deactivateContext(activation);
    }
  }
View Full Code Here

Examples of org.eclipse.ui.contexts.IContextActivation

            String id = desc.getId();
            if (propId == PROP_VISIBLE) {
              activationsById.put(id, contextService
                  .activateContext(id));
            } else if (propId == PROP_HIDDEN) {
              IContextActivation act = (IContextActivation) activationsById
                  .remove(id);
              if (act != null) {
                contextService.deactivateContext(act);
              }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.