Step 5.4: Explore the Java perspective
Your workbench should currently look like the one in Figure 5.28.
Figure 5.28: The workbench in Java perspective.
If you were to compare this view to the one of the basic Resource perspective (such as the one shown in Figure 3.5), you would notice several differences. First, there are some additional options in the main menu bar.
q 5.4(a) View the Source menu.
Figure 5.29: Left-click on the Source option on the menu bar to see the Source menu.
Most of the options are currently grayed out (disabled), because you don't have any resources selected, just a project. However, as you can see, there are quite a few options.
Similarly, you can view the Refactor menu, which also has a number of options.
q 5.4(b) View the Refactor menu.
Figure 5.30: Left-click on the Refactor option to see the Refactor menu.
There are also several new options on the main tool bar.
q 5.4(c) Roll your cursor over the main tool bar to see Java-specific options.
As you roll your cursor over the main tool bar, tool tips appear, identifying each option, as shown in Figures 5.31 through 5.37.
Figure 5.31: The Debug tool.
Figure 5.32: The Run tool.
Figure 5.33: The New Java Project tool.
Figure 5.34: The New Java Package tool.
Figure 5.35: The New Scrapbook Page tool.
Figure 5.36: The New Java Class tool.
Figure 5.37: The Open Type tool.
The last new feature in the Java perspective is the Hierarchy view. There's nothing in it right now, but I'll at least show you how to get to it.
You'll see two tabs at the bottom of the left-hand pane: Package Explorer and Hierarchy. If you look closely, you'll see that the Package Explorer view is selected, but it's easier to tell by just looking at the title bar on the top of the pane.
Figure 5.38: The tabs at the bottom of a pane allow you to switch between stacked views.
Switching to the Hierarchy view is simple: Just click on the word "Hierarchy" in the bottom tab list.
q 5.4(d) Click on the Hierarchy tab to switch to the Hierarchy view.
Figure 5.39: Click on the tab to switch to the corresponding view, in this case, the Hierarchy tab.
The hierarchy view is empty at this point. This is just an example of stacked views, similar to those in the editor pane. In fact, you can also "dock" the panels in a stacked view, creating multiple panes. We won't bother with that here, but that might be something you want to explore. If you find that you've made the perspective unusable, you can always restore the defaults using the menu option Window/Reset Perspective.
Figure 5.40: The Hierarchy view, currently empty.
q 5.4(e) Click on the Package Explorer tab to switch back.
Figure 5.41: Click on the Package Explorer tab to return to the Package Explorer view.
You'll see a display like the one in Figure 5.42. You're ready to proceed to Step 6.
Figure 5.42: And here you are on the Package Explorer, ready for Step 6.
Step 6: The Debug Perspective
So far you've seen the Resource perspective and the Java perspective. These two were similar to one another because they served a similar purpose: group sets of objects, and then allow navigation and manipulation of those objects. The major difference is that the Java perspective is a bit more focused and specific. Many perspectives will be of this nature; I call them navigation perspectives, or sometimes just navigators.
There are other kinds of perspectives, however. Some perspectives are geared toward a single task. The Debug perspective is one of those. It has special views and a layout specifically designed to allow you as the programmer to interact with the currently running program and perform the various activities associated with debugging, such as setting breakpoints and inspecting variables ..
Step 6.1: Open the Debug perspective
This is another way to open a perspective. To get to the Java perspective, you opened a new Java project. If that were the only way to switch to a new perspective, you'd have a lot of junk projects, but of course that's not your only option. In this step, you'll use the main menu bar to open and close the Debug perspective.
q 6.1(a) From the main menu bar, select the Window menu.
Figure 6.1: Select the Window option on the main menu bar.
q 6.1(b) Select Open Perspective/Debug.
Figure 6.2: Select Open Perspective/Debug to switch to the debug perspective.
Figure 6.3 shows the Debug perspective. There's not much to see at this point, since you have no programs running, but I wanted you to see a perspective that is significantly different in initial appearance from the usual navigator-type perspectives you've seen up to now.
Figure 6.3: The Debug perspective, although it's pretty empty because nothing is running.
Note that a new icon (the little bug) has appeared on the perspective bar at the left. Whenever you open a new perspective, its icon shows up on the perspective bar. You can also switch perspectives and open and close them from the perspective bar, but I'll leave that for another time.
Although the Debug perspective isn't particularly useful yet, you can at least wander around it a little bit. For example, the upper left pane is the debug pane. That pane has a toolbar with a number of options. Most are grayed out (disabled), but you can still roll your mouse pointer over them to get a hint.
If you roll over the buttons as shown in Figures 6.4 and 6.5, you'll see the Resume tool and the Step with Filters/Step Debug tool, both of which will be familiar to programmers who have used IDEs before. If you don't recognize them, don't worry; I'll explain them in detail in Part II.
Figure 6.4: The Resume tool button.
Figure 6.5: The Step with Filters tool button.
There are multiple ways to close a perspective, but the most straightforward is probably to use the main menu bar. Selecting Window/Close Perspective will close the currently displayed perspective.
q 6.1(c) From the main menu bar, select Window/Close Perspective.
Figure 6.6: Select Window/Close Perspective to close the current perspective.
Closing this perspective will return you to the previous perspective, in this case the Java perspective. Note that the Debug perspective icon is no longer on the perspective bar.
Figure 6.7: And now you're back to the Java perspective.
Now that you've seen most of the pieces of the Eclipse workbench as they relate to simple Java development, I think it's time that to begin a real project.