Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.core.expressions
Class EvaluationContext

    java.lang.Object
      org.eclipse.core.expressions.EvaluationContext

All Implemented Interfaces:
  IEvaluationContext

public class EvaluationContext
extends Object
implements IEvaluationContext

A default implementation of an evaluation context.

Clients may instantiate this default context. The class is not intended to be subclassed by clients.

Since:
  3.0

Constructor Summary
`EvaluationContext(IEvaluationContext parent, Object defaultVariable)` Create a new evaluation context with the given parent and default variable.
`EvaluationContext(IEvaluationContext parent, Object defaultVariable, IVariableResolver[] resolvers)` Create a new evaluation context with the given parent and default variable.

Method Summary
`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.
`Object` | `getDefaultVariable()` Returns the default variable.
`IEvaluationContext` | `getParent()` Returns the parent context or `null` if this is the root of the evaluation context hierarchy.
`IEvaluationContext` | `getRoot()` Returns the root evaluation context.
`Object` | `getVariable(String name)` Returns the variable managed under the given name.
`Object` | `removeVariable(String name)` Removes the variable managed under the given name from this evaluation context.
`Object` | `resolveVariable(String name, Object[] args)` 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 the `resolve` expression.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### EvaluationContext

    public EvaluationContext(IEvaluationContext parent,
                             Object defaultVariable)

  Create a new evaluation context with the given parent and default variable.

Parameters:
  `parent` - the parent context. Can be `null`.
  `defaultVariable` - the default variable

### EvaluationContext

    public EvaluationContext(IEvaluationContext parent,
                             Object defaultVariable,
                             IVariableResolver[] resolvers)

  Create a new evaluation context with the given parent and default variable.

Parameters:
  `parent` - the parent context. Can be `null`.
  `defaultVariable` - the default variable
  `resolvers` - an array of `IVariableResolvers` to resolve additional variables.
See Also:
  `resolveVariable(String, Object[])`

Method Detail

### getParent

    public IEvaluationContext getParent()

  Returns the parent context or `null` if this is the root of the evaluation context hierarchy.

  Specified by:
    `getParent` in interface `IEvaluationContext`
  Returns:
    the parent evaluation context or `null`

### getRoot

    public IEvaluationContext getRoot()

  Returns the root evaluation context.

  Specified by:
    `getRoot` in interface `IEvaluationContext`
  Returns:
    the root evaluation context

### getDefaultVariable

    public Object getDefaultVariable()

  Returns the default variable.

  Specified by:
    `getDefaultVariable` in interface `IEvaluationContext`
  Returns:
    the default variable or `null` if no default variable is managed.

### addVariable

    public 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.

  Specified by:
    `addVariable` in interface `IEvaluationContext`
  Parameters:
    `name` - the variable's name
    `value` - the variable's value

### removeVariable

    public Object removeVariable(String name)

  Removes the variable managed under the given name from this evaluation context.

  Specified by:
    `removeVariable` in interface `IEvaluationContext`
  Parameters:
    `name` - the variable's name
  Returns:
    the currently stored value or `null` if the variable doesn't exist

### getVariable

    public Object getVariable(String name)

  Returns the variable managed under the given name.

  Specified by:
    `getVariable` in interface `IEvaluationContext`
  Parameters:
    `name` - the variable's name
  Returns:
    the variable's value or `null` if the content doesn't manage a variable with the given name

### resolveVariable

    public 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 the `resolve` expression.

  Specified by:
    `resolveVariable` in interface `IEvaluationContext`
  Parameters:
    `name` - the variable to resolve
    `args` - an object array of arguments used to resolve the variable
  Returns:
    the variable's value or `null` if no variable can be resolved for the given name and arguments
  Throws:
    `CoreException` - if an errors occurs while resolving the variable

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.