Package org.eclipse.core.expressions

Examples of org.eclipse.core.expressions.EvaluationContext


    IWorkbench workbench = (IWorkbench) site.getService(IWorkbench.class);
    IWorkbenchWindow window = (IWorkbenchWindow) site
        .getService(IWorkbenchWindow.class);
    IHandlerService serv = (IHandlerService) workbench
        .getService(IHandlerService.class);
    appContext = new EvaluationContext(serv.getCurrentState(),
        Collections.EMPTY_LIST);

    // set up the appContext as we would want it.
    appContext.addVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME,
        StructuredSelection.EMPTY);
View Full Code Here


  }
 
  private IEvaluationContext fillInContext(boolean fullContext) {
    IEvaluationContext tmpContext = getCurrentState();

    EvaluationContext context = null;
    if (fullContext) {
      context = new EvaluationContext(null, tmpContext.getDefaultVariable());
      copyVariable(context, tmpContext, ISources.ACTIVE_CURRENT_SELECTION_NAME);
      copyVariable(context, tmpContext, ISources.ACTIVE_FOCUS_CONTROL_ID_NAME);
      copyVariable(context, tmpContext, ISources.ACTIVE_FOCUS_CONTROL_NAME);
      copyVariable(context, tmpContext, ISources.ACTIVE_MENU_EDITOR_INPUT_NAME);
      copyVariable(context, tmpContext, ISources.ACTIVE_MENU_NAME);
      copyVariable(context, tmpContext, ISources.ACTIVE_MENU_SELECTION_NAME);
    } else {
      context = new EvaluationContext(null, Collections.EMPTY_LIST);
    }

    copyVariable(context, tmpContext, ISources.ACTIVE_ACTION_SETS_NAME);
    copyVariable(context, tmpContext, ISources.ACTIVE_CONTEXT_NAME);
    copyVariable(context, tmpContext, ISources.ACTIVE_EDITOR_ID_NAME);
View Full Code Here

    if (variable == null) {
      throw new CoreException(new ExpressionStatus(
        ExpressionStatus.VARIABLE_NOT_DEFINED,
        Messages.format(ExpressionMessages.WithExpression_variable_not_defined, fVariable)));
    }
    return evaluateAnd(new EvaluationContext(context, variable));
  }
View Full Code Here

    if (variable == null) {
      throw new CoreException(new ExpressionStatus(
        ExpressionStatus.VARIABLE_NOT_DEFINED,
        Messages.format(ExpressionMessages.ResolveExpression_variable_not_defined, fVariable)));
    }
    return evaluateAnd(new EvaluationContext(context, variable));
  }
View Full Code Here

      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

          return result;
        }
            }
            if (enablement != null) {
                try {
                    IEvaluationContext context = new EvaluationContext(null,
                            object);
                    context.setAllowPluginActivation(true);
                    context.addVariable("selection", object); //$NON-NLS-1$
                    EvaluationResult evalResult = enablement.evaluate(context);
                    if (evalResult == EvaluationResult.FALSE) {
            return false;
          }
                } catch (CoreException e) {
View Full Code Here

  private boolean failsEnablement(Object object) {
    if (enablementExpression == null)
      return false;
    try {
      return enablementExpression.evaluate(
          new EvaluationContext(null, object)).equals(
          EvaluationResult.FALSE);
    } catch (CoreException e) {
      WorkbenchPlugin.log(e);
      return false;
    }
View Full Code Here

  /**
   * Constructs a new instance of <code>ExpressionAuthority</code>.
   */
  protected ExpressionAuthority() {
    context = new EvaluationContext(null, this);
    context.setAllowPluginActivation(true);
  }
View Full Code Here

      final Object defaultVariable = context
          .getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
      final IEvaluationContext contextWithDefaultVariable;
      if (defaultVariable instanceof IStructuredSelection) {
        final IStructuredSelection selection = (IStructuredSelection) defaultVariable;
        contextWithDefaultVariable = new EvaluationContext(context,
            selection.toList());
      } else if ((defaultVariable instanceof ISelection)
          && (!((ISelection) defaultVariable).isEmpty())) {
        contextWithDefaultVariable = new EvaluationContext(context,
            Collections.singleton(defaultVariable));
      } else {
        contextWithDefaultVariable = new EvaluationContext(context,
            Collections.EMPTY_LIST);
      }
      currentState = contextWithDefaultVariable;
    }
View Full Code Here

      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

Related Classes of org.eclipse.core.expressions.EvaluationContext

Copyright © 2018 www.massapicom. 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.