Java Reference
In-Depth Information
Aggregation links create a reference with the
Containment
property set
to
true
, in contrast with Association links, which are noncontainment
references.
Setting the upper bound property of a link to -1 creates a
many
relation-
ship and causes the link to be displayed with the familiar 0..* notation.
References with
eOpposites
are shown in Figure 3-4 as a single connec-
tion, whereas the Ecore diagram shows two separate links.
3.3.3 Creating the Mindmap Generator Model
With our
mindmap.ecore
model complete, we can validate it and create a gen-
erator model. To validate it, open the model in the
Sample Ecore Model Editor
and right-click on the root package. Select
Validate
and confirm that no errors
exist. If there are errors, correct them and continue. We look into adding valida-
tion for our mindmap model later, which leverages a similar validation frame-
work provided for all Ecore models.
To create
mindmap.genmodel
, right-click the
mindmap.ecore
file in
Explorer view and select
New
→
Other
→
Domain-Specific Language
→
Domain
Generator Model
(Ctrl+3
→
Domain Gen). Note that the original EMF wizard
is found in
New
→
Other
→
Eclipse Modeling Framework
→
EMF Model
(Ctrl+3
EMF Model). We started by selecting our
mindmap.ecore model
,
so the wizard defaults to the same folder and provides the name we want. It also
recognizes that we are importing an Ecore model, but we have to load it our-
selves, curiously. We have only one root package, so we can finish the wizard and
take a look at the generator model properties.
EMF generator models include several properties to consider. For our
mindmap, we need to change only a couple from their default settings. In the
root, change the
Compliance Level
from 1.4 to 5.0 (if it's not already set to
5.0) and change the
Model Directory
to be
/org.eclipse.mindmap/src
.
(Note that this changes the edit, editor, and tests properties as well.) We need to
manually change the
Model Plug-in ID
property to
org.eclipse.mindmap
,
however. In the properties for the Mindmap root package, we need to set the
Base Package
property to
org.eclipse
to match our new plug-in namespace.
This gets us started, so we can move on to code generation. Later, we return
to our mindmap model and add constraints, validation, and other enhancements.
→
Search WWH ::
Custom Search