| access include path from inferrence provider? [message #762257] |
Wed, 07 December 2011 14:10  |
Philippe Marschall Messages: 115 Registered: July 2009 |
Senior Member |
|
|
Hi
I'm implementing a custom InferrenceProvider and am stuck in #applysTo.
To make a decision I need to have a look at the libraries of the project
the file is in. But I see no way to access it. Am I missing something?
Cheers
Philippe
|
|
|
|
|
| Re: access include path from inferrence provider? [message #764759 is a reply to message #762516] |
Mon, 12 December 2011 14:53   |
 |
Nitin Dahyabhai Messages: 1843 Registered: July 2009 |
Senior Member |
|
|
On 12/8/2011 3:31 AM, Philippe Marschall wrote:
> On 12/07/2011 08:53 PM, Nitin Dahyabhai wrote:
>> It's not directly tied to that interface, as there are already ways to
>> get at which libraries a project uses
>> [IJavaScriptProject#getResolvedIncludepath()]. IInferenceFile provides
>> a filename, or rather a path to the file. There's no information given
>> about whether that's a system location or a path in the workspace, but
>> that should also be something that can be figured out.
>
> Do you have some pointers to get me started? How do I get the
> IJavaScriptProject of a IInferenceFile?
The character array for the filename can be converted into a String,
turned into a Path, and then used with the normal IWorkspaceRoot methods
to find whether it's a path in the workspace or a system location. If
it's the former, finding the project is straightforward.
--
---
Nitin Dahyabhai
Eclipse WTP Source Editing and JSDT
IBM Rational
---
Nitin Dahyabhai
Eclipse WTP, IBM
|
|
|
| Re: access include path from inferrence provider? [message #765604 is a reply to message #764759] |
Wed, 14 December 2011 06:16   |
Philippe Marschall Messages: 115 Registered: July 2009 |
Senior Member |
|
|
On 12/12/2011 08:53 PM, Nitin Dahyabhai wrote:
> On 12/8/2011 3:31 AM, Philippe Marschall wrote:
>> On 12/07/2011 08:53 PM, Nitin Dahyabhai wrote:
>>> It's not directly tied to that interface, as there are already ways to
>>> get at which libraries a project uses
>>> [IJavaScriptProject#getResolvedIncludepath()]. IInferenceFile provides
>>> a filename, or rather a path to the file. There's no information given
>>> about whether that's a system location or a path in the workspace, but
>>> that should also be something that can be figured out.
>>
>> Do you have some pointers to get me started? How do I get the
>> IJavaScriptProject of a IInferenceFile?
>
> The character array for the filename can be converted into a String,
> turned into a Path, and then used with the normal IWorkspaceRoot methods
> to find whether it's a path in the workspace or a system location. If
> it's the former, finding the project is straightforward.
>
Thanks
Philippe
|
|
|
|
|
| Re: access include path from inferrence provider? [message #768471 is a reply to message #768335] |
Tue, 20 December 2011 03:09  |
Philippe Marschall Messages: 115 Registered: July 2009 |
Senior Member |
|
|
On 12/20/2011 12:37 AM, Nitin Dahyabhai wrote:
> JavaScriptCore#create() and IJavaScriptProject#.isExists() are the right
> way to go about it (although if you must check for the nature yourself,
> org.eclipse.wst.jsdt.core.JavaScriptCore#NATURE_ID is the constant to
> use). For adapters, are you sure you're using the right key?
Uhm, no. This is the code I have:
IProject project = resource.getProject();
Object adapter1 = Platform.getAdapterManager().getAdapter(project,
IJavaScriptProject.class);
Object adapter2 = project.getAdapter(IJavaScriptProject.class);
both adapters end up being null.
Gruss
Philippe
|
|
|
Powered by
FUDForum. Page generated in 0.02248 seconds