Pluglets
The Fan-In and Model Enumeration pluglet samples provide simple examples of pluglets that highlight a specific utility or API. The Fan-In pluglet sample calculates the fan-in metric for a class. The Model Enumeration pluglet sample lists the contents of a selected class in a model.
- Pluglet
Represents the basic template for pluglets. You have to add the pluglet elements, depending on what you want the pluglet to do.
- Hello World Pluglet
Creates a Hello World pluglet.
- Model Enumeration
Lists the contents of a selected class in a model. It demonstrates basic model examination.
- Replace Text Editor Selection Pluglet
Enables the text editor pluglet.
You can create pluglets to handle routine tasks, and the pluglet functionality offers you an easy way to explore and learn the API offered by the workbench platform and other product extensions. From a workbench perspective your can write the statement Platform.getWorkbench() and gain complete access to the entire workbench and its parts. From a modeling perspective, the UMLModeler class allows you access to a model and its contents.
- Examine the com.ibm.xtools.pluglets.Pluglet class in the API documentation in the online help on extending product functionality. This class includes several convenient helper methods for standard message dialogs, pluglet output, and so on.
- The pluglet.xml file provides visibility to classes you reference and
serves as the class path. It contains references to workbench plug-ins containing
libraries you need. It is patterned exactly after the required tag in a workbench
plug-in manifest, plugin.xml. The default content is:
<pluglets> <require> <import plugin="com.ibm.xtools.pluglets"/> </require> </pluglets>
- Pluglets allow you to quickly create utilities and gain experience with an API. Because there is no pluglet debugger, you will need to write to the console to follow your code execution. Use the pluglet method out.println(…) because System.out.println(…) is not supported.
- If you need debugging support, create a simple plug-in with an action extension to host your code.