站内搜索: 请输入搜索关键词
当前页面: 图书首页 > Eclipse Rich Client Platform: Designing, Coding, and Packaging Java Applications

Section 3.7.  Learning by Example - Eclipse Rich Client Platform: Designing, Coding, and Packaging Java Applications

Previous Page
Next Page

3.7. Learning by Example

One of the most efficient and effective ways of figuring out how to program a system is by browsing examples. We can't emphasize this enough. Eclipse itself is one huge example. It can be overwhelming, but there are various shortcuts and mechanisms you can use to help follow the code. Below is a short list of the workspace navigation operations we use on a day-to-day basis:

Navigate > Open Type... (Ctrl+Shift+T) Opens the Java type with the name you enter. Wildcards are supported. This is a fine way of discovering where a type is or if it exists.

Navigate > Quick Type Hierarchy (Ctrl+T) Pops up a type hierarchy rooted by the type associated with the selection in the current Java editor. For example, if the selection is on a type, a normal type hierarchy is opened. If the selection is on or in a method, all implementers of that method in the hierarchy are shown. Press Ctrl+T again to invert the hierarchy.

Search > References > Workspace (Ctrl+Shift+G) Searches for references to the selected Java element (e.g., type, method, field) in the current Java editor. Ctrl+Shift+U does the same search but local to the current file.

Navigate > Open Declaration (F3) Opens the declaration of the Java element selected in the current Java editor.

Since Eclipse is so decoupled, it can be hard to figure out how the various pieces interact. PDE offers various tools and mechanisms for navigating these interconnections. The Plug-in Development perspective (Window > Open Perspective > Other... > Plug-in Development) includes a Plug-ins view. From this, you can easily navigate the dependencies and references. From the PDE plug-in editor, you can discover the extension-to-extension point interconnections, navigate to the classes defined in various extensions, and browse extension point documentation.

Tip

In the Plug-ins view, select all plug-ins and use the Add to Java Search context menu entry to add all known plug-ins to the Java search scope. This is helpful because Java search only looks in projects in the workspace and their dependent projects. This means that if you open an empty workspace and try to open a type (e.g., Ctrl+Shift+T). By adding all plug-ins in your target platform to the search, you can more easily navigate example code and classes that you do not reference from your projects.



Previous Page
Next Page