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)

4

1 回答 1

1

使用IStringVariableManager接口访问这些变量的管理器:

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

您需要将org.eclipse.core.variables插件添加到插件的依赖项中。

该接口具有各种访问包含变量的表达式的方法,主要方法之一是:

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

您可以传递一个包含类似内容的字符串${workspace_loc},它会返回解析的结果。

于 2015-08-11T20:51:16.693 回答