Skip navigation links
Eclipse Platform
Neon (4.6)

Package org.eclipse.core.variables

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

See: Description

Package org.eclipse.core.variables Description

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.

Skip navigation links
Eclipse Platform
Neon (4.6)


Copyright (c) 2000, 2016 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.