The Resource perspective you used in the last step is probably the one you are least likely to use on a regular basis. Because the Resource perspective assumes no knowledge about the contents of the various resources, that means it really can't help you that much, other than to organize things.
Now, if you were just gathering together various PC objects, such as pictures and text documents and the like, and then
However, the primary focus of this step is going to be using the Java perspective, and so let's get started on that.
The Eclipse SDK ships with three different features: the Eclipse Platform, the Java Development Tooling (JDT), and the Plug-in Development Environment (PDE). The Eclipse Platform consists of little more than the base libraries and the Resource perspective, which you reviewed in the previous step, while the PDE requires a whole book by itself. What we can cover is the JDT.
The JDT includes several different
Instead, throughout this book, and in this step in particular, you'll be spending most of your time in the Java perspective. There are many ways of opening a perspective, but in this step you're going to take advantage of the fact that creating a certain kind of project can trigger the switch to a corresponding perspective. In this case, you will create a Java project, and you will see how Eclipse automatically switches to the appropriate perspective, the Java perspective.
So, without further ado, let's create some Java.
I'll show you a quick way to tidy up the Navigator pane. The rightmost button of the Navigator toolbar is a set of four arrows pointing inward. If you roll your mouse over the button, the tool tip will come up saying "Collapse All". As the tip implies, this button will collapse all of your expanded folders and projects.
q 5.1(a) Click the Collapse All button on the Navigator toolbar.
Figure 5.1:
Clicking Collapse All collapses all projects and folders.
Okay, now that the projects are closed, I'd like you to close the documents you had
q 5.1(b) Close the Step List.txt resource.
Figure 5.2:
Close the Step List.txt document by clicking on the X.
q 5.1(c) Close the .project resource.
Figure 5.3:
Close the .project resource by clicking on the X.
As you add more plug-ins to your workbench, you will find that you have more and more options. For example, the base Eclipse Platform allows you to create projects only of a very simple type. The JDT and the PDE both add their own project types. The JDT adds the type Java Project. [1]
| Note |
This feature, like so many others, is configurable. Use the Windows/Preferences option, then on the Workbench/Perspectives page check or uncheck "Switch to recommended perspective" under "New project options" to enable or disable this auto-switch feature. |
Let's take the shortcut, shall we?
Okay, now you've got a nice clean workbench, so it's time to create a new project (and get things all messy again!). Remember that the right button of the mouse
q 5.2(a) Right-click on the Navigator pane and select New/Project...
Figure 5.4:
Bring up the New Project wizard by right-clicking on the Navigator.
Use the New Project wizard to select the type of project you are creating. For more complex projects, you may be asked for more information, but for a basic Java project, it's pretty simple.
q 5.2(b) Select Java on the left, select Java Project on the right, and click Next.
Figure 5.5:
Select Java and Java Project and click Next.
Enter the
q 5.2(c) Type in 'Hello' and click Finish.
Figure 5.6:
Finish the wizard by entering the name and clicking Finish.
A prompt will come up, asking you if you want to switch perspectives. Click the "Don't show me this message again" box and then click Yes.
q 5.2(d) Check 'Do not show this message again' and click Yes.
Figure 5.7:
Make sure "Do not show this message again" is checked, then click Yes.
You should notice a couple of things. First, a new Hello project is shown in the left-hand pane. If you examine the title bar, you'll see that you're no longer in the Resource perspective but have been switched to the Java perspective. Notice also that the Outline pane has moved from the lower left of the workbench to the upper right. Finally, you'll see that a new icon has appeared in the perspective bar on the left of the workbench, and that new icon (the Java perspective icon) is selected.
Now, take a look at the contents of the newly created Hello project.
q 5.2(e) Expand the Hello project.
Figure 5.8:
Click on the plus sign to expand the Hello project.
You'll see that the project doesn't contain much. However, it isn't quite empty, either. This is how Eclipse plug-ins work; they can preload your projects with things that are needed. If you decide to build your own plug-ins, you'll be able to do the same thing, and customize the projects
It's difficult to see the full name of the JAR file because of the
Figure 5.9:
The Hello project is nearly empty, but not quite ” A JAR file has been added by default.
q 5.2(f) Roll your cursor over the runtime JAR file.
Figure 5.10:
Rolling your mouse pointer over the JAR file shows its full name in a tool tip.
When you roll your cursor over the JAR file, the full file name shows up in a tool tip. This JAR file was selected when you installed Eclipse. As with so many other things in Eclipse, you can change this default by going into the Preferences (use the Window/Preferences option from the main menubar). For this course, the default is fine.
Before going on, collapse the project again. It's a little exercise, and it makes the display a little less cluttered.
q 5.2(g) Collapse the project.
Figure 5.11:
Click on the minus sign to collapse the Hello project.
[1]
The PDE adds several other project types, but you don't have to worry about those in this book. When you create a new Java Project, Eclipse will automatically switch to the appropriate perspective, which happens to be the Java perspective, the one we'll be