Java Reference
In-Depth Information
The generated editor for EMF models includes a multipage editor and prop-
erties view. Drag-and-drop support is provided, as is copy/paste support. A num-
ber of menu actions are available in the generated editor, including validation
invocation and dynamic instance model creation. Each generated editor comes
with a default creation wizard. Figure 3-2 shows an example of the editor,
including a context menu showing options to create new elements, cut, copy,
paste, delete, validate, and so on.
Figure 3-2
EMF-generated editor
3.2.3 Code Generation
From an *.ecore (Ecore) model, you need to produce a generator model and
supply additional information required for code generation. An EMF generator
model has a *.genmodel file extension and is essentially a decorator model for
a corresponding *.ecore model. This generator model is fed to Java Emitter
Templates (JETs) that are used to write Java and other files. JET is the Java Server
Pages (JSP)-like technology used by default when generating text from Ecore
models. This topic does not cover it in detail, but a tutorial is available online
[51] if you want to know more.
You can customize the existing generation output using custom templates.
Furthermore, you can extract constraint, pre-/post-condition, and body imple-
mentations from OCL annotations for use in generation and invocation at run-
time. This is not a native EMF capability, but you can add it using the MDT OCL
component. You will use this technique in the context of the sample projects.
Search WWH ::




Custom Search