Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » access include path from inferrence provider?
access include path from inferrence provider? [message #762257] Wed, 07 December 2011 19:10 Go to next message
Philippe Marschall is currently offline Philippe Marschall
Messages: 120
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 #762278 is a reply to message #762257] Wed, 07 December 2011 19:53 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin Dahyabhai
Messages: 2310
Registered: July 2009
Senior Member
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.

---
Nitin Dahyabhai
Eclipse WTP, IBM
Re: access include path from inferrence provider? [message #762516 is a reply to message #762278] Thu, 08 December 2011 08:31 Go to previous messageGo to next message
Philippe Marschall is currently offline Philippe Marschall
Messages: 120
Registered: July 2009
Senior Member
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?

Cheers
Philippe
Re: access include path from inferrence provider? [message #764759 is a reply to message #762516] Mon, 12 December 2011 19:53 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin Dahyabhai
Messages: 2310
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 11:16 Go to previous messageGo to next message
Philippe Marschall is currently offline Philippe Marschall
Messages: 120
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 #767924 is a reply to message #762278] Mon, 19 December 2011 08:03 Go to previous messageGo to next message
Philippe Marschall is currently offline Philippe Marschall
Messages: 120
Registered: July 2009
Senior Member
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.

Ok, I have this more or less running. I'm a bit unsure about converting
from IProject to IJavaScriptProject though. First first check for
org.eclipse.wst.jsdt.core.jsNature and then do JavaScriptCore.create. Is
this the right way to do it? Is there a reason adapters don't work?

Cheers
Philippe
Re: access include path from inferrence provider? [message #768335 is a reply to message #767924] Mon, 19 December 2011 23:37 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin Dahyabhai
Messages: 2310
Registered: July 2009
Senior Member
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?

---
Nitin Dahyabhai
Eclipse WTP, IBM
Re: access include path from inferrence provider? [message #768471 is a reply to message #768335] Tue, 20 December 2011 08:09 Go to previous message
Philippe Marschall is currently offline Philippe Marschall
Messages: 120
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
Previous Topic:integrate WSDLEditor(org.eclipse.wst.wsdl.ui) into a rcp project.
Next Topic:Eclipce (3.5) + Tomcat 6 = frustration..
Goto Forum:
  


Current Time: Sat Oct 25 08:03:52 GMT 2014

Powered by FUDForum. Page generated in 0.01770 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software