|
Get Acquainted with Eclipse Plug-Ins
Discover Eclipse plug-ins. Begin by learning how to create one, archive it for installation, and debug it
by Kevin Jones
June 27, 2005
You often hear Eclipse described as a "platform" rather than as an IDE. What does this mean? Eclipse consists of two major parts: the core and the plug-ins. The job of the core part of Eclipse is to load the Eclipse runtime and then load all the plug-ins that are specified by the user, which means that nearly all of the functionality in Eclipse is provided in the form of plug-ins.
Why does this architecture make it a platform? You can remove all the plug-ins that make Eclipse an IDE and replace them with plug-ins for any other application you need, so Eclipse becomes the platform for other tools. Let's take a look at plug-in development within Eclipse.
In this and future columns we will develop a plug-in, and we will use Eclipse 3.1 to develop it. Subsequent code should work in Eclipse 3.0, but some of the dialogs shown in examples will be different. The reason for choosing 3.1 is that by the time you read this column, 3.1 will be shipping (or at least it will very nearly be shipping); certainly by the time we get a full, working plug-in 3.1 will be available.
Creating a plug-in in Eclipse is relatively straightforward, as Eclipse has a plug-in project wizard. The plug-in we'll create will be for a JDBC table viewer, which will let you run ad-hoc queries against any JDBC-supported database and display the results in tabular format. To create this plug-in project, open Eclipse, select File | New | Project, and then select Next in the Plug-in Project dialog. Enter the project name. Each plug-in has an identifier that you will enter shortly.
If you look in your <<ECLIPSE HOME>>/plugins directory you will see a number of directories with names like org.apache.ant_xxx and org.eclipse.core.boot_xxxx. The first part of these names, up to the "_," is the plug-in ID. By convention the name of the project should match the identifier of the plug-in, so we should give the project a reasonable name. For the viewer enter the project name com.develop.kevinj.jdbcviewer. I generally change the output folder name to "classes," but this is a personal preference.
Select Next to open the Plug-in Content dialog. This dialog allows you to provide information to describe the plug-in. You can accept the defaults, but you may want to change the values for Plug-in name and Plug-in provider. For the JDBC Viewer I chose the name Jdbcviewer Plug-in and Developmentor for the provider. You can change these names later if you get bored with them.
Back to top
|