|Re: How does "Open Declaration" work? [message #1018792 is a reply to message #1017987]
||Thu, 14 March 2013 13:31
| Stephane Begaudeau
Registered: April 2010
Location: Nantes (France)
You can find the source code of the Java Development Tools for Eclipse on github:
What you are looking for is the class OpenAction. By the way, if you want to known how something is done in Eclipse, go in the Window -> Preferences menu select Plug-in Development and include all plug-ins from target in Java search. After that use Alt+Shift+F1 to see the Java class responsible for the currently selected view, editor or wizard and Alt+Shift+F2 (and then click on a button or anything else) to see which Java class is responsible for the clicked element.
How is it working? To make it short, the JDT is storing the structure of all your Java source code in the metadata of your workspace. Each time you are changing something, this index is updated. When you are asking for a reference (search references, call hierarchy, open declaration, refactoring, etc...) this index is used. This is why the JDT is so quick. You can have a look at the builder of the JDT to see how this index is done.
Stephane Begaudeau, Obeo
Blog: http://stephanebegaudeau.tumblr.com | Eclipse Java Development Tools Tips and Tricks
Powered by FUDForum
. Page generated in 0.01919 seconds