Skip to main content


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.

Thanks!
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: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

You can find the source code of the Java Development Tools for Eclipse on github:
* https://github.com/eclipse/eclipse.jdt.core
* https://github.com/eclipse/eclipse.jdt.ui
* https://github.com/eclipse/jdt
* https://github.com/eclipse/eclipse.jdt
* https://github.com/eclipse/eclipse.jdt.debug

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.

Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau
Google+: +stephane.begaudeau
Blog: http://stephanebegaudeau.tumblr.com | Eclipse Java Development Tools Tips and Tricks
Previous Topic:ListRewrite removes whitespace
Next Topic:eclipse jdk1.7+win 8 64bit
Goto Forum:
  


Current Time: Thu Apr 25 01:13:04 GMT 2024

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

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

Back to the top