Setup instructions for a model-to-model transformation that specifies a project as its source

To run the transformation, you must import the transformation plug-in into your workspace, start the runtime workbench, import the UML test project, and then invoke the transformation.

Import the sample

Procedure

  1. On the sample overview page, click Import the sample.
  2. In the Sample Model-to-Model Transformations wizard, in the Project Name field, specify a name for the sample project.
  3. Click Finish.
  4. If you are prompted to switch to the Plug-in Development perspective, click OK. The wizard creates the new project in your workspace. The Package Explorer view displays the new plug-in project. You can now browse the sample transformation mapping model and transformation source code.

Results

The imported plug-in contains the following items:
  • In the models folder, a transformation mapping model named project4source.mapping
  • In the src folder, the transformation source code that is generated from the mapping model
  • In the Project4sourceTransformationValidator, Project4sourceTransformationProvider, and Model2ModelTransform classes, modifications to the generated transformation source code

Import test projects into the runtime workbench

Procedure

  1. Start the runtime workbench.
  2. Click Help > Help Contents.
  3. On the Contents page, click Samples > Technology samples > UML models > Model-to-model transformation that specifies a project as its source.
  4. On the sample overview page, click Import the test source project.
  5. In the Sample Transformations Test Project import wizard, in the Project Name field, specify a name for the test project.
  6. Click Finish.
  7. If you are prompted to switch to the Modeling perspective, click OK. The wizard creates the new project in your workspace. The Package Explorer view displays the new plug-in project. You can now browse the test models.
  8. On the sample overview page, click Import the test target project.
  9. In the Sample Transformations Test Project import wizard, in the Project Name field, specify a name for the test project.
  10. Click Finish. The Package Explorer view displays the new plug-in project. You can now browse the transformation configuration file, which has .tc as a file name extension. For this sample, the target test model is empty.

Run the transformation in a runtime workbench

Procedure

  1. In the Package Explorer view, double-click the transformation configuration file named runtest.tc.
  2. Optional: If you specified a project name other than the default name in step 5, you must update the paths to the source and target models.
  3. In the transformation configuration editor, on the Source and Target tab, complete the following steps:
    1. In the Source pane, click the test source project.
    2. In the Target pane, click the target model in the test target project.
  4. Click File > Save.
  5. On the Main tab of the transformation configuration editor, click Run. The transformation completes the following steps:
    • It copies elements from each model in the source project to a separate package in the target model. This sample transformation supports only a subset of UML elements. The target package in the target model has the same name as the contributing source model.
    • It renames the target model to the name of the source project.

Feedback