3.5. Plug-in Model
When Eclipse first launches, it scans each of the plug-in directories and builds an internal model representing every plug-in it finds. This occurs by scanning each plug-in manifest without loading the plug-ins. The methods in the next two subsections are useful if you want to display information about plug-ins or perform operations based on specific plug-in characteristics without taking the time and memory usage hit associated with loading plug-ins.
The org.eclipse.core.runtime.Platform class provides information about the currently executing Eclipse environment. Using this class, you can obtain information about installed plug-ins (also known as Bundles), extensions, extension points, command line arguments, job manager (see Section 20.8, Background TasksJobs API, on page 739), installation location, and more.
The following are some methods of note.
Information about the currently installed plug-ins, also known as Bundles, can be obtained using Platform.getBundleGroupProviders() or Platform.getBundle(String). Accessing a plug-in class, also known as a bundle activator, requires the containing plug-in to be loaded whereas interacting with the Bundle interface does not carry such a penalty. If you already have a plug-in class, such as the Favorites plug-in, then you can obtain the Bundle interface for that plug-in by using something like this:
The plug-in version number can be obtained using the getHeaders() method.
new PluginVersionIdentifier( bundle.getHeaders().get("Bundle-Version"))
You can access the plug-in extension registry using the Plaform.getExtensionRegistry() method. It contains plug-in descriptors, each representing a plug-in. The registry provides the following methods for extracting information about the various plug-ins without loading them (see Section 17.1, The Extension Point Mechanism, on page 595 for information on creating extension points).
Previously, extensions and extension-points did not change during execution, but that is slowly changing as the Eclipse plug-in model continues to align itself with OSGi. If you are interested in changes during execution, use addRegistryChangeListener(IRegistryChangeListener).
For more on the plug-in registry, activation, and lifecycle, check out the Equinox project at www.eclipse.org/equinox.