[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-dev] Retrieving Variables from the Project PathVariableManager
|
Hi,
I have been able to store path variables in the project path variable
manager but I have not been able to figure out how to retrieve these
values. Here is a code snippet showing what I have tried so far:
IWorkspace iw = ResourcesPlugin.getWorkspace();
IWorkspaceRoot iwr = iw.getRoot();
IProject ip = iwr.getProject();
IPathVariableManager ipvm = ip.getPathVariableManager();
URI u = ipvm.getURIValue(sdk_var_name);
String s = u.getPath();
Looking at the debugger Variables View, I can see that iwr.getProject();
returns null. I guess this makes sense since getProject() is supposed to
return null for the workspace. This code is run in resolveValue() inside
a class implementing IDynamicVariableResolver. What I really want is to
get the IPathVariableManager of the project so I can get at the variable
I want (which does appear in the project preferences).
The other option I could see would be to use the IWorkspaceRoot version
that takes the name of the project as an argument. I am certain this
would work, but I am not so sure of how to get the project's name.
Sorry if this is a trivial problem, I just feel like I am banging my
head against the API and not getting much out of it probably due to my
own ignorance. Thanks in advance for the assistance!
Wayne