protected EvaluationResult evaluateOr(IEvaluationContext scope) throws CoreException { if (fExpressions == null) return EvaluationResult.TRUE; EvaluationResult result= EvaluationResult.FALSE; for (Expression expression : fExpressions) { result= result.or(expression.evaluate(scope)); if (result == EvaluationResult.TRUE) return result; } return result; }
/** * Constructs a new instance of <code>ExpressionAuthority</code>. */ protected ExpressionAuthority() { context = new EvaluationContext(null, this); context.setAllowPluginActivation(true); context.addVariable("org.eclipse.core.runtime.Platform", Platform.class); //$NON-NLS-1$ // this is not as useful as it appears // context.addVariable("java.lang.System", System.class); //$NON-NLS-1$ }
@Override public IEvaluationContext getCurrentState() { return new EvaluationContext(evalContext, evalContext.getDefaultVariable()); }
protected EvaluationResult evaluateAnd(IEvaluationContext scope) throws CoreException { if (fExpressions == null) return EvaluationResult.TRUE; EvaluationResult result= EvaluationResult.TRUE; for (Expression expression : fExpressions) { 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; } return result; }
/** * Merges this reevaluation information with the given info. * * @param other the information to merge with */ public void merge(ExpressionInfo other) { mergeDefaultVariableAccess(other); mergeSystemPropertyAccess(other); mergeAccessedVariableNames(other); mergeAccessedPropertyNames(other); mergeMisbehavingExpressionTypes(other); }
@Override public Object getVariable(String name) { return fParent.getVariable(name); } @Override
@Override public void setAllowPluginActivation(boolean value) { fParent.setAllowPluginActivation(value); } @Override
@Override public void collectExpressionInfo(ExpressionInfo info) { info .addVariableNameAccess(ISources.ACTIVE_WORKBENCH_WINDOW_NAME); } };
/** * {@inheritDoc} */ @Override public Object removeVariable(String name) { return fManagedPool.removeVariable(name); }
@Override public Object resolveVariable(String name, Object[] args) throws CoreException { return fManagedPool.resolveVariable(name, args); } }
@Override public boolean getAllowPluginActivation() { return fParent.getAllowPluginActivation(); } @Override
/** * {@inheritDoc} */ public IEvaluationContext getRoot() { return fParent.getRoot(); }
/** * Returns the variable of the given name. * * @param name * The name of the variable to get; must not be <code>null</code>. * @return The variable of the given name; <code>null</code> if none. */ protected final Object getVariable(final String name) { return context.getVariable(name); }
/** * {@inheritDoc} */ @Override public void setAllowPluginActivation(boolean value) { fParent.setAllowPluginActivation(value); }
@Override public Object resolveVariable(String name, Object[] args) throws CoreException { return fParent.resolveVariable(name, args); } public Object next() {
@Override public boolean getAllowPluginActivation() { return fParent.getAllowPluginActivation(); } @Override
/** * {@inheritDoc} */ public void setAllowPluginActivation(boolean value) { fParent.setAllowPluginActivation(value); }