Model-to-text transformation sample setup instructions

To run the transformations, you must import the plug-in into your workspace, start the run-time workbench, and invoke the transformations.


Importing the sample transformations

To import the sample:

  1. On the Model-to-text transformation sample overview page, click Import the sample.
  2. In the Sample Model-to-Text 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.
  5. The wizard creates the new project in your workspace.

The imported plug-in contains three transformations:

  1. Class to Text -> Console
  2. Class to Text -> File
  3. State to JSP


Running the sample transformations

Running the Class to Text -> Console transformation

To run the transformation:

  1. Start the run-time workbench.
  2. In the run-time workbench, create a UML model that contains a package with one or more classes.
  3. Switch to the Modeling perspective.
  4. Right-click a class, package, or the model; then click Transform > Run Transformation > Class to Text -> Console.
  5. In the Run Transform window, click Run.

The transform results are displayed in the Console view where the sample is imported and not in the Console view of the run-time workbench.


Running the Class to Text -> File transformation

To run the transformation:

  1. Start the run-time workbench.
  2. In the run-time workbench, create a UML model that contains a package with one or more classes.
  3. Switch to the Modeling perspective.
  4. Right-click a class, package, or the model; then click Transform > Run Transformation > Class to Text -> File.
  5. In the Run Transform window, on the Target page, specify the project in which to write the output file for the transformation.
  6. Click Run.

By default, the transformation stores the results in an output file named class2text.txt, in a folder named ClassToTextOutput. To view the file open a Navigator view, if it is not already opened.

To specify a different name for the output file, in the Run Transform window, click the Properties tab. On the Properties page, in the Target File Name field, specify a new name and click Apply.


Running the State to JSP Transformation

To run the transformation:

  1. Start the run-time workbench.
  2. In the run-time workbench, create a UML model that contains a state machine. Add a few states and transitions between the states to the state machine.
  3. Apply the ScreenFlow profile to the model.
  4. Mark up one or more states by applying a stereotype from the ScreenFlow profile to each.
  5. Set the values of the stereotype attributes.
  6. Switch to the Modeling perspective.
  7. Right-click a state, region, or the state machine; then click Transform > Run Transformation > State to Jsp.
  8. In the Run Transform window, on the Target page specify the project in which to write the output JSP files.
  9. Click Run.

The transformation generates the JSP files and places them in the specified project in a folder named web. To view the file open a Navigator view, if it is not already opened.

The State to JSP transformation does not overwrite the JSP files that already exist. To overwrite existing JSP files, in the Run Transform window click the Properties tab. On the Properties page, set the Overwrite Output Files property to true.