Using extension point schema

Extension points defined by the plug-ins in your workspace are readily available to your own plug-in and other plug-ins. If an extension point schema has been defined for it, PDE can provide assistance when creating new extensions. This assistance includes:

Example: Using the "Sample Parsers" extension point

Before trying to use the extension point we defined before, we still need to define the expected interface. Select the com.example.xyz project in the Navigator and press the "Create a Java interface" tool bar button.  Be sure to set the package name to com.example.xyz and interface name to IParser before pressing Finish.  Edit the interface to look like this:

   package com.example.xyz;

   public interface IParser {
      /**
       * Run the parser using the provided mode
       */
      public void parse(int mode);
   }

We now have the extension point, an XML schema for it, and the required interface. Be sure to save all of your open editors.  Everything is now ready for our own plug-in or other plug-ins to contribute to the extension point.

  1. Open the manifest editor for the com.example.xyz plug-in.
  2. Switch to the Extensions page and press New->Schema-based Extensions.
  3. You should have "Sample Parsers" available as a choice. Select it and press Finish.
  4. Select the newly added "Sample Parsers" element and popup the New->parser menu. (We specified that our extension point can accommodate any number of  "parser" elements.)
  5. Select the new element and go to the Properties view. It should show four attributes: id, name, class and mode. Note how the status line shows the short information about attributes as you select them. This information comes directly from the extension point schema.
  6. Change the name to "Default Parser". Change the mode to "manual." 
  7. Select the class attribute. This property cannot be edited directly.  Open the properties dialog.
  8. Choose to create a new class. Select "XYZ Plugin" as the source folder, com.example.xyz as the package and DefaultParser as the class name. Press Finish.
  9. You should now be in the Java editor for the DefaultParser class. Notice how it has implemented the right interface (IParser) and already has the stub implementation of the "parse" method.

As you can see, when you provide a complete XML schema for your extension point, it will help all your potential users by letting PDE to assist them and prevent them from making errors.

Restriction choices appearing as choices in the property sheet cell editor

 
Copyright IBM Corporation and others 2000, 2003