Creating a plug-in project
by, 11-17-2011 at 07:38 PM (900 Views)
In this post, I will show you step by step how to create a plugin project.
To create a plug-in project, bring up the New Plug-in Project creation wizard via File > New > Plug-in Project.
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.
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.
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: