5.2.1 Generating
MetaEdit+ offers generators
to check,
review or document the design results. Some of the most useful generators are
pre-defined into MetaEdit+ and they can be used to study the design results
independently of the modeling language in use. These language independent
generators are:
| Checkings
to list the objects that have no relationships with other objects (orphans), and
any empty properties in
objects. |
| Dictionary
to print out all the objects with related definitions and documentation (taken
from the documentation field of the
object). |
| Export
graph hierarchy to HTML produces a set of HTML files for web browsers. It
shows the diagram representation of the graph (if any) as a PNG picture with a
clickable image map, and documents the objects in the graph with their
relationships and subgraph links. It will also follow these subgraph structures
and generate respective HTML files for them. For more information on
documentation generation see Section 5.2.2.
|
| Export
graph hierarchy to Word includes the same design information as the above
HTML generator, but produces the file for Microsoft Word. This generator uses a
Word template called metaedit.dot. By
default, this template file is located in the reports sub-directory under
the MetaEdit+ home directory. It specifies the styles, headers, cover page, and
an automatic macro that converts the RTF produced by the generator into a
standard Word document. Diagrams are represented as PNG images in
Word. |
| Export
graph to HTML is similar to hierarchical HTML generator described above but
does not follow the subgraph links, focusing only to the selected graph.
|
| Export
graph to Word is similar to the hierarchical Word generator described above
but does not follow the subgraph links, focusing only to the selected
graph. |
| Metrics
to calculate and report various metrics data such as total number of objects and
relationships, number of objects per type and number of relationships per type
from the selected graph and its
subgraphs. |
| Object
Connections to show how different objects are related to each
other. |
| Object
List to describe all the objects included in the
graphs. |
| Object
Nesting to get information whether there are objects in a diagram that
graphically overlap each other (please note that each object is counted only
once using its oldest instance, i.e. reused versions of objects are not
counted). |
| Property
List to describe all the properties of the
objects. |
| XML
to export the contents of a graph as a naive XML file, including objects within
the graph with their properties. |
In addition
to these modeling language-independent generators, most example languages in
MetaEdit+ provide their own specific generators. Examples of these generators
are ‘Autobuild’ in WatchFamily graphs and ‘C state
machine’ in WatchApplication. Similarly, all code generators are specific
to a given modeling language and programming language (see Section
5.2.3).
Executing a generator
To execute a generator:
1) | Select
a graph (e.g. ‘WatchModels’) in the Graph Browser in the Launcher.
|
2) | Press
the Generate button in the Launcher toolbar. Alternatively, open the
pop-up menu with the right mouse button and select Generate... (Figure
5–2). |
| If
you press Generate without selecting the graph first, you will be
prompted for the graphs you want to execute a generator. The generator then must
be one that is applicable to all selected graphs (common
supertype). |
| You
can also execute generators in a similar way from a Type Browser, or from any of
the editors through Graph |
Generate.... |
Figure 5–2. Executing generators for the graph.
After
the selection a dialog opens allowing you to select one of the generators that
are available. The available generators are those defined in that graph type,
its supertypes, or the supertype of all Graph types, Graph itself. The generator
you select is then executed on the graph you selected. During the generation a
progress bar will be shown (
Figure
5–3). The progress bar contains a
Break button for halting the
execution of the generation.
Figure 5–3. Generation progress bar.
The generation
output is either written directly to files or shown in a Generator output tool.
If the generation is directed to the files, a Generated Files window (
Figure 5–4) will open, providing a
list of generated files and their size and some statistical information such as
the number of output files and their total size and the generator execution
time. If a file could not be written to, the window will show the operating
system’s message stating why not, e.g. the directory did not exist. The
output intended for the file will be opened in a Generator output tool, named
after the desired file.
Figure 5–4. List of generated files.
In the Generator
output tool
(
Figure
5–5) you can view the generator output. You can also edit it with the
normal text editor functions in the pop-up menu,
Edit menu or toolbar
(see the corresponding functionality in the Text Editor in Section
3.3.4).
Figure 5–5. Example of Generator Output.
The
Generator output tool also includes functions for saving the generated text to a
file, inserting ASCII text from a file, and printing the output (for printing
see also Section
5.1). It also provides
the possibility to set word wrapping and the base font for its text
display.
The underlined text in the output window represents a link
to the element that the underlined text refers to. When a piece of underlined
text is double-clicked its link target is shown. If the link target is an
element within a diagram, matrix, or table it will be opened and the element
becomes selected. For example,
Figure
5–5 shows the output from the XML generator on WatchModels. If you
double-click “Display” on the second line, the WatchFamily diagram
is opened and the corresponding instance of Display is selected. If the link
target is a property, we have two cases. If the property belongs to a graph its
property dialog is opened. If not, an info dialog will be opened for the
property. For example, if you double-click “X022” (see the above
output), an info dialog for the property shows the GOPPRR elements that use this
property and allows you to open their property dialogs. Lastly, if the link
target is a graph the graph will be opened: a double-click on the above
output’s “WatchFamily” opens the WatchFamily diagram. To
inactivate the linking and remove other text formatting, select the text, press
Esc and then press
x.
To exit from the Generator output tool select
File |
Exit.