Creating the plug-in project

You can use any Java IDE you wish to build Eclipse plug-ins, but of course the Eclipse SDK provides tooling specific for plug-in development. We'll walk through the steps for building our plug-in with the Eclipse SDK, since this is the typical case. If you are not already familiar with the Eclipse workbench and the Java IDE, consult the Java development user guide or PDE guide for further explanations of the steps we are taking. For now we are focusing on the code, not the tool; however, there are some IDE logistics for getting started.

Creating your plug-in project

You will need to create a project that contains your work. We'll take advantage of some of the code-generation facilities of the Plug-in Development Environment (PDE) to give us a template to start from. This will set up the project for writing Java code and generate the default plug-in manifest files (explained in a moment) and a class to hold our view.

  1. Open the New Project... wizard (command link File > New > Project...) and choose Plug-in Project from the Plug-in Development category and click Next.
  2. On the Plug-in Project page, use com.example.helloworld as the name for your project and check the box for Create a Java project (this should be the default). Leave the other settings on the page with their default settings and then click Next to accept the default plug-in project structure.
  3. On the Plug-in Content page, look at the default settings. The wizard sets com.example.helloworld as the id of the plug-in.  The wizard will also generate a plug-in class for your plug-in and allow you to supply additional information about contributing to the UI. These defaults are acceptable, so click Next.
  4. On the Templates page, check the box for Create a plug-in using one of the templates. Then select the Plug-in with a view template. Click Next.
  5. We want to create a minimal plug-in, so at this point we need to change the default settings to keep things as simple as possible. On the Main View Settings page, change the suggested defaults as follows: Plug-in view settings
  6. On the View Features page, uncheck all of the boxes so that no extra features are generated for the plug-in. Click Finish to create the project and the plug-in skeleton.
  7. When asked if you would like to switch to the Plug-in Development perspective, answer Yes.
  8. Navigate to your new project and examine its contents.

The skeleton project structure includes several folders, files, and a Java package. The important files at this stage are the plugin.xml and MANIFEST.MF (manifest) files and the Java source code for your plug-in. We'll start by looking at the implementation for a view and then examine the manifest files.