|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface IPathVariableManager
Manages a collection of path variables and resolves paths containing a variable reference.
A path variable is a pair of non-null elements (name,value) where name is
a case-sensitive string (containing only letters, digits and the underscore
character, and not starting with a digit), and value is an absolute
IPath
object.
Path variables allow for the creation of relative paths whose exact location in the file system depends on the value of a variable. A variable reference may only appear as the first segment of a relative path.
IPath
Method Summary | |
---|---|
void |
addChangeListener(IPathVariableChangeListener listener)
Registers the given listener to receive notification of changes to path variables. |
java.lang.String[] |
getPathVariableNames()
Returns an array containing all defined path variable names. |
org.eclipse.core.runtime.IPath |
getValue(java.lang.String name)
Returns the value of the path variable with the given name. |
boolean |
isDefined(java.lang.String name)
Returns true if the given variable is defined and
false otherwise. |
void |
removeChangeListener(IPathVariableChangeListener listener)
Removes the given path variable change listener from the listeners list. |
org.eclipse.core.runtime.IPath |
resolvePath(org.eclipse.core.runtime.IPath path)
Resolves a relative IPath object potentially containing a
variable reference as its first segment, replacing the variable reference
(if any) with the variable's value (which is a concrete absolute path). |
java.net.URI |
resolveURI(java.net.URI uri)
Resolves a relative URI object potentially containing a
variable reference as its first segment, replacing the variable reference
(if any) with the variable's value (which is a concrete absolute URI). |
void |
setValue(java.lang.String name,
org.eclipse.core.runtime.IPath value)
Sets the path variable with the given name to be the specified value. |
org.eclipse.core.runtime.IStatus |
validateName(java.lang.String name)
Validates the given name as the name for a path variable. |
org.eclipse.core.runtime.IStatus |
validateValue(org.eclipse.core.runtime.IPath path)
Validates the given path as the value for a path variable. |
Method Detail |
---|
void setValue(java.lang.String name, org.eclipse.core.runtime.IPath value) throws org.eclipse.core.runtime.CoreException
null
.
null
.null
.
null
, or if it is
defined but the given value is equal to its current value.
If a variable is effectively changed, created or removed by a call to this method, notification will be sent to all registered listeners.
name
- the name of the variablevalue
- the value for the variable (may be null
)
org.eclipse.core.runtime.CoreException
- if this method fails. Reasons include:
org.eclipse.core.runtime.IPath getValue(java.lang.String name)
null
.
name
- the name of the variable to return the value for
null
if there is no
variable defined with the given namejava.lang.String[] getPathVariableNames()
void addChangeListener(IPathVariableChangeListener listener)
listener
- the listenerIPathVariableChangeListener
void removeChangeListener(IPathVariableChangeListener listener)
listener
- the listenerIPathVariableChangeListener
java.net.URI resolveURI(java.net.URI uri)
URI
object potentially containing a
variable reference as its first segment, replacing the variable reference
(if any) with the variable's value (which is a concrete absolute URI).
If the given URI is absolute or has a non- null
device then
no variable substitution is done and that URI is returned as is. If the
given URI is relative and has a null
device, but the first
segment does not correspond to a defined variable, then the URI is
returned as is.
If the given URI is null
then null
will be
returned. In all other cases the result will be non-null
.
uri
- the URI to be resolved
null
org.eclipse.core.runtime.IPath resolvePath(org.eclipse.core.runtime.IPath path)
IPath
object potentially containing a
variable reference as its first segment, replacing the variable reference
(if any) with the variable's value (which is a concrete absolute path).
If the given path is absolute or has a non- null
device then
no variable substitution is done and that path is returned as is. If the
given path is relative and has a null
device, but the first
segment does not correspond to a defined variable, then the path is
returned as is.
If the given path is null
then null
will be
returned. In all other cases the result will be non-null
.
For example, consider the following collection of path variables:
The following paths would be resolved as:
c:/bin => c:/bin
c:TEMP => c:TEMP
/TEMP => /TEMP
TEMP => c:/temp
TEMP/foo => c:/temp/foo
BACKUP => /tmp/backup
BACKUP/bar.txt => /tmp/backup/bar.txt
SOMEPATH/foo => SOMEPATH/foo
path
- the path to be resolved
null
boolean isDefined(java.lang.String name)
true
if the given variable is defined and
false
otherwise. Returns false
if the given
name is not a valid path variable name.
name
- the variable's name
true
if the variable exists, false
otherwiseorg.eclipse.core.runtime.IStatus validateName(java.lang.String name)
name
- a possibly valid path variable name
IStatus.OK
if
the given name is a valid path variable name, otherwise a status
object indicating what is wrong with the stringIStatus.OK
org.eclipse.core.runtime.IStatus validateValue(org.eclipse.core.runtime.IPath path)
path
- a possibly valid path variable value
IStatus.OK
if the given
path is a valid path variable value, otherwise a status object indicating
what is wrong with the valueIPath.isValidPath(String)
,
IStatus.OK
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |