Examples of IEvaluationContext


Examples of org.eclipse.core.expressions.IEvaluationContext

      return false;
    }
  }

  private IEvaluationContext createContext(Object selection) {
    IEvaluationContext context = new EvaluationContext(null, selection);
    context.addVariable("selection", selection); //$NON-NLS-1$
    return context;
  }
View Full Code Here

Examples of org.eclipse.core.expressions.IEvaluationContext

    {
      getLogFacility().logWarning(
          "Current application context is not an IEvaluationContext.");
      return null;
    }
    IEvaluationContext appContext = (IEvaluationContext) applicationContext;
    ISelection selection = (ISelection) appContext
        .getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
    if (selection == null)
    {
      getLogFacility().logWarning(
          "Current selection is null, no action is taken.");
View Full Code Here

Examples of org.eclipse.core.expressions.IEvaluationContext

    {
      getLogFacility().logWarning(
          "Current application context is not an IEvaluationContext.");
      return null;
    }
    IEvaluationContext appContext = (IEvaluationContext) applicationContext;
    ISelection selection = (ISelection) appContext
        .getVariable(ISources.ACTIVE_MENU_SELECTION_NAME);
    if (selection == null && !this.alwaysUseFileOpenedInEditor())
    {
      getLogFacility().logWarning(
          "Current selection is null, no action is taken.");
View Full Code Here

Examples of org.eclipse.core.expressions.IEvaluationContext

  }

  @Override
  public void setEnabled(Object evaluationContext) {
    if (evaluationContext instanceof IEvaluationContext) {
      IEvaluationContext ctx = (IEvaluationContext) evaluationContext;
      Repository repo = SelectionUtils.getRepository(ctx);
      if (repo != null) {
        boolean enabled = isEnabledForState(repo,
            repo.getRepositoryState());
        setBaseEnabled(enabled);
View Full Code Here

Examples of org.eclipse.core.expressions.IEvaluationContext

        workbench, null, itemAction, STYLE_PUSH);

    IWorkbenchWindow activeWorkbenchWindow = workbench
        .getActiveWorkbenchWindow();
    IHandlerService hsr = CommonUtils.getService(activeWorkbenchWindow, IHandlerService.class);
    IEvaluationContext ctx = hsr.getCurrentState();
    ctx.addVariable(ACTIVE_MENU_SELECTION_NAME, getContext().getSelection());

    return new CommandContributionItem(itemParam);
  }
View Full Code Here

Examples of org.eclipse.core.expressions.IEvaluationContext

    IHandlerService handlerService = CommonUtils.getService(serviceLocator, IHandlerService.class);
    if (handlerService == null)
      return null;

    IEvaluationContext evaluationContext = handlerService.getCurrentState();
    return SelectionUtils.getRepository(evaluationContext);
  }
View Full Code Here

Examples of org.eclipse.core.expressions.IEvaluationContext

    return StructuredSelection.EMPTY;
  }

  private static IEvaluationContext getEvaluationContext() {
    IEvaluationContext ctx;
    IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench()
        .getActiveWorkbenchWindow();
    // no active window during Eclipse shutdown
    if (activeWorkbenchWindow == null)
      return null;
View Full Code Here

Examples of org.eclipse.core.expressions.IEvaluationContext

   * @param selectionListener
   */
  public static void notifySelectionChangedWithCurrentSelection(
      ISelectionListener selectionListener, IServiceLocator serviceLocator) {
    IHandlerService handlerService = CommonUtils.getService(serviceLocator, IHandlerService.class);
    IEvaluationContext state = handlerService.getCurrentState();
    // This seems to be the most reliable way to get the active part, it
    // also returns a part when it is called while creating a view that is
    // being shown.Getting the active part through the active workbench
    // window returned null in that case.
    Object partObject = state.getVariable(ISources.ACTIVE_PART_NAME);
    Object selectionObject = state
        .getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
    if (partObject instanceof IWorkbenchPart
        && selectionObject instanceof ISelection) {
      IWorkbenchPart part = (IWorkbenchPart) partObject;
      ISelection selection = (ISelection) selectionObject;
View Full Code Here

Examples of org.eclipse.core.expressions.IEvaluationContext

    Object result;     
    String rawSerialization = command.getSerialization();
    try {
      String substitutedSerialization = csm.performVariableSubstitution(rawSerialization);
      selectedCommand = commandService.deserialize(substitutedSerialization);
      IEvaluationContext state = handlerService.getCurrentState();
      result = selectedCommand.executeWithChecks(null, state);
     
      String returnsAttribute = command.getReturns();
      if ((returnsAttribute != null) && (result != null)) {
        ParameterType returnType = selectedCommand.getCommand().getReturnType();
View Full Code Here

Examples of org.eclipse.core.expressions.IEvaluationContext

      return false;
    }
  }

  private IEvaluationContext createContext(Object selection) {
    IEvaluationContext context = new EvaluationContext(null, selection);
    context.addVariable("selection", selection); //$NON-NLS-1$
    return context;
  }
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.