Java Reference
In-Depth Information
We plan to implement a custom
EditPolicy
for our ToolTip, which is the
standard GEF approach for adding behavior to an
EditPart
. It might seem like
overkill when you see the actual implementation, but this gives us an opportu-
nity to illustrate this extension approach.
The GMF generator model enables us to define
Custom Behaviour
ele-
ments as children of
Gen Top Level Node
elements. We need to add a refer-
ence from our
Tooltip
class to this element in the GMF generator model. Using
the
Load Resource
menu followed by the convenient
Browse Registered
Packages
button brings up the dialog shown in Figure 4-21. It takes a few sec-
onds to populate, but when it does, we select our GMF GenModel from the list.
Be sure to select
Runtime Version
and not
Development Time Version
, and then
accept the corresponding warning that models referenced in this manner will not
appear as a root in the editor. Selecting
Runtime Version
means that references
to this loaded model will use the registered package Namespace URI instead of
a
platform:/
URI, as is the case when selecting
Development Time Version
.
Figure 4-21
Package Selection dialog
We now create an
editpolicy
reference from our
Tooltip
class to the
CustomBehaviour
class in the loaded GMF GenModel. To reference the text
we need to display in our ToolTip, we add a reference to the Ecore
EAttribute
element. Similar to our earlier procedure, we first use the
Load Resource
menu
Search WWH ::
Custom Search