Package org.eclipse.core.expressions
Interface IEvaluationContext
-
- All Known Implementing Classes:
EvaluationContext
public interface IEvaluationContextAn evaluation context is used to manage a set of objects needed during XML expression evaluation. A context has a parent context, can manage a set of named variables and has a default variable. The default variable is used during XML expression evaluation if no explicit variable is referenced.This interface is not intended to be implemented by clients. Clients are allowed to instantiate
EvaluationContext.- Since:
- 3.0
- Restriction:
- This interface is not intended to be implemented by clients.
- Restriction:
- This interface is not intended to be extended by clients.
-
-
Field Summary
Fields Modifier and Type Field Description static ObjectUNDEFINED_VARIABLERepresents the value used by variables that exist but are not defined in a evaluation context.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddVariable(String name, Object value)Adds a new named variable to this context.booleangetAllowPluginActivation()Returns whether this evaluation context supports plug-in activation.ObjectgetDefaultVariable()Returns the default variable.IEvaluationContextgetParent()Returns the parent context ornullif this is the root of the evaluation context hierarchy.IEvaluationContextgetRoot()Returns the root evaluation context.ObjectgetVariable(String name)Returns the variable managed under the given name.ObjectremoveVariable(String name)Removes the variable managed under the given name from this evaluation context.ObjectresolveVariable(String name, Object[] args)Resolves a variable for the given name and arguments.voidsetAllowPluginActivation(boolean value)Specifies whether this evaluation context allows activation of plug-ins for testers used in the expression tree.
-
-
-
Field Detail
-
UNDEFINED_VARIABLE
static final Object UNDEFINED_VARIABLE
Represents the value used by variables that exist but are not defined in a evaluation context. When tested by the 'with' expression,falsewill be returned.- Since:
- 3.4
-
-
Method Detail
-
getParent
IEvaluationContext getParent()
Returns the parent context ornullif this is the root of the evaluation context hierarchy.- Returns:
- the parent evaluation context or
null
-
getRoot
IEvaluationContext getRoot()
Returns the root evaluation context.- Returns:
- the root evaluation context
-
setAllowPluginActivation
void setAllowPluginActivation(boolean value)
Specifies whether this evaluation context allows activation of plug-ins for testers used in the expression tree. To actual trigger the plug-in loading this flag has to be set totrueand the actual test expression must have the attributeforcePluginActivationset totrueas well.- Parameters:
value- whether this evaluation context allows plug-in activation- Since:
- 3.2
-
getAllowPluginActivation
boolean getAllowPluginActivation()
Returns whether this evaluation context supports plug-in activation. If not set viasetAllowPluginActivation(boolean)the parent value is returned. If no parent is setfalseis returned.- Returns:
- whether plug-in activation is supported or not
- Since:
- 3.2
-
getDefaultVariable
Object getDefaultVariable()
Returns the default variable.- Returns:
- the default variable or
nullif no default variable is managed.
-
addVariable
void addVariable(String name, Object value)
Adds a new named variable to this context. If a variable with the name already exists the new one overrides the existing one.- Parameters:
name- the variable's namevalue- the variable's value
-
removeVariable
Object removeVariable(String name)
Removes the variable managed under the given name from this evaluation context.- Parameters:
name- the variable's name- Returns:
- the currently stored value or
nullif the variable doesn't exist
-
getVariable
Object getVariable(String name)
Returns the variable managed under the given name.- Parameters:
name- the variable's name- Returns:
- the variable's value or
nullif the content doesn't manage a variable with the given name
-
resolveVariable
Object resolveVariable(String name, Object[] args) throws CoreException
Resolves a variable for the given name and arguments. This method can be used to dynamically resolve variable such as plug-in descriptors, resources, etc. The method is used by theresolveexpression.- Parameters:
name- the variable to resolveargs- an object array of arguments used to resolve the variable- Returns:
- the variable's value or
nullif no variable can be resolved for the given name and arguments - Throws:
CoreException- if an errors occurs while resolving the variable
-
-