Running and rerunning transformations

You can run a transformation by applying a transformation configuration, by using command-line syntax, or by invoking the transformation API in application source code. You can also run multiple transformation configurations consecutively.

Before you begin

A transformation configuration must exist in the current workspace. Transformation configurations have .tc as a file name extension.

About this task

The following table lists several different methods for running transformations in the Option column and provides the associated procedures for those methods in the Description column.


Complete the steps for one of the options in the following table:
Option Description
Use 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 transformation 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.
Tip: To run this transformation again, click Modeling > Transform > Run Last. The transformation uses the same source elements as when you last ran the transformation.
Run the transformation from the command line To run a transformation from a command line, use the following syntax and enter the command on one line:
eclipse -data workspace-path -application 
-transformConfigs "[-R]transformation-configuration-path1,

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 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 the MyTransformation transformation, you can run the configuration by entering the following command on one line:
    eclipse -data /MyWorkspace -application 
    -transformConfigs "MyProject/"  
  • To run the reverse transformation, specify the -R option at the beginning of the transformation configuration path and enter the command on one line:
    eclipse -data /MyWorkspace -application 
    -transformConfigs "-RMyProject/"
  • To run multiple transformations, in the -transformConfigs parameter, specify a comma-separated list of transformation configurations, including the workspace path name for each configuration. Enter the command on one line. You can run forward or reverse transformations, as in this example:
    eclipse -data /MyWorkspace -application 
    -transformConfigs "MyProject/, -RMyProject/"
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/"));
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.
You can also load a transformation configuration by specifying a URL, as in the following example:
try {
	URL url= new URL(platform:/plugin/myPluginID/;
	ITransformConfig config = TransformConfigUtil.loadConfiguration(url);
	catch (MalformedURLException malURLEx) {
		// Handle exception.
	catch (IOException ioEx) {
		// Handle exception.
You can specify a URL that uses different protocols, as in the following examples:
  • platform:/plugin/myPluginID/
  • jar:file:c:/myFolder/myJar.jar!/
  • file:c:/myFolder/
Run a transformation configuration from an Ant script
To run a transformation from an Ant script or build.xml file, complete the following steps:
  1. In a project in the current workspace, create a file named build.xml.
  2. In the build.xml file, insert the following content:
    <?xml version="1.0" encoding="UTF-8"?>
      <project name="myProject" default="generate" basedir=".">
        <target name="generate">
          <echo>Running transformation 'myProject/' ...</echo>
           < transformConfig="myProject/" 
  3. Replace the myProject variable with the name of your target project and the variable with the name of the transformation configuration file being referenced in that project.
  4. Optional: For transformation types that support a reverse transformation, to run the reverse transformation, set the reverse attribute to true.
    Note: The transformation configuration must implement the Reconciled Modeling design contract management protocol (DCMP).
  5. Right-click the build.xml file; then click Run As > Ant Build.
Run multiple transformation configurations consecutively
You can run multiple transformation configurations consecutively to complete the following tasks:
  • Transform a UML model into code for multiple domains
  • Transform a UML model or elements in the model into different target projects
  • Synchronize the changes between a model and code
For more information about running consecutive configurations, see the link to the related concept topic about transformations and transformation configurations at the end of this topic.

To run multiple transformation configurations consecutively, create and run a transformation configuration for the composite transformation. The configurations to run must already exist in the current workspace.

  1. Click File > New > Other > Transformations > Transformation Configuration; then click Next.
  2. Complete the steps in the New Transformation Configuration wizard:
    1. On the Specify a Configuration Name and Transformation page, specify the details of the configuration.

      To select the composite transformation, in the Transformation section, click General > Composite.

    2. On the Transformation Configurations page, select the transformation configurations to run, and the order in which to run them.

      In the "Selected transformation configurations" table, in the Transformation column, select the forward or the reverse transformation.

    3. Click Finish.
  3. On the Main page of the transformation configuration editor, click Run.