Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » How does "Open Declaration" work?
How does "Open Declaration" work? [message #1017987] Tue, 12 March 2013 23:02 Go to next message
Nabiha Hossain is currently offline Nabiha HossainFriend
Messages: 1
Registered: March 2013
Junior Member
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 Go to previous message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 450
Registered: April 2010
Location: Nantes (France)
Senior Member


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

Twitter: @sbegaudeau
Google+: +stephane.begaudeau
Blog: | Eclipse Java Development Tools Tips and Tricks

Previous Topic:ListRewrite removes whitespace
Next Topic:eclipse jdk1.7+win 8 64bit
Goto Forum:

Current Time: Tue Apr 24 10:45:31 GMT 2018

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

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