Package org.eclipse.core.expressions

Examples of org.eclipse.core.expressions.Expression


    final StringBuffer buffer = new StringBuffer();
    buffer.append("AndExpression("); //$NON-NLS-1$
    if (fExpressions != null) {
      final Iterator itr = fExpressions.iterator();
      while (itr.hasNext()) {
        final Expression expression = (Expression) itr.next();
        buffer.append(expression.toString());
        if (itr.hasNext()) {
          buffer.append(',');
        }
      }
    }
View Full Code Here


    if (fExpressions == null) {
      return EvaluationResult.TRUE;
    }
    EvaluationResult result = EvaluationResult.TRUE;
    for (Iterator iter = fExpressions.iterator(); iter.hasNext();) {
      Expression expression = (Expression) iter.next();
      result = result.and(expression.evaluate(scope));
      // keep iterating even if we have a not loaded found. It can be
      // that we find a false which will result in a better result.
      if (result == EvaluationResult.FALSE) {
        return result;
      }
View Full Code Here

    if (fExpressions == null) {
      return EvaluationResult.TRUE;
    }
    EvaluationResult result = EvaluationResult.FALSE;
    for (Iterator iter = fExpressions.iterator(); iter.hasNext();) {
      Expression expression = (Expression) iter.next();
      result = result.or(expression.evaluate(scope));
      if (result == EvaluationResult.TRUE) {
        return result;
      }
    }
    return result;
View Full Code Here

  public void collectExpressionInfo(ExpressionInfo info) {
    if (fExpressions == null) {
      return;
    }
    for (Iterator iter = fExpressions.iterator(); iter.hasNext();) {
      Expression expression = (Expression) iter.next();
      expression.collectExpressionInfo(info);
    }
  }
View Full Code Here

  /** Cache for expressions maps launch shortcut ids to Expression objects. */
  private Map expressions = new HashMap();

  public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
    String delegateShortcutID = (String) args[0];
    Expression expr = (Expression) expressions.get(delegateShortcutID);
    if (expr == null) {
      expr = createEnablementExpression(delegateShortcutID);
      expressions.put(delegateShortcutID, expr);
    }
    try {
      return expr.evaluate(createContext(receiver)) != EvaluationResult.FALSE;
    } catch (CoreException ce) {
      EclEmmaUIPlugin.log(ce);
      return false;
    }
  }
View Full Code Here

          .get(sourceNames[i]);
      if (cachesByExpression == null) {
        cachesByExpression = new HashMap(1);
        cachesBySourceName.put(sourceNames[i], cachesByExpression);
      }
      final Expression expression = ref.getExpression();
      Set caches = (Set) cachesByExpression.get(expression);
      if (caches == null) {
        caches = new HashSet();
        cachesByExpression.put(expression, caches);
      }
View Full Code Here

   */
  private void initializeDefaultServices() {
    serviceLocator.registerService(IWorkbenchPartSite.class, this);
    final IHandlerService parentService = (IHandlerService) serviceLocator
        .getService(IHandlerService.class);
    final Expression defaultExpression = new ActivePartExpression(part);
    final IHandlerService slave = new SlaveHandlerService(parentService,
        defaultExpression);
    serviceLocator.registerService(IHandlerService.class, slave);

    final IContextService parentContextService = (IContextService) serviceLocator
View Full Code Here

   *
   * @see org.eclipse.ui.internal.AbstractEvaluationHandler#getEnabledWhenExpression()
   */
  protected Expression getEnabledWhenExpression() {
    if (enabledWhen == null) {
      enabledWhen = new Expression() {
        public EvaluationResult evaluate(IEvaluationContext context)
            throws CoreException {
          IWorkbenchWindow window = InternalHandlerUtil
              .getActiveWorkbenchWindow(context);
          if (window != null) {
View Full Code Here

      final String whenElementName, final String id,
      final List warningsToLog) {
    // Check to see if we have an when expression.
    final IConfigurationElement[] whenElements = parentElement
        .getChildren(whenElementName);
    Expression whenExpression = null;
    if (whenElements.length > 0) {
      // Check if we have too many when elements.
      if (whenElements.length > 1) {
        // There should only be one when element
        addWarning(warningsToLog,
View Full Code Here

      }
    }

    final Shell shell = getShell();
    if (shell != null) {
      final Expression expression = new ActiveShellExpression(shell);
      for (Iterator iterator = handlersByCommandId.entrySet().iterator(); iterator
          .hasNext();) {
        Map.Entry entry = (Map.Entry) iterator.next();
        String commandId = (String) entry.getKey();
        IHandler handler = (IHandler) entry.getValue();
View Full Code Here

TOP

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

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.