Provides support for defining and contributing variables for the purpose of string substitution.
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 (
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
point. Dynamic variables must be contributed via the
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
and referenced in the following string:
If the value of
"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
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
Interface Summary Interface Description IDynamicVariableA dynamic variable is a variable whose value is computed dynamically by a resolver at the time a string substitution is performed. IDynamicVariableResolverResolves the value for a dynamic variable. IStringVariableA variable that can be referenced in an expression, which resolves to a string value. IStringVariableManagerRegistry for string variables. IValueVariableA variable with a value that can be set and retrieved. IValueVariableInitializerValue variable initializers compute an initial value for a value variable contributed by an extension, which is not defined with an initial value. IValueVariableListenerA string variable listener is notified of variables as they are added and removed from the string variable manager.
Class Summary Class Description VariablesPluginThe plug-in runtime class for the Core Variables plug-in.