Eclipse Gems, Tips & Tricks: Open Declaration

This article is part of a ‘mini series’ about hidden gems, tips and tricks around Eclipse.
The topic of this one is how to show where a variable, function, … is declared or defined.

Navigate Open Declaration

Navigate Open Declaration

Eclipse is building up in the background a large data base about things in the editor. This database is called ‘the Index‘. One way to use it is to use the context menu (or F3) on any item in the source editor:

Open Declaration Context Menu

Open Declaration Context Menu

This not only jumps to the declaration: if done twice it jumps between declaration and definition.

There is a menu item for this too:

Navigate Open Declaration

Navigate Open Declaration

Another way is to use mouse left button with the <CTRL> key pressed: this underlines the items in the editor and does the same as clicking on link in your web browser:

Mouse with CTRL

Mouse with CTRL

That works for pretty much everything, including #include in the source editor:

Include Browsing

Include Browsing

Similar to a web browser, there is a ‘back’ and ‘forward’ too:

Back and Forward Navigation Buttons

Back and Forward Navigation Buttons

What I use most of the time are the keyboard shortcuts:

  • F3: Jump
  • Alt+Left: Back
  • Alt+Right: Forward

Happy browsing 🙂

Links

 

13 thoughts on “Eclipse Gems, Tips & Tricks: Open Declaration

  1. These features are invaluable, and get used hundreds of times daily. They improve productivity so much.
    I’ve done some work on MPLabX recently and it is flaming horrible in this regard. Just awful. Eclipse has spoiled me in a good way 🙂

    Erich, here’s one for you: call hierarchy works on some projects, but not others. It’s like the scope is wrong, but I can’t find where to change it. Do you know where to find such a thing? I’m using Window Working Sets for everything else.

    Like

      • Thanks Erich. In this case I don’t think that’s it; all indexer things checked and refreshed etc, as per your posts. It turns out that in my search scope for Call Hierarchy I seem to have to check the first project that uses that file (or, just all of them). Looks like a bug to me. Now at least I have something I can work with.

        Like

  2. Pingback: Eclipse Gems, Tips & Tricks: Working Sets | MCU on Eclipse

  3. Pingback: Eclipse Gems, Tips & Tricks: Block Comments | MCU on Eclipse

  4. Pingback: Eclipse Gems, Tips & Tricks: Highlight Usage and Definition | MCU on Eclipse

  5. Pingback: Eclipse Gems, Tips & Tricks: Code Completion | MCU on Eclipse

  6. Pingback: Eclipse Gems, Tips & Tricks: Faster Debugger Start | MCU on Eclipse

  7. Pingback: Eclipse Gems, Tips & Tricks: Project Filter | MCU on Eclipse

  8. Pingback: Eclipse Gems, Tips & Tricks: Text Block Selection | MCU on Eclipse

  9. Pingback: Eclipse Gems, Tips & Tricks: Close and Open Projects | MCU on Eclipse

  10. Pingback: Eclipse Gems, Tips & Tricks: Importing Projects | MCU on Eclipse

  11. Pingback: Eclipse Gems, Tips & Tricks: Code Folding | MCU on Eclipse

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.