To create a transformation, you must create an Eclipse
plug-in that contains an instance of the transformation provider extension
point and a transformation provider.
Procedure
- Create an Eclipse plug-in:
- Click .
- On the Select a wizard page, in the Wizards pane,
expand Transformation Authoring, and click Generic
Transformation Project.
- Click Next.
- In the New Plug-in Project wizard, on the Plug-in Project
page, in the Project name field, specify a
project name. If you specify a name that contains spaces, in the remaining
pages of the wizard, the spaces are converted to underscores in the
plug-in identifier (ID) and plug-in name. Accept the default values
for the other fields on this page and click Next.
- On the Plug-in Content page, specify
the structure of the project and click Next. The information that you specify on this page is used
to customize the plug-in manifest file and the top-level Java™ class in the plug-in.
- On the Templates page, if it is not selected already, select
the Create a plug-in using one of the templates check
box.
- In the Available Templates pane, click Plug-in
with Transformation and click Next.
- On the New Transformation Provider page,
create a transformation provider:
- In the Package field, accept
the default value, or specify the name of the package that contains
the implementation of the abstract transformation provider class.
- In the Class field, accept the
default value, or specify the name of the class that implements the
abstract transformation provider class.
Note: For more information about the other
fields on this page and the remaining pages in the wizard, see the
context-sensitive help by pressing F1 when
that page is displayed in the product. If you are using the Linux platform,
for more information about the other fields on this page and the remaining
pages in the wizard, see the context-sensitive help by pressing Shift+F1 when
that page is displayed in the product.
- Click Next.
- On the New Transformation page, complete
the following steps:
- To create a Transformation element and to register this transformation
with the transformation service, accept the default values or specify
values for the following fields:
- ID
- Name
- Class
- Source model type. To change the model
type, click the ellipsis button (...).
- Target model type. To change the model
type, click the ellipsis button (...).
- Group path
- Version
- Optional: To define the transformation properties
that refine the transformation output, beside the Properties table,
click Insert and specify values for the fields
in the table. The next time that you create a transformation configuration
for this transformation, the properties that you define are displayed
on the Properties page the New Transformation
configuration wizard or in the transformation configuration editor.
Note: To
specify transformation properties at a later time, you must edit the
plug-in manifest file.
- Optional: To delete a transformation property,
click a row in the Properties table and click Delete.
- Optional: To create transformation rules, verify
that the Use default UML2 transformation framework check
box is selected. If you clear this check box, the New Rule Definition
page is not available in the wizard.
Note: To add a rule to the transformation
at a later time, you must manually create a Java class
that extends the com.ibm.xtools.transform.core.AbstractRule class,
customize the code in the class, and add an instance of the rule to
the Java file that contains the transformation implementation.
- Click Next.
- Optional: On the New Rule Definitions page,
specify the rules of the transformation:
- To add a rule to the transformation, click Insert and
specify values for the fields in the table.
- To delete a rule, click a rule in the table and click Delete.
- Click Finish.
Results
An Eclipse plug-in project that contains the following artifacts
is created in the workspace:
- A src/n/transformationProvider folder,
where n is the project name, that contains a Java implementation for a transformation provider
and a transformation
- A src/n/m.rules folder,
where m is the name of the transformation, that
contains an implementation for each transformation rule or extractor
that you define
- A plug-in manifest file that defines the plug-in dependencies
and defines the following elements:
- A com.ibm.xtools.transform.core.transformationProviders extension
point
- A TransformationProvider and Transformation element
- A Property element for each property that you define
The transformation that you specify in this plug-in is registered
automatically with the transformation service.
For more information
about the elements described in this topic, see the
Rational® Transformation
Developer Guide.
Note: Some information, such as links to Eclipse
documentation or to developer guides, is available only from the help
topics that are installed with the product.