Package org.eclipse.core.expressions

Examples of org.eclipse.core.expressions.Expression


  protected EvaluationResult evaluateOr(IEvaluationContext scope) throws CoreException {
    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

   * @param id The unique ID of the expression definition
   * @return the expression
   * @throws CoreException If the expression cannot be found.
   */
  public Expression getExpression(String id) throws CoreException {
    Expression cachedExpression= (Expression)getCache().get(id);
    if (cachedExpression != null) {
      return cachedExpression;
    }

    IExtensionRegistry registry= Platform.getExtensionRegistry();
    IConfigurationElement[] ces= registry.getConfigurationElementsFor("org.eclipse.core.expressions", "definitions"); //$NON-NLS-1$ //$NON-NLS-2$

    Expression foundExpression= null;
    for (int i= 0; i < ces.length; i++) {
      String cid= ces[i].getAttribute("id"); //$NON-NLS-1$
      if (cid != null && cid.equals(id)) {
        try {
          foundExpression= getExpression(id, ces[i]);
View Full Code Here

    return foundExpression;
  }

  private Expression getExpression(String id, IConfigurationElement element) throws InvalidRegistryObjectException,
    CoreException {
    Expression expr= ExpressionConverter.getDefault().perform(element.getChildren()[0]);
    if (expr != null) {
      getCache().put(id, expr);
    }
    return expr;
  }
View Full Code Here

    fDefinitionId= element.getAttribute(ATT_DEFINITION_ID);
    Expressions.checkAttribute(ATT_DEFINITION_ID, fDefinitionId.length() > 0 ? fDefinitionId : null);
  }

  public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
    Expression expr= getDefinitionRegistry().getExpression(fDefinitionId);
    return expr.evaluate(context);
  }
View Full Code Here

    Expression expr= getDefinitionRegistry().getExpression(fDefinitionId);
    return expr.evaluate(context);
  }

  public void collectExpressionInfo(ExpressionInfo info) {
    Expression expr;
    try {
      expr= getDefinitionRegistry().getExpression(fDefinitionId);
    } catch (CoreException e) {
      // We didn't find the expression definition. So no
      // expression info can be collected.
      return;
    }
    expr.collectExpressionInfo(info);
  }
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 {
          IEditorPart part = InternalHandlerUtil
              .getActiveEditor(context);
          if (part != null) {
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

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

            @Override
            public void createContributionItems( IServiceLocator serviceLocator,
            IContributionRoot additions ) {
                for( OpAction action : getActions() ){
                    IContributionItem item = new ActionContributionItem(action);               
                    Expression visibleWhen = Expression.TRUE;
                   
                    additions.addContributionItem(item, visibleWhen);
                }
            }           
        });
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.