1

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)

greg-449
  • 109,219
  • 232
  • 102
  • 145
Cristiano
  • 23
  • 3

1 Answers1

1

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.

greg-449
  • 109,219
  • 232
  • 102
  • 145
  • Thanks @greg-449 , the method works, but i still can't set the label with path solve.My code is below and i'll appreciate any help. – Cristiano Aug 25 '15 at 19:35
  • Sorry about my mistake, iḿ still learn how to make something here. And the new question is: "PropertyChangeListener validation".Thanks for the tips – Cristiano Aug 25 '15 at 20:51