Know which types are referenced by a ICompilationUnit

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Know which types are referenced by a ICompilationUnit

Mickael Istria-5
Hi all,

I'm trying some experiments about https://bugs.eclipse.org/bugs/show_bug.cgi?id=105372 , https://bugs.eclipse.org/bugs/show_bug.cgi?id=486035 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=486032 .
I didn't manage to find a good way, from a given ICompilationUnit, to get the list of types that are used by this ICompilationUnit. I could crawl the AST model to find that, but I imagine JDT may already have this implemented in some way I could reuse. Does it?

Thanks in advance
--
Mickael Istria
Eclipse developer at JBoss, by Red Hat
My blog - My Tweets

_______________________________________________
jdt-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jdt-dev
Reply | Threaded
Open this post in threaded view
|

Re: Know which types are referenced by a ICompilationUnit

Brian de Alwis-3
See SearchEngine.searchDeclarationsOfReferencedTypes().  There are lots of goodies on SearchEngine.

Brian.

On 25-Feb-2016, at 11:27 AM, Mickael Istria <[hidden email]> wrote:

Hi all,

I'm trying some experiments about https://bugs.eclipse.org/bugs/show_bug.cgi?id=105372 , https://bugs.eclipse.org/bugs/show_bug.cgi?id=486035 and https://bugs.eclipse.org/bugs/show_bug.cgi?id=486032 .
I didn't manage to find a good way, from a given ICompilationUnit, to get the list of types that are used by this ICompilationUnit. I could crawl the AST model to find that, but I imagine JDT may already have this implemented in some way I could reuse. Does it?

Thanks in advance
--
Mickael Istria
Eclipse developer at JBoss, by Red Hat
My blog - My Tweets
_______________________________________________
jdt-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jdt-dev


_______________________________________________
jdt-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jdt-dev
Reply | Threaded
Open this post in threaded view
|

Re: Know which types are referenced by a ICompilationUnit

Mickael Istria-5
On 02/26/2016 09:33 PM, Brian de Alwis wrote:
See SearchEngine.searchDeclarationsOfReferencedTypes().  There are lots of goodies on SearchEngine.
Thank you, that helped a lot!
However, it seems like the resource for this search is always an IProject and that the offset and length are not set. I would expect it to provide a resource instead with the start/length where the reference is written in the file. Do you know if what I want is possible?
--
Mickael Istria
Eclipse developer at JBoss, by Red Hat
My blog - My Tweets

_______________________________________________
jdt-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jdt-dev
Reply | Threaded
Open this post in threaded view
|

Re: Know which types are referenced by a ICompilationUnit

Mickael Istria-5
On 03/01/2016 08:54 AM, Mickael Istria wrote:
On 02/26/2016 09:33 PM, Brian de Alwis wrote:
See SearchEngine.searchDeclarationsOfReferencedTypes().  There are lots of goodies on SearchEngine.
Thank you, that helped a lot!
However, it seems like the resource for this search is always an IProject and that the offset and length are not set. I would expect it to provide a resource instead with the start/length where the reference is written in the file. Do you know if what I want is possible?
After digging a bit more, I found the "TypeReferencePattern" and used this.
--
Mickael Istria
Eclipse developer at JBoss, by Red Hat
My blog - My Tweets

_______________________________________________
jdt-dev mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jdt-dev