Use the debug hierarchy
We will now use debug facilities of MDWorkbench to analyse the flow of the generation:
- Click Window > Preferences and MDWorkbench > Rules Development > Run/Debug
- Select the option Create debug hierarchy and click OK.
- Click Run > Debug Last Launched to launch the generation in debug mode.
- Show the Report view.
- Right-click the file Order.java in this view.
-
Click Open Debug Hierarchy.

The debug hierarchy shows up in an editor.
A debug hierarchy is a tree of nodes, each node representing an evaluated element (template, rule or script):

We will now find the script that generated a part of the file Order.java
:
- Select the node main\JavaSource [Order.java] in the debug hierarchy Debug Nodes section.
- Select the node Result\result in the Properties section.
- Select the text productName in the details pane, bottom part of the Properties section.
- Right-click to open the context menu.
-
Click Find Text in Children Nodes.

The debug hierarchy focus is moved to the node main\JavaSource\declaration\declaration.
This is the script defined on uml21.Parameter whose evaluation produced the text
"String productName"
.
The debug hierarchy is very useful in two situations:
- You want to find the script that generated a part of a file in a complex generation.
- You want to see the flow (debug nodes) of a complex generation to understand how the generator is built.

Inspecting a debug hierarchy