Running transformation extensions

To run a transformation extension, you must run the target transformation. You can run a target transformation by applying a transformation configuration, by using command-line syntax, or by invoking the transformation API in application source code.
To run a transformation, complete the steps for one of the options in the following table:
Option Description
Apply a transformation configuration Depending on the view that you are in, complete one of the following steps:
  • In the navigation view, right-click a transformation configuration (.tc) file; then click Transform and click a transformation. When you apply a transformation configuration, an instance of the transformation is created and the transformation runs with the properties that the configuration defines.
  • In the Pattern Explorer view, right-click a transformation; then click Run Transformation. In the Select configuration dialog box, specify the transformation configuration to run, and click OK.
Override the source that is defined in a transformation configuration In the Modeling perspective, select and right-click elements in the source model or project; then click Transform, click a transformation configuration, and click a transformation. The source that you specify in the transformation configuration file is not affected.
Specify the command-line syntax To run a transformation from a command line, use the following syntax:
eclipse -data workspace-path -application com.ibm.xtools.transform.core.transformationRunner -transformConfigs "[-R]transformation-configuration-path1,[-R]transformation-configuration-path2,..." 

In the -transformConfigs parameter, you must specify the complete workspace path and configuration file name, not the file-system path name, of one or more transformation configurations.

Running a transformation from a command line suppresses all dialog boxes that the transformation generates.

As an example, a transformation configuration called MyConfig.tc is in a project called MyProject in a workspace called MyWorkspace. This transformation configuration specifies the configuration information for a transformation called MyTransformation, and for a corresponding reverse transformation called MyReverseTransformation.
  • To invoke MyTransformation, you can run the MyConfig.tc configuration by typing the following text at the command line:
    eclipse -data /MyWorkspace -application com.ibm.xtools.transform.core.transformationRunner -transformConfigs "MyProject/MyConfig.tc"  
  • To run the reverse transformation, specify the -R option at the beginning of the transformation configuration path, as in this example:
    eclipse -data /MyWorkspace -application com.ibm.xtools.transform.core.transformationRunner -transformConfigs "-RMyProject/MyConfig.tc"
  • To run multiple transformations, in the -transformConfigs parameter, specify a comma-separated list of transformation configurations, including the workspace path name for each configuration. You can run forward or reverse transformations, as in this example:
    eclipse -data /MyWorkspace -application com.ibm.xtools.transform.core.transformationRunner -transformConfigs "MyProject/MyConfig.tc, -RMyProject/MyConfig.tc"
Invoke the transformation API To run the transformation as part of an application, you can invoke the transformation API, as in the following example:
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("/MyWorkspace/MyConfig.tc"));
try {
			ITransformConfig config = TransformConfigUtil.loadConfiguration(file);
			IStatus status = TransformController.getInstance().execute(config, null, false, null);
}
catch (IOException e) {
// The config file could not be read.
}

Feedback