As you create more projects like Ch01_01 , you'll find Eclipse getting more and more crowded, since all your projects are displayed in the Java perspective's Package Explorer view, as well as the Navigator view (recall that the Navigator view is there to let you navigate between projects). If you have 30 projects, there will be 30 entries there. There are various ways to deal with this clutter (such as creating working sets, as we'll see in Chapter 2), but we'll take a look at the simplest one here.
To remove a project from the Package Explorer and Navigator views, you can simply delete it. This does not necessarily delete the actual files used for the project, and, whenever you want, you can add the project back to these views. For example, to remove the Ch01_01 project, just right-click its icon and select the Delete item. Eclipse will display the Confirm Project Delete dialog box, as you see in Figure 1-20.
Figure 1-20. Deleting a project
In this case, make sure that the "Do not delete contents" radio button is selected and click Yes to remove the project from Eclipse. The project will disappear from the Package Explorer and Navigator views. Clicking the other radio button will make Eclipse delete all the files and their contents in the project, so don't do that if you want to use the project again later.
When you want to work with the project again, you just import it. To do that, right-click the Package Explorer or Navigator and select the Import context menu item, or select the File Import menu item. This opens the Import dialog; select the "Existing Project into Workspace" item and click Next. In the next pane, click the Browse button, select the Ch01_01 folder, and click OK, giving you results like those shown in Figure 1-21.
Figure 1-21. Importing a project
Click Finish to import the Ch01_01 project again. Now the project is back and ready for use. To run it, select the project in the Package Explorer and select the Run Run As Java Application menu item. That's all you need; this is a crude but effective way of doing project management, and we'll see others as we progress.
| || |
You can also close projects if you right-click them and select the Close Project menu item. However, that doesn't remove them from the Package Explorer and Navigator viewsit just closes the project folder and changes its icon. The only real benefit of closing projects is that it will allow Eclipse to start up a little faster later because it doesn't have to initialize closed projects.
That's it for this chapter. We got our start working with Eclipse here, and we're coming up to speed. In the next chapter, we're going to get into more depth on Java development and the JDT.