2.2 Creating a Plug-in Project
The first step is to create a plug-in project using the Eclipse New Project wizard. In addition to creating a new project, this wizard has a number of different code generation options, such as views, editors, and actions, for creating sample plug-in code. To keep things simple and focus only on the essentials of plug-in creation, select the Plug-in with a view option, which is discussed in the next subsection.
2.2.1 New Plug-in Project wizard
From the File menu, select New > Project to launch the New Project wizard (see Figure 2-1). On this first page of the wizard, select Plug-in Project from the list and then click the Next button.
Figure 2-1 New Project wizard page 1—selecting a project type.
On the next page of the wizard (see Figure 2-2), enter the name of the project; in this case, it’s com.qualityeclipse.favorites, which is the same as the Favorites plug-in identifier. Chapter 3, Eclipse Infrastructure, discusses plug-in identifiers and other aspects of plug-in architecture in more detail. Fill in the other fields as shown and then click the Next button.
Figure 2-2 New Project wizard page 2—naming the project..
2.2.2 Define the plug-in
Every plug-in has a META-INF/MANIFEST.MF file. In addition, it may contain a plugin.xml file and/or a Java class that represents the plug-in programmatically. The next wizard page displays options for generating both the plug-in manifest and plug-in Java class. Supply the Plug-in ID, Plug-in Version, Plug-in Name and more for the plug-in as shown in Figure 2-3 then click the Next button.
Figure 2-3 New Project wizard page 3—describing the plug-in.
Next, the New Plug-in Project wizard next displays the various plug-in pieces that can be automatically generated by the wizard (see Figure 2-4). There are many different options on this page for generating quite a bit of sample code. It is useful to try out each option and review the code that is generated; however for this example, select Plug-in with a view and then click the Next button.
Figure 2-4 New Plug-in Project wizard page 4—selecting a plug-in type.
2.2.3 Define the view
Selecting view code generation options is the next step in this process. Enter the values for this page (see Figure 2-5), uncheck the Add the view to the resource perspective and Add context help to the view (Eclipse 3.4 only) checkboxes to simplify the generated plug-in manifest file.
Figure 2-5 New Plug-in Project wizard page 5—defining the view.
If you are in Eclipse 3.3, then click the Next button and uncheck each of the code generation options (see Figure 2-6). Each of these checkboxes represents code that could be generated as part of the Favorites view. These are covered in subsequent chapters. This wizard page has been removed in Eclipse 3.4 and thus the FavoritesView class generated by the wizard will contain more code than is shown in the book (see Section 2.3.3, The Favorites view, on page 84).
Figure 2-6 New Plug-in Project wizard page 6—code generation options for the view (Eclipse 3.3 only)
When you click the Finish button, the new plug-in project is created and the plug-in manifest editor is automatically opened (see Figure 2-9).