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:
-
On the
Model-to-text transformation sample overview page, click
Import the sample.
-
In the Sample Model-to-Text Transformations wizard, in the Project Name field,
specify a name for the sample project.
-
Click Finish.
-
If you are prompted to switch to the plug-in development
perspective, click OK.
-
The wizard creates the new project in your workspace.
The imported plug-in contains three transformations:
- Class to Text -> Console
- Class to Text -> File
- State to JSP
Running the sample transformations
Running the Class to Text -> Console transformation
To run the transformation:
- Start the run-time workbench.
-
In the run-time workbench, create a UML model that contains a package
with one or more classes.
- Switch to the Modeling perspective.
-
Right-click a class, package, or the model; then click
Transform > Run Transformation > Class to Text -> Console.
-
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:
- Start the run-time workbench.
-
In the run-time workbench, create a UML model that contains a package
with one or more classes.
- Switch to the Modeling perspective.
-
Right-click a class, package, or the model; then click
Transform > Run Transformation > Class to Text -> File.
-
In the Run Transform window, on the Target page,
specify the project in which to write the output file for the
transformation.
- 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:
- Start the run-time workbench.
-
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.
- Apply the ScreenFlow profile to the model.
-
Mark up one or more states by applying a stereotype from the ScreenFlow profile to each.
-
Set the values of the stereotype attributes.
- Switch to the Modeling perspective.
-
Right-click a state, region, or the state machine; then click
Transform > Run Transformation > State to Jsp.
-
In the Run Transform window, on the Target page specify
the project in which to write the output JSP files.
-
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 .
|