You can create capabilities to which you can bind transformations.
You should create capabilities in a different plug-in from the transformations
that you create. You can bind more than one transformation to a capability.
This functionality enables you to show or hide the transformations in the
list of available transformations in the New Transformation Configuration
wizard or on transformation pop-up menus.
Before you begin
You must know the plug-in name and the transformation ID of the transformation
that you are binding to the capability.
About this task
In addition to creating capabilities, you can create new capability
categories, which are groupings of capabilities. For example, you might create
a capability category that contains a capability for each model-to-model transformation
that you write.
You can also create capabilities for the language-specific
transformations in the IBM® Rational® modeling products.
To
create a capability to show or hide a transformation:
Procedure
- Create a plug-in project.
- In the navigation view, double-click the plug-in manifest file
and, in the plug-in manifest editor, on the Extensions page, add an extension
point named org.eclipse.ui.activities that defines the items
in the following table:
| Item |
Description |
| Name and description of the capability |
Specify this information in the <activity> element. |
| Name and description of the capability category |
Specify this information in the <category> element. You
can create multiple capability categories.
|
| Relationship between each capability and the capability
category |
Specify this information in the <categoryActivityBinding> element. |
| Pattern or transformation that is associated with a
capability |
Specify this information in the <activityPatternBinding> element. You
can bind a transformation to multiple capabilities.
The pattern attribute
must specify the transformation plug-in name and identifier in the following
format: x/y, where x represents
the transformation plug-in name and y represents the transformation
identifier.
You can bind multiple transformations to a capability by
specifying a regular expression in the pattern attribute,
as in this example: com.myCompany.myPlugin/com.myCompany.*
|
- Click .
- Compile the plug-in.
- Test the plug-in. For example, you might test the plug-in in a
separate instance of an Eclipse workbench.
- Deploy the plug-in.
Results
The new capability category and its capabilities are displayed in
the Capabilities pane the next time that you click .
Example
The following example creates a capability category called "My
transformations," two capabilities, and a binding between the transformations
and the appropriate capability. In this example, you create a capability for
a custom UML-to-Java transformation and a capability for a group of model-to-model
transformations.
<extension point="org.eclipse.ui.activities">
<activity description="This capability references the transformation called MyUMLToJavaTransformation." id="myCapability.activity1" name="My UML-to-Java transformation">
</activity>
<activity description="This capability references my model-to-model transformations." id="myCapability.activity2" name="My model-to-model transformations">
</activity>
<category id="myCapability.category1" description="My transformations" name="My transformations">
</category>
<categoryActivityBinding activityId="myCapability.activity1" categoryId="myCapability.category1">
</categoryActivityBinding>
<categoryActivityBinding activityId="myCapability.activity2" categoryId="myCapability.category1">
</categoryActivityBinding>
<activityPatternBinding activityId="myCapability.activity1" pattern="com\.myCompany\.myPlugin/com\.myCompany\.myTransformation\.MyUMLToJavaTransformationIdentifier">
</activityPatternBinding>
<activityPatternBinding activityId="myCapability.activity2" pattern="com\.myCompany\.myPlugin/com\.myCompany\.myTransformation\.modeltomodel.*">
</activityPatternBinding>
</extension>