Eclipse 简明教程

Eclipse - Navigation

Navigating the Eclipse Workspace

导航菜单提供许多可让您快速找到资源并导航到它的菜单项。

The navigate menu provides a number of menu items that allow you to quickly locate and navigate to a resource.

navigation menu

其中 Open Type、Open Type in Hierarchy 和 Open Resource 菜单项往往非常有用。

Among them, the Open Type, Open Type in Hierarchy and Open Resource menu items tend to be very useful.

Open Type

Open Type 菜单项会弹出一个对话框,可让您找到 Java 类型。在过滤器文本框中,输入类的完全限定名或名称。可以此字符代表 0 个或更多个字符和“?”代表单个字符来指定模式。对话框将显示所有与给定模式匹配的名称。

The Open Type menu item brings up a dialog box that allows you to locate a Java type. In the filter text box enter in either the fully qualified name or name of a class. The '*' character which stands for 0 or more characters and '?' which stands for a single character can be used to specify patterns. The dialog box will show all the names that match the given pattern.

navigation open type

选择您感兴趣的类型,然后单击 OK

Select the type you are interested in and click OK.

Eclipse 会打开一个显示所选类型的编辑器。如果所选类型的源代码不可用,它将使用类文件编辑器来显示所选类型的字节码。

Eclipse will open up an editor showing the selected type. If source code is not available for the selected type it will use the Class File editor to show the byte code of the selected type.

navigation class editor

您可以使用“附加源”按钮来指定类的源代码所在位置。

You can use the Attach Source button to specify where the source code for the class is located.

java 发行版附带的类型的源代码位于 src.zip 中,该文件位于 java 主文件夹中。

The source code for the types that comes with the java distribution is in src.zip which is located in the java home folder.

Open Type in Hierarchy

Open Type in Hierarchy 菜单项允许您在类型层次结构视图中打开类型。可以此 Open Type in Hierarchy 对话框用于在构建路径中找到任何 Java 类型。

The Open Type in Hierarchy menu items allows you to open a type in the Type Hierarchy view. The Open Type in Hierarchy dialog box can be used to locate any Java type in the build path.

navigation oth

选择类型后,其层次结构将显示在类型层次结构视图中。

Once you select a type, its hierachy is shown in the Type Hierarchy view.

navigation thv

类型层次结构是学习类型层次结构的出色视图。在左侧窗格类型中,可使用其父类型和子类型。在右侧窗格中,您可以看到显示所选类型属性和方法。

The Type Hierarchy is an excellent view for learning about the hierarchy of a type. On the left hand side pane type, its super type and sub type are available. On the right hand side pane you can see the attributes and methods of a selected type are shown.

Open Resource

可以使用 open resource 菜单项来查找工作空间中的文件。可以此字符代表 0 个或更多个字符和“?”代表单个字符来指定模式。对话框将显示所有与给定模式匹配的名称。

The open resource menu item can be used to locate a file in the workspace. The '*' character which stands for 0 or more characters and '?' which stands for a single character can be used to specify patterns. The dialog box will show all the names that match the given pattern.

navigation open res

在编辑器中选择想要打开的文件,然后单击“确定”按钮。

Select the file that you want to open in an editor and click on the OK button.