Previous Next |
Some Essential SkillsThere are some additional skills that are good to know about. For example, if you highlight an item in the JDT editor, right-click it, and select Open Declaration, the declaration of that item will open. This is great for tracking down where and how methods and fields were created. Several of those are detailed in this section and all are worth adding to your Eclipse toolbox. Viewing Type HierarchiesAnother menu item in the JDT editor's context menu is the Open Type Hierarchy; when you select an item in the editor and select this menu item, that item's type hierarchy appears in the Java perspective's hierarchy view, as you see at left in Screenshot-24. Screenshot-24. The hierarchy view![]() This view acts like an object browser. It lets you explore a type's Java complete hierarchy, and double-clicking an item in this view opens its definition in the editor. That's useful if, for example, you want to see all the members of the System.out class—just highlight System.out in your code and open its hierarchy. You can also open this view by selecting an item in the editor and selecting the Navigate Browsing Java CodeThere's even another entire perspective dedicated to letting you browse through projects in a Java-oriented way: the Java Browsing perspective. To open this perspective, select Window Screenshot-25. The Java browsing perspective![]() This perspective presents the information you see in the standard Java perspective in a new way, and it breaks type and member information into two new views (the Members view here is much like the Outline view in the standard Java perspective). As you'd expect, the views in this perspective are all coordinated—selecting an element in the Projects views makes its packages appear in the Packages view, for example. And selecting an item in the Members view makes that item appear in the editor, and so on. Searching Code Eclipse also has great facilities for searching through code in the Search menu. In fact, the main menu items in the Search menu, Search Screenshot-26. Performing a file search![]() Clicking Search makes Eclipse search for matches to the text you've entered, and you can see the results in the Search Results view, which appears at the bottom in Screenshot-27. Double-clicking a match in the Search Results view opens the match in the JDT editor, as you can see in the figure, and both underlines the match and points to it with an arrow. Screenshot-27. Viewing search results![]() You can also perform Java searches with the Java tab in the Search dialog. This lets you search for Java elements by kind—types, methods, packages, constructors, and fields—as you can see in Screenshot-28. You can also limit the search so that it only matches declarations or references. Screenshot-28. Performing a Java search![]() Being able to search across files and classes is one of the big advantages of using an IDE—if you've been doing Java development using a text editor and javac, you'll find there's no comparison when you start using the project management capabilities like these in Eclipse. |
Previous Next |