Previous Page
Next Page

1.5. Navigating

Eclipse includes a number of tools designed to make it easy to navigate the system and find information. This section discusses some of the tools accessible from the Eclipse Navigate menu.

Tip

Many third-party plug-ins are available that provide various navigational enhancements for Eclipse (see Appendix A). For example, CodePro provides a Java History view that keeps track of any Java files you have accessed as well as a Modified Type view that track any types you have changed.


1.5.1. Open Type dialog

The Open Type dialog is used to quickly jump to any Java class in the system. Select the Navigate > Open Type... command (Ctrl+Shift+T) to open the dialog (see Figure 1-24) or click the Open Type toolbar button, then enter the name of the type you want to find. The name field allows wildcards and will show a list of all types that match the entered pattern. The dialog also provides CamelCase support, so entering "NPE" will find the class NullPointerException. If nothing is entered into the field, the dialog shows a list of types found in the past (the first time you access the dialog, it will be empty).

Figure 1-24. Open Type dialog.


Select the desired type from the list and click the OK button to open that type in an editor. If more than one type matches the name, the package name qualifier will be displayed to the right of the type name.

1.5.2. Type Hierarchy view

The Type Hierarchy view shows the superclasses and subclasses of a given type (see Figure 1-25). The view also has options for showing just the supertype hierarchy (both superclasses and implemented interfaces) or subtype hierarchy (subclasses and interface implementers) of a type.

Figure 1-25. Type Hierarchy view.


The Type Hierarchy view can be accessed in several different ways. The easiest way is to select the type name in an editor, then select the Navigate > Open Type Hierarchy command (or use the F4 keyboard shortcut). Alternatively, select the Navigate > Open Type in Hierarchy... command (Ctrl+Shift+H) to open the Open Type dialog, as shown in Figure 1-24.

1.5.3. Go to Line

To jump to a specific line of code within a file, use the Navigate > Go to Line... command (Ctrl+L). This opens a prompter for entering the desired line number (see Figure 1-26). Clicking the OK button jumps to that line in the editor.

Figure 1-26. Line number prompter.


1.5.4. Outline view

The Outline view shows an outline of the structural elements of the selected editor. The contents vary depending on the type of editor in use. For example, when editing a Java class, the Outline view displays the classes, fields, and methods in the Java class being edited (see Figure 1-27).

Figure 1-27. Outline view.


The Java Outline view includes a number of options to control which elements are displayed within the outline. There are filters for hiding fields, static members, non-public members, and local types. In addition, there are options for sorting members (shown in definition order by default) and drilling down to the top-level type (normally, the outline starts at the file level).


Previous Page
Next Page