You can create transformation properties in Eclipse plug-ins that
contain model-to-model transformations. Transformation properties refine the
output that a transformation generates. You can specify values for these properties
when you create or edit a transformation configuration.
You must have
a plug-in manifest file open in the manifest editor. The
manifest file must contain an instance of the transformation provider extension
point, a transformation provider element, and a transformation.
To create a transformation property:
- In the plug-in manifest editor, on the Extensions tab,
expand com.ibm.xtools.transform.core.transformationProviders,
expand the appropriate TransformationProvider element, right-click the Transformation
element to which you want to add a property; then click .
Note: You can also
create a transformation property by clicking the Transformation element and
clicking Edit. In the Transformation Authoring wizard,
on the New Transformation page, in the Properties table, click Insert,
and specify values for the columns in the table. To delete a property, click
a row in the Properties table and click Delete.
- In the plug-in manifest editor, on the Extensions tab,
in the Extension Element Details area, in the name field,
specify a name that enables you to recognize the property.
Tip: For more information about the fields in the Extension Element
Details area, place the mouse pointer over the name to display hover help.
- In the Extension Element Details area, in the id field,
specify a unique identifier for the property. This value should be unique
within the transformation. You should specify an identifier that follows this
naming convention: x.y, where x represents
the name of the transformation, and y represents the name
of the property.
- Optional: Specify additional information about the
property. For example, in the metatype field, specify
the type of the property. For example, to create a property of type String
that has a maximum length of three characters, specify the following values:
- In the metatype field, type String.
- In the metatypeData field, type maxLength=3.
- Click .
A Property element is created in the plug-in manifest
file. The new property is displayed on the Properties page of the New Transformation
Configuration wizard or the transformation configuration editor the next time
that you create or edit a transformation configuration. You
can retrieve the information about the property by calling the methods in
the ITransformationProperty interface. The methods in this interface extract
the value and metadata of a transformation property. If you extract the underlying
metatype data for the property value by using the getMetatypeData method,
to validate the property value you can specify application code to parse the
String that this method returns. For information about how to retrieve the
values for custom properties, see the link to the Javadoc HTML documentation
for the ITransformationProperty class in the Related information section below.
For example, to create a String property called
My String Property that has a maximum length of three characters, in the plug-in
manifest editor, on the
Extensions tab, in the Extension
Element Details area, specify the following values:
- In the name field, type %MyNewPropertyName
- In the id field, type MyNewPropertyName
- In the metatype field, type String
- In the metatypeData field, type maxLength=3
In the plugin.properties file, add the following line to assign a
value to the %MyNewPropertyName variable:
MyNewPropertyName=My String Property
Note: If you create a new plug-in by using the
Plug-in with Transformation template, you can specify this information on
the New Transformation page of the Transformation Authoring wizard.