In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the knowledge of "how to use the fast project navigation function of Eclipse3.5". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Open Declaration
In pre-Galileo versions of Eclipse, a quick way to open a file to see its contents was to right-click a method or class, then click Open Declaration in the context menu, and open the Java element (method, interface, or class) in the Java editor. In addition to using the context menu, you can press the Ctrl key and hover over an element in the Java editor. When the mouse hovers over an element, it is converted to a link that can be clicked. Clicking the link in the Java editor directs you to the declaration section of the corresponding element.
A new drop-down list has been added to Galileo that shows the option to open the declaration. Click Open Declaration to open the selected element in the Java editor (see figure 1).
Figure 1. Open the declaration
The problem with Open Declaration is the use of interfaces. If you are using an interface, this command opens the declaration of the element-it is an interface. It may be a little frustrating if you actually want to open the implementation of the selected element so that you can see the Java code that is actually executed when the project is running. This problem has been resolved in the new command feature in Galileo: Open Implementation.
Open Implementation
To invoke Open Implementation, press Ctrl and hover over a Java element in the Java editor as if you needed a hyperlink to open the declaration. The drop-down list appears, and you can click Open Implementation.
Figure 2. Open the implementation
Using the code shown above, the editor opens the actual class implementation of the element.
Figure 3. The code displayed in the edit
Javadoc hyperlink
If you use Javadoc (see Resources) to record element information, you can use the same Ctrl+ click technique to open elements referenced in Javadoc (using the @ see or @ link keywords), as shown in figure 4. When you click the hyperlink, Eclipse opens the specified type in the Java editor.
Figure 4. Click with Ctrl- in the Javadoc comment
Galileo provides a new feature to view the documentation of elements defined by @ see or @ link. The Javadoc preview and Javadoc view show the element as a hyperlink. If you click the hyperlink, the Javadoc of the related element is displayed. If you only need to read the Javadoc of the element, you can avoid opening the file in the new Java editor view.
Figure 5. Hyperlinks for quick browsing in the Javadoc view
View Quick Outline
In a larger class file that contains many methods, press Ctrl+O to open Quick Outline so that you can quickly find methods or fields. After pressing Ctrl+O, type the name of the method you want to find. As you type, the list is automatically filtered to show only the matching elements.
Figure 6. Use Quick Outline
When you select an element from the list, Eclipse navigates to it in the current Java editor.
View Quick Type Hierarchy
If you have a class file open in the Java editor and you want to open Java types in the type hierarchy, you can press Ctrl+T (or click Navigate > Quick Type Hierarchy) to display the type hierarchy.
Figure 7. Use Quick Type Hierarchy
The hierarchy displays the subtypes of the selected element. For example, if you select an interface when you call Quick Type Hierarchy, the list shows all known classes that implement that interface.
Pressing Ctrl+T,Quick Type Hierarchy again will display the supertype in the list (see figure 8). The list will now contain any interfaces implemented by the selected element and all the classes it extends.
Figure 8. Use Quick Type Hierarchy to find the super type
Select a type from the list of Quick Type Hierarchy, and Eclipse will open the selected type in a new Java editor.
Open Typ
If you know the name of the Java class you want to open in the editor, the easiest way to find and open it is to press Ctrl+Shift+T (or click Navigate > Open Type) to open the Open Type window. When this window appears, type a name, and Eclipse will display a list of matching types that can be found.
Figure 9. Use Open Type
In addition to typing the full class name, you can use two techniques to find results more quickly. * the technique is to use * and? Wildcards to match any or a single character, respectively. For example, to find the AutomobileFormatter class, type Auto* or A*Formatter.
Figure 10. Using wildcards in Open Type
The second technique is to use class abbreviations. The abbreviation is based on the uppercase letters of the type name. To find AutomobileFormatter, simply type AF. However, this may still not narrow it down enough, so you can type AuFo. Select a type from the list in the Open Type window, and then click OK. Eclipse opens the selected type in the Java editor.
Open a resource
Sometimes, the file you want to open is not a Java comment, but a properties file or XML file. Instead of using Open Types, you should use Open Resources by pressing Ctrl+Shift+R (or click Navigate > Open Resource). Similar to Open Type, you can use wildcards or abbreviations to quickly narrow down the resources in the list. As with Open Type, selecting a resource from the list and clicking OK,Eclipse opens the selected resource.
Use the breadcrumbs toolbar
Although the breadcrumb toolbar in the Java editor is similar to how Package Explorer is used, the methods, classes, packages, and other project resources displayed in the breadcrumb toolbar of the Java editor are easier to navigate.
To enable the breadcrumb toolbar, click the button shown below.
Figure 11. Java editor "breadcrumbs" toolbar toggle button
When enabled, the Bread crumbs toolbar will look like figure 12. When you select a different element from the editor, the item in the breadcrumb toolbar switches to display the currently selected element and its hierarchy in the project.
Figure 12. Java editor "breadcrumbs" toolbar
You can click the breadcrumb toolbar and view other elements at the same level.
Figure 13. Open elements at the same level
This is the end of the content of "how to use Eclipse3.5 's Quick Project Navigation function". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.