Easy navigation in Eclipse Galileo: Find what you need quickly

Source: Internet
Author: User

I worked for a project where a friend (he was a technical director) he uses a cave explorer term "spelunking" to describe the process of searching for the content in a large project, and his explanation for the term is to search for a specific class file in a large number of file directories. For large Java projects, as interfaces and classes grow, the time it takes to find a file in the code library increases. Combing a large number of files and directories in Package Explorer is like exploring the depths of a cave.

If you are also looking for Java methods or classes in a large number of packages or directories, consider the large project navigation techniques provided in this article. By trying to discard the technique of using Package Explorer instead, most tasks require only a small amount of mouse clicks and keystrokes to complete.

Refactoring and organization

Many people believe that the use of consistent refactoring to keep the simplicity of a class avoids navigation problems, and it is argued that using packages to organize classes and interfaces in an intuitive way can also improve navigation. Both of these methods are recommended, and you should strive to achieve their goals, regardless of the simplicity of the tools used. However, you should be careful not to allow easy navigation to affect your design decisions: Design projects for specific domains.

Open Declaration

In the Eclipse version before Galileo, a quick way to open a file to view its contents is to right-click a method or class, and 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 can also press the Ctrl key and hover the mouse over the elements in the Java editor. When the mouse hovers over the element, it is converted to a link that can be clicked. Clicking the link in the Java editor directs you to the Declarations section of the corresponding element.

A drop-down list is added to the Galileo, which shows the options for opening the declaration. Click the Open declaration to open the selected element in the Java editor (see Figure 1).

Figure 1. Open a declaration

Using Mac OS X keyboard shortcuts

For all key combinations in this article, if you are using Eclipe on Mac OS X, you should replace Ctrl with CMD.

The only problem with Open declaration is the use of interfaces. If you are using an interface, the command opens the element's declaration-it is an interface. If you actually want to open the implementation of the selected element to see the Java code that the project is actually executing at run time, you may feel a bit depressed. This issue has been resolved in the new command feature in Galileo: Open implementation.

Open implementation

To invoke the open implementation, press Ctrl while you hover the mouse over a Java element in the Java editor, just as you would need to use a hyperlink to open a declaration. A drop-down list appears, and you can click Open implementation.

Figure 2. Open implementation

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.