Java Reference
In-Depth Information
constraints, and defining model audits and metrics. Audits identify problems in
the structure or style of a diagram and its underlying domain model instance, and
metrics provide measures of diagram and domain model elements.
Generator Model
As mentioned in the overview, the generator model adds information used to
generate code from the mapping model and is somewhat analogous to the EMF
genmodel. Both can be reproduced and reloaded from their source models,
although the EMF genmodel is a true decorator model. The GMF generator
model is more of a many-to-one model transformation than a decorator model.
As a mapping model is transformed into a generator model, it loses knowl-
edge of the graphical definition and gains knowledge of the runtime notation
model. This minimizes the number of dependencies linked from the generator
model and separates concern among the models. Currently, the transformation is
performed using Java code, but it is planned to be reimplemented using QVT to
give Toolsmiths easier customization, as mentioned earlier.
A trace facility exists in the experimental SDK to aid in generating visual IDs
when new nodes are added and the generator model is updated. A reconciler pre-
serves other user-modified elements in the generator model upon retransforma-
tion from the mapping model. Many of the commonly modified properties are
preserved, although not all of them are, so be aware of this when making changes
to the generator model.
As with EMF, you can use custom code-generation templates in GMF. The
main difference here is that EMF uses Java Emitter Template (JET) as its template
engine, and GMF uses Xpand. Chapter 14, “Xpand Template Language,” covers
Xpand, which also is used throughout Chapter 7, “Developing Model-to-Text
Transformations.” You can find information on how to use dynamic templates
in GMF in Section 4.2.3, “Dynamic Templates,” and in our sample diagram in
Sections 4.3-4.6.
When using the full runtime as a generation target, a number of extension-
points are contributed to in the generated diagram code. You will likely want to
explore the generated plug-in manifest and source code.
TIP
Sometimes you must open and modify GMF definition models in a text edi-
tor.When doing so, add new elements that are part of a list of items to the
end of the list, because GMF models use relative position references. For
example, if you're copying a figure from one .gmfgraph model to another,
add it after the last descriptors element in the file.
 
Search WWH ::




Custom Search