how to use the variables from eclipse

269 views Asked by At

I'm developing an Eclipse plugin (Eclipse preferencePage), and I need to know how to use the variables from eclipse (workspace_loc ,project_loc,.... ), because my path on the preference page will be set with them. (that's my first question, let me know if you no understand)

1

There are 1 answers

2
greg-449 On BEST ANSWER

Use the IStringVariableManager interface to access the manager for these variables:

IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();

You will need to add the org.eclipse.core.variables plugin to your plugin's dependencies.

The interface has various methods for accessing expressions containing variables, one of the main ones is:

public String performStringSubstitution(String expression, boolean reportUndefinedVariables) throws CoreException;

You can pass this a string containing things like ${workspace_loc} and it returns the resolved result.