[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdt-dev] Retrieving Variables from the Project PathVariableManager
|
So why you trying to get it from workspace? Get your project instance first,
for example from selection
On Tue, Mar 1, 2011 at 4:26 PM, wwarren <wwarren@xxxxxxxxxxx> wrote:
> 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
>
>
>
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
>