Step 4.2: Create a project


Step 4.2: Create a project

click to expand

After having closed the Welcome panel in step 4.1, your workbench should look like the one shown in Figure 4.3.

click to expand
Figure 4.3: The empty workbench with no Welcome panel.

Now you need to create a project. Most resource-oriented tasks are done with a Navigator view. The Navigator view is typically in the upper left pane of the perspective, and it shows all the resources in your project grouped in a logical way.

The more specific your perspective is, the more it knows about your resources and the more it can manage your views. The Navigator view in the Resource perspective knows almost nothing about the resources; it knows only projects, folders, and files. So when you create a project and resources, that's really all you'll be doing: creating folders and files. But first, let's create a project.

q 4.2(a) Position your cursor in the Navigator pane and right-click.

click to expand
Figure 4.4: Right-click in the Navigator pane.

This is the typical manner of bringing up a context-sensitive menu. Move your cursor into a panel (either a view or an editor) and right-click. Each panel has its own context-sensitive menu (or none).

In this case, there are no items to click on, so you'll bring up a sort of default menu for that view. If there were one or more items selected in the view, the menu would be contain options relevant to the selected item or items.

q 4.2(b) Select New/Project ...

click to expand
Figure 4.5: Select the New submenu, then the Project... option.

Okay, now I'll go on to the New Project wizard.

The New Project wizard as shown in Figure 4.6 is typical of the many wizards in Eclipse. As mentioned in Step 3, a wizard is a set of one or more panels that walk you through the selections and inputs you need to make to accomplish some task such as the definition of an item. Instead of having to create a project and then modify its attributes, you simply walk through a set of forms that prompt you for all the pertinent information.

click to expand
Figure 4.6: The New Project wizard is a typical wizard.

q 4.2(c) In the left pane, select Simple.

q 4.2(d) In the right pane, select Project.

q 4.2(e) Click the Next > button.

click to expand
Figure 4.7: Select the options to create a "Simple" project.

You probably noticed that there are many other kinds of projects to create besides the Simple project I've told you to build. You'll learn more about other project types in later steps. For now, the Simple project is all you need.

Clicking the Next> button brings up, logically enough, the next panel in the wizard. Normally, a wizard allows you to move back and forth between the various panels by clicking the <Back and Next> buttons . The last page will have a Finish button, which will then execute the action. (Sometimes there will be a Finish button on pages prior to the last, creating a shortcut that bypasses some of the panels.)

q 4.2(f) Type 'Simple Project' in the Project name field and press Finish.

click to expand
Figure 4.8: Type in the project name ("Simple Project") and press the Finish button.

This will create the project. Depending on the speed of your machine, you may or may not be able to read the progress dialog that pops up. On my machine, it's gone so fast that I can't even capture it.

You should now see the screen shown in Figure 4.9.

click to expand
Figure 4.9: Congratulations! You have created a project named Simple Project.

The interesting thing about this is that the project looks as if it already has something in it. The little "plus sign" to the left of the project indicates that an item can be expanded. So let's expand it, shall we?

q 4.2(g) Expand Simple Project by clicking on the plus sign.

click to expand
Figure 4.10: Clicking on the plus sign will expand the project.

And what is this? A file called .project? What could be in there?

click to expand
Figure 4.11: The magically generated project file.

Well, being the curious type of folks we are, we could find out. The easiest way to see the contents of an item are to double-click on it. Let's do that.

q 4.2(h) Double-click on project to open it in the default editor.

click to expand
Figure 4.12: Double-click on the .project file to open it in an editor.

And this is the result:

click to expand
Figure 4.13: The project file turns out to be an XML diocument.

This is something called a project description. This is where Eclipse gets a little bit convoluted, but very powerful. The various elements of the project description are all available within the workbench itself. Therefore, you can now build your own commands to access this information and do your own thing.

Some of the pre-defined features are the buildSpec and natures elements. The build-Spec defines the instructions used to build the project, while the natures element can be used to customize the project in various ways. Both of these are well outside the scope of this particular document; they will be covered in more detail in the book Eclipse Plug-Ins, Step by Step.

Get used to the concept, though, of Eclipse creating XML files under the covers. The more you use Eclipse and the more specific your plug-ins get, the more XML files you will see. For example, the IBM plug-ins that are used for some of their more advanced development tools generate many different kinds of XML files.




Eclipse
Eclipse: Step by Step (Step-by-Step series)
ISBN: 1583470441
EAN: 2147483647
Year: 2003
Pages: 90
Authors: Joe Pluta

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net