![]() |
< Day Day Up > |
![]() |
13.2 Creating a Java ProjectFor Java programmers, the fundamental Eclipse task is creating a Java project. As you're going to see, the process is (so far) virtually identical to working in Eclipse 2.1. To create a new project, right-click the
Navigator view and selectNew Figure 13-2. Naming the new project![]() This brings up the familiar dialog you see in Figure 13-3, where you can set project settings, such as the source folder and the import and export order—all items we're already familiar with. Click Finish to create the project. Figure 13-3. Setting project options![]() Eclipse 3.0 will ask if you want to switch to the Java perspective; click OK. The new Java perspective looks much like what we've seen before, except that the Tasks view has now been renamed the Problems view, as you see in Figure 13-4. Figure 13-4. The Eclipse 3.0 Java perspective![]()
To create a new class, right-click the
project and select New Figure 13-5. Creating a new class![]() Opening the new Java file in the Java editor reveals some changes—for example, the new shape of the cursor, as you see in Figure 13-6. That's the smart insert cursor, which is covered a little later in this chapter—see Section 13.4.4. Note also the two new buttons in the Outline view—Hide Local Types and Link With Editor. Figure 13-6. Using the Java editor![]() At left in the new JDT editor is the Quick Diff bar, which lets you track differences to particular lines as compared to what's been saved on disk (or, if you configure it, to what's in a CVS repository). To see how Quick Diff works, enter System.out.println("Hello"); in the main method, and save the file (only the Save diskette icon appears in the toolbar now, not the Save All diskette icon). Next, change the line to System.out.println("Hello from Eclipse 3.0"); and let the mouse hover over the Quick Diff bar as you see in Figure 13-7. The original version of the code will appear, and you can restore it by clicking it.
Figure 13-7. Using Quick Diff![]() To run this
code, select Run
Figure 13-8. Running the code![]() That recreates a familiar task for us in Eclipse 3.0, and, as you can see, it works much as we've seen before. Perhaps the biggest change in Version 3.0 is that the Eclipse platform has been broadened for use as a general hosting tool, designed to work with general applications, not just IDEs. Now general applications will be able to populate the menu bar and toolbars, and the assumed data model will no longer be necessarily centered on the workspace. We'll be seeing more on that as Eclipse 3.0 nears launch. There are also specific changes to the various parts of Eclipse—the Eclipse platform itself, the JDT, SWT, and so on—and we'll examine them on a case-by-case basis. |
![]() |
< Day Day Up > |
![]() |