The plug-in class

So far, we've been looking at the different extensions that are provided by the readme tool. Let's look at the general definition of the readme tool plug-in.

Plug-in definition

The readme tool plug-in is defined at the top of the plugin.xml file.

   
<plugin
   name = "%Plugin.name"
   id = "org.eclipse.ui.examples.readmetool"
   version = "2.0.0"
   provider-name = "%Plugin.providerName"
   class="org.eclipse.ui.examples.readmetool.ReadmePlugin">

   <requires>
      <import plugin="org.eclipse.ui"/>
      <import plugin="org.eclipse.core.resources"/>
   </requires>

   <runtime>
     <library name="readmetool.jar"/> 
   </runtime>
   ...

The plug-in definition includes the name, id, version, and provider name of the plug-in. We saw most of these parameters before in our hello world plug-in. The readme tool also defines a specialized plug-in class, ReadmePlugin.

The workbench UI and resources plug-ins are listed as required plug-ins, which informs the platform of the readme tool's dependencies.

Finally, the name of the jar file is provided. File names specified in a plugin.xml file are relative to the plug-in's directory.

AbstractUIPlugin

The ReadmePlugin class represents the readme tool plug-in and manages the life cycle of the plug-in.  As we saw in the Hello World example, you don't have to specify a plug-in class.  The platform will provide one for you.  In this case, our plug-in needs to initialize UI related data when it starts up.  The platform class AbstractUIPlugin provides a structure for managing UI resources and is extended by ReadmePlugin.

AbstractUIPlugin uses the generic startup and shutdown methods to manage images, dialog settings, and a preference store during the lifetime of the plug-in.  We'll look at the specifics of the ReadmePlugin class when we work with dialogs and preferences.

Copyright IBM Corporation and others 2000, 2003.