|How does "Open Declaration" work? [message #1017987]
||Tue, 12 March 2013 23:02
| Nabiha Hossain
Registered: March 2013
So I'm interested in learning more about how the "Open Declaration" and Declaration View work.|
I've tried searching the eclipse git repository but I didn't manage to find the source for either of these tools.
Does anyone know where I would find the source? A high-level overview of their implementation would also be useful.
|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.01631 seconds