Examples of IHandlerActivation


Examples of org.eclipse.ui.handlers.IHandlerActivation

      final ParameterizedCommand command, final Event event) {
    return parent.createExecutionEvent(command, event);
  }

  public final void deactivateHandler(final IHandlerActivation activation) {
    final IHandlerActivation parentActivation;
    if (localActivationsToParentActivations.containsKey(activation)) {
      parentActivation = (IHandlerActivation) localActivationsToParentActivations
          .remove(activation);
    } else {
      parentActivation = activation;
View Full Code Here

Examples of org.eclipse.ui.handlers.IHandlerActivation

    }
  }

  protected IHandlerActivation doActivation(
      final IHandlerActivation localActivation) {
    final IHandlerActivation parentActivation;
    parentActivation = parent.activateHandler(localActivation);
    parentActivations.add(parentActivation);
    localActivationsToParentActivations.put(localActivation,
        parentActivation);
    return localActivation;
View Full Code Here

Examples of org.eclipse.ui.handlers.IHandlerActivation

    final IHandlerService service = (IHandlerService) window
        .getService(IHandlerService.class);
    service.deactivateHandlers(handlerActivations);
    final Iterator activationItr = handlerActivations.iterator();
    while (activationItr.hasNext()) {
      final IHandlerActivation activation = (IHandlerActivation) activationItr
          .next();
      final IHandler handler = activation.getHandler();
      if (handler != null) {
        handler.dispose();
      }
    }
    handlerActivations.clear();
View Full Code Here

Examples of org.eclipse.ui.handlers.IHandlerActivation

    // Activate the handler.
    final String commandId = command.getId();
    final IHandlerService service = (IHandlerService) window
        .getService(IHandlerService.class);
    final IHandlerActivation handlerActivation;
    if (activeWhenExpression == null) {
      handlerActivation = service.activateHandler(commandId, handler);
    } else {
      handlerActivation = service.activateHandler(commandId, handler,
          activeWhenExpression);
View Full Code Here

Examples of org.eclipse.ui.handlers.IHandlerActivation

      final IHandlerActivation childActivation) {
    final String commandId = childActivation.getCommandId();
    final IHandler handler = childActivation.getHandler();
    final Expression expression = childActivation.getExpression();
    final int depth = childActivation.getDepth() + 1;
    final IHandlerActivation localActivation = new HandlerActivation(
        commandId, handler, expression, depth, this);
    handlerAuthority.activateHandler(localActivation);
    return localActivation;
  }
View Full Code Here

Examples of org.eclipse.ui.handlers.IHandlerActivation

  }

  public final IHandlerActivation activateHandler(final String commandId,
      final IHandler handler, final Expression expression,
      final boolean global) {
    final IHandlerActivation activation = new HandlerActivation(commandId,
        handler, expression, IHandlerActivation.ROOT_DEPTH, this);
    handlerAuthority.activateHandler(activation);
    return activation;
  }
View Full Code Here

Examples of org.eclipse.ui.handlers.IHandlerActivation

  }

  public final void deactivateHandlers(final Collection activations) {
    final Iterator activationItr = activations.iterator();
    while (activationItr.hasNext()) {
      final IHandlerActivation activation = (IHandlerActivation) activationItr
          .next();
      deactivateHandler(activation);
    }
  }
View Full Code Here

Examples of org.eclipse.ui.handlers.IHandlerActivation

            .getService(IHandlerService.class);
        final Map activationsByActionId = (Map) value.getValue();
        final Iterator iterator = activationsByActionId.values()
            .iterator();
        while (iterator.hasNext()) {
          final IHandlerActivation activation = (IHandlerActivation) iterator
              .next();
          service.deactivateHandler(activation);
          activation.getHandler().dispose();
        }
      }
      activationsByActionIdByServiceLocator.clear();
    }
  }
View Full Code Here

Examples of org.eclipse.ui.handlers.IHandlerActivation

                serviceLocator, activationsByActionId);
          } else if (activationsByActionId.containsKey(actionID)) {
            final Object value = activationsByActionId
                .remove(actionID);
            if (value instanceof IHandlerActivation) {
              final IHandlerActivation activation = (IHandlerActivation) value;
              actionIdByCommandId.remove(activation.getCommandId());
              service.deactivateHandler(activation);
              activation.getHandler().dispose();
            }
          } else if (commandId != null
              && actionIdByCommandId.containsKey(commandId)) {
            final Object value = activationsByActionId
                .remove(actionIdByCommandId.remove(commandId));
            if (value instanceof IHandlerActivation) {
              final IHandlerActivation activation = (IHandlerActivation) value;
              service.deactivateHandler(activation);
              activation.getHandler().dispose();
            }
          }
        }

        if (commandId != null) {
          actionIdByCommandId.put(commandId, actionID);
          // Register this as a handler with the given definition id.
          // the expression gives the setGlobalActionHandler() a
          // priority.
          final IHandler actionHandler = new ActionHandler(handler);
          Expression handlerExpression = EXPRESSION;
          //XXX add new API in next release to avoid down-casting (bug 137091)
          if (this instanceof EditorActionBars) {
            handlerExpression = ((EditorActionBars)this).getHandlerExpression();
          }
          final IHandlerActivation activation = service
              .activateHandler(commandId, actionHandler,
                  handlerExpression);
          activationsByActionId.put(actionID, activation);
        }
      }

    } else {
      if (actionHandlers != null) {
        actionHandlers.remove(actionID);
      }

      // Remove the handler activation.
      if (serviceLocator != null) {
        final IHandlerService service = (IHandlerService) serviceLocator
            .getService(IHandlerService.class);
        if (activationsByActionIdByServiceLocator != null) {
          final Map activationsByActionId = (Map) activationsByActionIdByServiceLocator
              .get(serviceLocator);
          if ((activationsByActionId != null)
              && (activationsByActionId.containsKey(actionID))) {
            final Object value = activationsByActionId
                .remove(actionID);
            if (value instanceof IHandlerActivation) {
              final IHandlerActivation activation = (IHandlerActivation) value;
              actionIdByCommandId.remove(activation.getCommandId());
              service.deactivateHandler(activation);
              activation.getHandler().dispose();
            }
          }
        }
      }
    }
View Full Code Here

Examples of org.eclipse.ui.handlers.IHandlerActivation

      sourcePriorities |= ISources.LEGACY_LOW;
    } else if (handlerSubmission.getPriority() == Priority.MEDIUM) {
      sourcePriorities |= ISources.LEGACY_MEDIUM;
    }

    final IHandlerActivation activation = handlerService.activateHandler(
        handlerSubmission.getCommandId(), new LegacyHandlerWrapper(
            handlerSubmission.getHandler()),
        new LegacyHandlerSubmissionExpression(handlerSubmission
            .getActivePartId(), handlerSubmission.getActiveShell(),
            handlerSubmission.getActiveWorkbenchPartSite()));
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.