# Package org.eclipse.core.variables

Provides support for defining and contributing variables for the purpose of string substitution.

## Package Specification

This package provides classes and interfaces to support the definition and contribution of variables for the purpose of string substitution. The plug-in supports the recursive replacement of variables referenced by name in arbitrary strings with the value of the variable. Two types of variables are provided - value variables (`IValueVariable`) and dynamic variables (`IDynamicVariable`). A value variable has a simple setter and getter for its current value. A dynamic variable has an associated resolver that provides a variable's value each time it is referenced (replaced) in a string substitution. A dynamic variable may also provide an argument in its reference that can be used by its resolver to determine its substitution value.

A variable manager (`IStringVariableManager`) is provided to manage the set of defined variables. Value variables may be created via API on the variable manager, or contributed via the `valueVariables` extension point. Dynamic variables must be contributed via the `dynamicVariables` extension point. The variable manager also provides change notification for value variables. The variable manager also provides an API for performing string substitution, which accepts a string, and returns a string with all variable references replaced by associated variable values.

Variables are referenced in strings by enclosing them in braces, preceded with a dollar sign. For example, consider a variable defined with the name `foo`, and referenced in the following string: `"abc${foo}ghi"`. If the value of `foo` is `"def"`, the result of a string substitution would be `"abcdefghi"`. In the case of a dynamic variable, an (optional) argument is supplied by appending a colon and argument value after the variable name. For example `"${foo:bar}"`. In this case, the resolver associated with `foo` would be provided with the referenced argument (`bar`) when asked to resolve a value for the variable `foo`.

Interface Summary
IDynamicVariable: A dynamic variable is a variable whose value is computed dynamically by a resolver at the time a string substitution is performed.
IDynamicVariableResolver: Resolves the value for a dynamic variable.
IStringVariable: A variable that can be referenced in an expression, which resolves to a string value.
IStringVariableManager: Registry for string variables.
IValueVariable: A variable with a value that can be set and retrieved.
IValueVariableInitializer: Value variable initializers compute an initial value for a value variable contributed by an extension, which is not defined with an initial value.
IValueVariableListener: A string variable listener is notified of variables as they are added and removed from the string variable manager.

Class Summary
VariablesPlugin: The plug-in runtime class for the Core Variables plug-in.