Creating a plug-in project

In the workspace, a plug-in is represented by a single project that encapsulates all the code and resources of the plug-in.

To create a plug-in project, bring up the New Plug-in Project creation wizard via  File > New > Plug-in Project.

Plug-in Project Structure

It is a convention that plug-in project names are the same as plug-in IDs, but they can be different.

The plug-in project can be created in one of two flavors: a Java project or a simple project.  Most plug-ins are meant to contain executable Java code and must therefore be housed in a Java project.  On the other hand, if, for example, you are creating a documentation plug-in, then a simple project will suffice.

A plug-in with an OSGi bundle manifest is the recommended plug-in format. In addition to faster startup and classloading, it allows the plug-in to take advantage to many new runtime capabilities.

Click Next.

plug-in content page

 

 

On the Plug-in Content page, you set the data with which the plugin.xml file will be initialized, including the plug-id, version and name.

The recommended deployed form of a plug-in is to be shipped as a single JAR with all the classes and resources at the root of the JAR. For this format, you may keep the Classpath field empty, or enter '.' (without quotes).

The Plug-in class is a top-level Java class that represents the entire plug-in.  It will be used at runtime to control the plug-in's life cycle, i.e. its implementation will determine what happens when the plug-in starts up or shuts down. 

Click Next.

Plug-in code generators

 

The next page shows the various templates that PDE provides which generate useful content such as views, editors, property pages etc.

In this example, we will create a plug-in with the "Hello, World" template. You can read about the wizard in the area to the right of the wizard list. 

Click Next.

"Sample Action Set" template page

 

The next page will let you customize the sample extension that we are creating.

When you press Finish, the wizard will create the new project, all the specified folders and files, and the initial Java build path. The build path is important for correct compilation of Java classes that are generated. The wizard will also open the plug-in manifest editor.  

After the wizard is finished, the initial project structure should look like this:

Initial plug-in project structure