Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » What's the difference between getResource and getUnderlyingResource in IJavaElement
What's the difference between getResource and getUnderlyingResource in IJavaElement [message #1775212] Thu, 26 October 2017 11:49 Go to next message
Dollyn Sun is currently offline Dollyn SunFriend
Messages: 68
Registered: July 2009
Location: China
Member

I can tell the difference between getCorrespondingResource() and the above two methods. But for getResource and getUnderlyingResource , the description seems like the same.

Quote:
Returns the smallest underlying resource that contains this element, or null if this element is not contained in a resource.


Quote:
Returns the innermost resource enclosing this element.


Could somebody give some example when these two methods returns different result?


Dollyn
Re: What's the difference between getResource and getUnderlyingResource in IJavaElement [message #1777290 is a reply to message #1775212] Tue, 28 November 2017 08:30 Go to previous message
Jay Arthanareeswaran is currently offline Jay ArthanareeswaranFriend
Messages: 15
Registered: July 2009
Junior Member
For a working copy compilation unit, a type within that unit (or a method within that type), these two methods produce different results. For such a method and type, the
getResource()
returns the file as the result. But
getUnderlyingResource()
returns null. However, for a non working copy unit, these two methods produce the same result.
Previous Topic:ant jdt batch compiler problem - no uniform encoding
Next Topic:How to stop eclipse re-building other projects when trying to run one project
Goto Forum:
  


Current Time: Fri Dec 15 21:27:06 GMT 2017

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

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