Easy navigation in Eclipse Galileo

Finding your way around

Eclipse Galileo introduces several features that allow you to quickly navigate your Java™ technology projects. When combined with existing features, you can get around quickly even in the largest projects.


Nathan A. Good, Senior Information Engineer, Freelance Developer

Nathan GoodNathan A. Good lives in the Twin Cities area of Minnesota. Professionally, he does software development, software architecture, and systems administration. When he's not writing software, he enjoys building PCs and servers, reading about and working with new technologies, and trying to get his friends to make the move to open source software. He's written and co-written many books and articles, including Professional Red Hat Enterprise Linux 3, Regular Expression Recipes: A Problem-Solution Approach, and Foundations of PEAR: Rapid PHP Development.

08 September 2009

Also available in Japanese Portuguese

A friend and technical lead on a project I was on once called it the cave-exploring term "spelunking," but he used it to mean searching through directories in a large set of files for a particular class file. With large Java projects, it's natural that as more interfaces and classes are added, the more time it can take to navigate the code base looking for a file. Combing through a large number of these files and directories in the Package Explorer can feel like exploring the deep abysses of a cave.

If you're still spelunking through packages or directories to find your Java methods or classes, consider these tips for navigating through large projects. Challenge yourself to avoid using the Package Explorer and use the tips here, most of which only require minimal movements of the mouse and a couple clicks on the keyboard.

Refactoring and organizing

There is a good argument in favor of avoiding navigation problems by keeping classes succinct with constant refactoring and for using packages to organize classes and interfaces in such an intuitive structure that they should be easy to navigate. Both are good goals, and you should strive for them regardless of how easy the tools make it. However, be careful not to let easy navigation influence your design decisions: Design your project to the domain.

Open Declaration

In versions of Eclipse prior to Galileo, one way to quickly open a file to view its contents was to right-click a method or class, then click Open Declaration in the context menu to open the Java element (method, interface, or class) in the Java editor. In addition to using the context menu, you could press the Ctrl key and hover over the element in the Java editor. As your mouse hovered over the element, it would turn into a link you could click. Clicking the link took you to the declaration in the Java editor.

New in Galileo is a drop-down list that displays the options for opening a declaration. Clicking Open Declaration opens the selected element in the Java editor (see Figure 1).

Figure 1. Opening a declaration
Opening a declaration

Using Mac OS X keyboard shortcuts

For all key combinations in this tip, substitute Ctrl with Cmd if you're using Eclipse on Mac OS X.

The only problem with using Open Declaration has been with using interfaces. If you're using interfaces, the command opens the declaration of the element — which is an interface. That might be slightly annoying if what you're really trying to do is open the implementation of the selected element to see the Java code that will actually execute when the project runs. This problem has been resolved in a new command feature in Galileo: Open Implementation.

Open Implementation

To invoke Open Implementation, press Ctrl while hovering over a Java element in the Java editor, just as if you would have to use the hyperlinking to open a declaration. The drop-down list appears, and you can click Open Implementation.

Figure 2. Opening an implementation
Opening an implementation

Using the code shown above, the editor opens with the actual class implementation of the element.

Figure 3. Code shown in the editor
Code shown in the editor

Javadoc hyperlinks

If you use Javadoc (see Resources) to document your elements, you can use the same Ctrl+click technique to open elements you've referenced in your Javadoc using the @see or @link keywords (see Figure 4). When you click the hyperlink, Eclipse opens the specified type in the Java editor.

Figure 4. Using Ctrl+click in Javadoc comment
Ctrl-click in Javadoc comments

In Galileo, a new feature is the ability to view documentation for the elements defined by @see or @link. The Javadoc preview and Javadoc view display the elements as hyperlinks. If you click the hyperlinks, the Javadoc for the clicked-on element appears. You can cut down on opening files in new Java editor views if all you're going to do is read the Javadoc for the element.

Figure 5. Hyperlinks in the Javadoc views for quick reading
Hyperlinks in the Javadoc views for quick reading

Viewing the Quick Outline

In large class files with many methods, pressing Ctrl+O to open the Quick Outline helps you find a method or field quickly. After pressing Ctrl+O, start typing the name of the method you want to find. As you type, the list filters itself to display only the matching elements.

Figure 6. Using the Quick Outline
Using the Quick Outline

When you select the element from the list, Eclipse navigates to the element in the current Java editor for you.

Viewing the Quick Type Hierarchy

If you have a class file open in the Java editor and would like to open Java types in the type hierarchy, press Ctrl+T (or click Navigate > Quick Type Hierarchy) to display the type hierarchy.

Figure 7. Using the Quick Type Hierarchy
Using the Quick Type Hierarchy

The hierarchy displays the subtypes for the selected element. For example, if an interface is selected when you invoke the Quick Type Hierarchy, the list displays all the known classes that implement the interface.

Press Ctrl+T again, and the Quick Type Hierarchy displays the supertypes in the list (see Figure 8). The list now contains any interfaces that the selected element implements or classesit extends.

Figure 8. Using the Quick Type Hierarchy to find supertypes
Using the Quick Type Hierarchy to find supertypes

Choose a type from the list in the Quick Type Hierarchy, and Eclipse opens a new Java editor with the selected type.

Opening types

If you know the name of the Java class you want to view in the editor, the easiest way to find and open it is to press Ctrl+Shift+T (or click Navigate > Open Type) to show the Open Type window. When this window appears, start typing, and Eclipse shows you the list of matching types it can find.

Figure 9. Using Open Type
Using Open Type

Aside from typing the full class names, you can use two tricks to find your results even faster. The first is to use the * and ? wildcards to match any or a single character, respectively. For instance, to find the AutomobileFormatter class, type Auto* or A*Formatter (see Figure 10).

Figure 10. Using wildcards in Open Type
Using wildcards in Open Type

The second tip is to use abbreviations for the class. The abbreviations are based on the uppercase letters of the type names. To find AutomobileFormatter, type AF. That still might not narrow it down very much, however, so type AuFo. Select a type from the list in the Open Type window, then click OK. Eclipse opens the selected type in the Java editor.

Opening resources

Sometimes, the files you want to open aren't Java elements but, rather, properties files or XML files. Instead of using Open Types, use Open Resources by pressing Ctrl+Shift+R (or clicking Navigate > Open Resource). Similar to Open Type, you can use wildcard characters or abbreviations to quickly narrow down the list of resources. Like Open Type, click OK after you select your resource from the list, and Eclipse opens the selected resource.

Although using Java editor bread crumbs is similar to using the Package Explorer, the presentation of the methods, classes, packages, and other project resources is displayed in a much more navigable fashion in the Java editor's bread crumbs.

To turn the bread crumbs on, click the button shown below.

Figure 11. Java editor bread crumbs toggle button
Java editor bread crumbs toggle button

When turned on, the bread crumbs look like those in Figure 12. As you select different elements in the editor, the items in the bread crumbs change to show the currently selected element and its hierarchy in the project.

Figure 12. The Java editor bread crumbs
The Java editor bread crumbs

You can click the bread crumb and view other elements at the same level in the hierarchy.

Figure 13. Opening elements at the same level in the hierarchy
Opening elements at the same level in the hierarchy


Eclipse offers features that help you navigate large code bases quickly and efficiently, without the need to go "spelunking" through code files and directories. Using the features in the Eclipse IDE allows you to focus your time and energy on implementing code and not getting tied up trying to find classes and methods.



Get products and technologies


  • The Eclipse Platform newsgroups should be your first stop to discuss questions regarding Eclipse. (Selecting this will launch your default Usenet news reader application and open eclipse.platform.)
  • The Eclipse newsgroups has many resources for people interested in using and extending Eclipse.
  • Participate in developerWorks blogs and get involved in the developerWorks community.


developerWorks: Sign in

Required fields are indicated with an asterisk (*).

Need an IBM ID?
Forgot your IBM ID?

Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.


All information submitted is secure.

Dig deeper into Open source on developerWorks

Zone=Open source
ArticleTitle=Easy navigation in Eclipse Galileo