Previous Page
Next Page

17.1. The Extension Point Mechanism

Up to this point, we have been discussing extension points as a consumer; now we need to delve into the mechanism behind the curtain so that ultimately you can produce your own extension points for others to consume. Not only will extension points make products more flexible, but also, by carefully exposing specific aspects of your plug-in, you can make your products more flexible and customizable. The goal is to empower your customers to take products and do things that were never envisioned.

Extension points are used throughout Eclipse as a mechanism for loosely coupling chunks of functionality. One plug-in declares an extension point in its plug-in manifest, exposing a minimal set of interfaces and related classes for others to use; other plug-ins declare extensions to that extension point, implementing the appropriate interfaces and referencing or building on the classes provided (see Figure 17-1).

Figure 17-1. Extension point overview.


Each extension point has a unique identifier composed of the plug-in's unique identifier, a period, and a simple identifier containing only alpha-numeric characters and underscores. When declaring an extension point (see Section 17.2.1, Creating an extension point, below), only the simple identifier is used. When declaring an extension to an extension point (see Section 17.5, Using the Extension Point, on page 615), the full identifier for the extension point is used.

Every extension point can have a schema defining how they should be used. Although the schema is not necessary for proper extension point usage, the Eclipse PDE can use the schema for basic automated verification of extensions and automatically generated Javadoc-like documentation for the extension point.

The schema is an XML-formatted file, traditionally having the name <extension-point-id>.exsd and is located in a schema subdirectory of the plug-in's install directory. For example, the extension point schema discussed later in this chapter will be stored in <Eclipse_install_dir>/plugins/ com.qualityeclipse.favorites_1.0.0/schema/favorites.exsd.


Previous Page
Next Page