![]() | The Java Developer's Guide to Eclipse |
In Chapter 11, Creating Extension Points: How Others Can Extend Your Plug-ins, you learned how to
define new extensions using extension points.
The example defined in project com.ibm.jdg2e.extensionpoint
demonstrates how to write a plug-in that offers the possibility for other plug-ins to extend it. This plug-in defines a common toolbar pulldown,
conceptually similar to the Run > External Tools menu choice:

com.ibm.jdg2e.extensionpoint.test,
shows how to extend the first plug-in.
To run the example,
launch the run-time instance of Eclipse (Run > Run As > Eclipse Application)
from the Plug-in Development perspective.
The contributed menu choices are shown from the toolbar menu pulldown (
).
If you have customized the perspective, you may need to explicitly add the "JDG2E: Tool Actions"
action set (Window > Customize Perspective... > Commands).
As described above, this example is partitioned into two projects. All but the last
class in this table are contained in the com.ibm.jdg2e.extensionpoint project.
| Class (All) | Description |
IToolAction |
Interface that all tool action contributions to the com.ibm.jdg2e.extensionpoint.toolAction
extension point must implement, that is, the class specified in the tool attribute of the <action> tag.
|
HelloWorldToolAction |
Quick test of implementation; action displays an information message. |
ToolActionsPulldownDelegate |
Processes extension point contributions to com.ibm.jdg2e.extensionpoint.toolAction,
handles menu choice selections from the common toolbar pulldown and delegates them to its associate tool action
(IToolAction).
Also registers as a register change listener (Platform.getExtensionRegistry().addRegistryChangeListener(IRegistryChangeListener) to support dynamically
installed plug-ins.
|
ContributedTestToolAction |
Similar to HelloWorldToolAction,
this is contributed by another plug-in, in project
com.ibm.jdg2e.extensionpoint.test. It also displays
an information message, and parses some of the parameters supplied as part of the IConfigurationElement interface.
|
© Copyright International Business Machines Corporation, 2003, 2004. All Rights Reserved.
Code or samples provided herein are provided without warranty of any kind.