Java Reference
In-Depth Information
The template makes use of an Xtend utility named Utils.ext , whose con-
tents are shown here for those who are interested. Again, later chapters cover the
details of Xpand, Xtend, and Workflow.
String packageName( String fqn) :
fqn.subString(0, (fqn.length - className(fqn).length)-1)
;
String className( String fqn) :
fqn.split('\\.').last()
;
For completeness, this is the content of the Tooltip.xmi file used to com-
plement our GMF generation with a custom EditPolicy that presents
Requirement title and author attributes in a ToolTip on mouseover events:
<?xml version="1.0" encoding="ASCII"?>
<tooltip:Model xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tooltip="http://www.eclipse.org/2008/tooltip"
xsi:schemaLocation="http://www.eclipse.org/2008/tooltip
tooltip.ecore">
<tooltips>
<editpolicy
href="requirements.gmfgen#//@diagram/@topLevelNodes.1/@behaviour.0"/>
<elements name="Title">
<textAttribute
href="../model/requirements.ecore#//Requirement/title"/>
</elements>
<elements name="Author">
<textAttribute
href="../model/requirements.ecore#//Requirement/author"/>
</elements>
</tooltips>
</tooltip:Model>
We can execute the workflow by right-clicking the tooltip.mwe file and
selecting Run As
MWE Workflow . After execution, our new TooltipEdit
Policy is generated into our requirements diagram project. Don't forget to
regenerate the diagram code from the requirements.gmfgen model as well;
the code required to install our custom editpolicy on the Requirement
EditPart needs to be generated. If we launch the diagram, we can test the
result, as Figure 4-22 shows.
Search WWH ::




Custom Search