Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » How to figure our an ITypeRoot comes from Java Standard Library?
How to figure our an ITypeRoot comes from Java Standard Library? [message #872644] Wed, 16 May 2012 14:09 Go to next message
Marcel Bruch is currently offline Marcel BruchFriend
Messages: 289
Registered: July 2009
Senior Member

The question is simple (the answer seems not): Given an ITypeRoot, how can I quickly find out if this class belongs to the JRE System Library with JDT means?


http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.jdt.doc.isv%2Fguide%2Fjdt_int_model.htm shows the model elements that exist in JDT. The JRE System Library as shown on the picture has no associated type.

I went from an IType over its IPackageFragementRoot to an IClasspathEntry but then I got stucked. Is there a simple means to know whether a IPackageFragementRoot comes from the JRE?

Thanks,
Marcel



Re: How to figure our an ITypeRoot comes from Java Standard Library? [message #872670 is a reply to message #872644] Wed, 16 May 2012 15:11 Go to previous messageGo to next message
Marcel Bruch is currently offline Marcel BruchFriend
Messages: 289
Registered: July 2009
Senior Member

One probably has to come from another direction. This seems to work.

for (IClasspathEntry entry : project.getRawClasspath()) {
  if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
    IPackageFragmentRoot[] subentries = e.project.findPackageFragmentRoots(entry);
    // hope this works always ;)
  }
}
Re: How to figure our an ITypeRoot comes from Java Standard Library? [message #872957 is a reply to message #872670] Thu, 17 May 2012 07:21 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
There can be various containers other than the JRE containers. If the entry path contains something like "org.eclipse.jdt.launching.JRE_CONTAINER/...", it should be the JRE container set by JDT. BTW, Android projects could be different.
Re: How to figure our an ITypeRoot comes from Java Standard Library? [message #872961 is a reply to message #872957] Thu, 17 May 2012 07:30 Go to previous message
Marcel Bruch is currently offline Marcel BruchFriend
Messages: 289
Registered: July 2009
Senior Member

Thanks for the info.

I'm currently filtering on org.eclipse.jdt.launching.JRE_CONTAINER and mark all PackageFragmentRoots returned by project.findPackageFragmentRoots(entry) as being JavaRuntime libraries.

I should add Android containers and make this configurable.

Thanks,
Marcel
Previous Topic:Problem in integrating Android application with Postgresql database
Next Topic:Eclipse Classic vs Eclipse Java
Goto Forum:
  


Current Time: Fri Apr 26 08:25:37 GMT 2024

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

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

Back to the top