blob: 8792426066fb193129c3a2ffb7afbae167094883 [file] [log] [blame]
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=Generator content="Microsoft Word 12 (filtered)">
<title>Providing drill-down behavior</title>
<link rel=Stylesheet type="text/css" media=all href="../book.css">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Cambria;
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
h1
{mso-style-link:"Überschrift 1 Zchn";
margin-top:12.0pt;
margin-right:0cm;
margin-bottom:3.0pt;
margin-left:0cm;
page-break-after:avoid;
font-size:16.0pt;
font-family:"Times New Roman","serif";
font-weight:bold;}
h2
{mso-style-link:"Überschrift 2 Zchn";
margin-top:12.0pt;
margin-right:0cm;
margin-bottom:3.0pt;
margin-left:0cm;
page-break-after:avoid;
font-size:14.0pt;
font-family:"Times New Roman","serif";
font-weight:bold;
font-style:italic;}
h3
{mso-style-link:"Überschrift 3 Zchn";
margin-top:12.0pt;
margin-right:0cm;
margin-bottom:3.0pt;
margin-left:0cm;
page-break-after:avoid;
font-size:13.0pt;
font-family:"Times New Roman","serif";
font-weight:bold;}
h4
{mso-style-link:"Überschrift 4 Zchn";
margin-top:11.25pt;
margin-right:0cm;
margin-bottom:1.7pt;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman","serif";
font-weight:bold;
font-style:italic;}
h5
{mso-style-link:"Überschrift 5 Zchn";
margin-right:0cm;
margin-left:0cm;
font-size:10.0pt;
font-family:"Times New Roman","serif";
font-weight:bold;}
h6
{mso-style-link:"Überschrift 6 Zchn";
margin-right:0cm;
margin-left:0cm;
font-size:7.5pt;
font-family:"Times New Roman","serif";
font-weight:bold;}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
p
{margin-top:5.65pt;
margin-right:0cm;
margin-bottom:5.65pt;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
pre
{mso-style-link:"HTML Vorformatiert Zchn";
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:3.4pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Courier New";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-link:"Sprechblasentext Zchn";
margin:0cm;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";}
span.berschrift1Zchn
{mso-style-name:"Überschrift 1 Zchn";
mso-style-link:"Überschrift 1";
font-family:"Cambria","serif";
color:#365F91;
font-weight:bold;}
span.berschrift2Zchn
{mso-style-name:"Überschrift 2 Zchn";
mso-style-link:"Überschrift 2";
font-family:"Cambria","serif";
color:#4F81BD;
font-weight:bold;}
span.berschrift3Zchn
{mso-style-name:"Überschrift 3 Zchn";
mso-style-link:"Überschrift 3";
font-family:"Cambria","serif";
color:#4F81BD;
font-weight:bold;}
span.berschrift4Zchn
{mso-style-name:"Überschrift 4 Zchn";
mso-style-link:"Überschrift 4";
font-family:"Cambria","serif";
color:#4F81BD;
font-weight:bold;
font-style:italic;}
span.berschrift5Zchn
{mso-style-name:"Überschrift 5 Zchn";
mso-style-link:"Überschrift 5";
font-family:"Cambria","serif";
color:#243F60;}
span.berschrift6Zchn
{mso-style-name:"Überschrift 6 Zchn";
mso-style-link:"Überschrift 6";
font-family:"Cambria","serif";
color:#243F60;
font-style:italic;}
span.HTMLVorformatiertZchn
{mso-style-name:"HTML Vorformatiert Zchn";
mso-style-link:"HTML Vorformatiert";
font-family:Consolas;}
span.SprechblasentextZchn
{mso-style-name:"Sprechblasentext Zchn";
mso-style-link:Sprechblasentext;
font-family:"Tahoma","sans-serif";}
p.code, li.code, div.code
{mso-style-name:code;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:15.0pt;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
p.note, li.note, div.note
{mso-style-name:note;
margin-top:19.5pt;
margin-right:0cm;
margin-bottom:19.5pt;
margin-left:30.0pt;
font-size:13.0pt;
font-family:"Times New Roman","serif";
font-style:italic;}
p.comment, li.comment, div.comment
{mso-style-name:comment;
margin-top:5.65pt;
margin-right:0cm;
margin-bottom:5.65pt;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman","serif";
font-weight:bold;}
p.msochpdefault, li.msochpdefault, div.msochpdefault
{mso-style-name:msochpdefault;
margin-top:5.65pt;
margin-right:0cm;
margin-bottom:5.65pt;
margin-left:0cm;
font-size:10.0pt;
font-family:"Times New Roman","serif";}
span.heading2char
{mso-style-name:heading2char;
font-family:"Arial","sans-serif";
color:black;
font-weight:bold;
font-style:italic;}
span.code1
{mso-style-name:code1;
font-style:italic;}
span.code0
{mso-style-name:code0;
font-style:italic;}
.MsoChpDefault
{font-size:10.0pt;}
@page WordSection1
{size:595.45pt 841.7pt;
margin:72.0pt 89.85pt 72.0pt 89.85pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
-->
</style>
</head>
<body bgcolor=white lang=DE link=blue vlink=purple style='margin-bottom:12.0pt'>
<div class=WordSection1>
<h1><a name="_Toc179099520"><span lang=EN-GB>Providing </span></a><span
lang=EN-GB>Drill-Down Behavior</span></h1>
<p class=MsoNormal><span lang=EN-GB style='color:black'>&nbsp;</span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>Often the information
which is shown in a diagram has a certain abstraction level, and the further
details are shown in a separate diagram. For example if a workflow connects
several sub-workflows, then one overview-diagram might show the complete
workflow without the inner details of the sub-workflows, and several
detail-diagrams show the inner details of each sub-workflow.</span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>In this case the user
wants to have an easy possibility to navigate from the overview-diagram into
the detail-diagrams and vice versa. We call this “drill-down” behavior.</span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>Although going from
overview to detail is the most typical example, there are other examples, where
the user navigates to more independent diagrams. </span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>&nbsp;</span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>All those use cases
have one thing in common: the user wants to navigate to a diagram, which
“represents” the selected business object (meaning this business object is
central for the diagram). </span></p>
<p class=MsoNormal><span lang=EN-GB>Graphiti<span style='color:black'> offers
the possibility to link business objects to pictogram elements (including the
diagram). The drill-down feature works in a way that it searches for all
diagrams having a given business object associated. Then the user can choose
from the found diagrams to which to navigate (if only one diagram is found,
than this is directly opened).</span></span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>This is different to a
where-used functionality, where the user would search for all diagrams using a
business object, no matter if the diagram really “represents” the business
object.</span></p>
<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
<h2><span lang=EN-GB>Creating a Drill-Down Feature</span></h2>
<p class=MsoNormal><span lang=EN-GB style='color:black'>&nbsp;</span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>In this example we want
to enable the users to navigate to the diagram(s) which have the currently
selected EClass associated. Therefore we have to create a drill-down feature
and make it available in the feature provider.</span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>A drill-down feature is
a <a href="custom-feature.htm">custom feature</a> which can easily be
implemented by extending the base class <a
href="../../../javadoc/org/eclipse/graphiti/ui/features/AbstractDrillDownFeature.html">AbstractDrillDownFeature</a>.</span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>&nbsp;</span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>The functionality of
the AbstractDrillDownFeature is not tool-independent, so the method <i>getDiagrams()</i>
can be implemented only by the tool efficiently. Furthermore we just overwrite
the <i>canExecute</i>() method, so that the feature is only enabled if exactly
one EClass is selected.</span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>&nbsp;</span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>You can see the
complete implementation of the drill-down feature here:</span></p>
<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=680
style='width:18.0cm;border-collapse:collapse'>
<tr>
<td width=680 valign=top style='width:18.0cm;border:solid windowtext 1.0pt;
padding:0cm 5.4pt 0cm 5.4pt'>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='color:black'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>package</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>
org.eclipse.graphiti.examples.tutorial.features;</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>public</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>class</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>
TutorialDrillDownEClassFeature </span><b><span lang=EN-US style='font-size:
10.0pt;font-family:"Courier New";color:#7F0055'>extends</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>
AbstractDrillDownFeature {</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>public</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> TutorialDrillDownEClassFeature(IFeatureProvider
fp) {</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>super</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'>(fp);</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#646464'>@Override</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>public</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> String getName() {</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>return</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#2A00FF'>&quot;Open
associated diagram&quot;</span><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'>;</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#646464'>@Override</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>public</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> String getDescription() {</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>return</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#2A00FF'>&quot;Open
the diagram associated with this EClass&quot;</span><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>;</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#646464'>@Override</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>public</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>boolean</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>
canExecute(ICustomContext context) {</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
PictogramElement[] pes = context.getPictogramElements();</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#3F7F5F'>// first check, if one EClass is selected</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>if</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> (pes != </span><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>null</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>
&amp;&amp; pes.</span><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#0000C0'>length</span><span lang=EN-US style='font-size:
10.0pt;font-family:"Courier New";color:black'> == 1) {</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Object bo = getBusinessObjectForPictogramElement(pes[0]);</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>if</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> (bo </span><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>instanceof</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>
EClass) {</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#3F7F5F'>// then forward to super-implementation, which checks if</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#3F7F5F'>// this EClass is associated with other diagrams</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>return</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>super</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>.canExecute(context);</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>return</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>false</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>;</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US>&nbsp;</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#646464'>&nbsp;&nbsp;&nbsp; @Override</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp; protected</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
Collection&lt;Diagram&gt; getDiagrams() {</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Collection&lt;Diagram&gt; result = Collections.<i>emptyList</i>();</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Resource resource = getDiagram().eResource();</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
URI uri = resource.getURI();</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
URI uriTrimmed = uri.trimFragment();</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
(uriTrimmed.isPlatformResource()){</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
String platformString = uriTrimmed.toPlatformString(<b><span
style='color:#7F0055'>true</span></b>);</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
IResource fileResource = ResourcesPlugin.getWorkspace()<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
.getRoot().findMember(platformString);</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
(fileResource != <b><span style='color:#7F0055'>null</span></b>){</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
IProject project = fileResource.getProject();</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
result = TutorialUtil.getDiagrams(project);</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> result;</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;
</span><span style='font-size:10.0pt;font-family:"Courier New"'>}</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>}</span></p>
<p class=MsoNormal>&nbsp;</p>
</td>
</tr>
</table>
<p class=MsoNormal><span lang=EN-GB style='color:black'>&nbsp;</span></p>
<p class=MsoNormal><span lang=EN-GB>The complete implementation of class <i>TutorialUtil</i>
can be seen here:</span></p>
<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=680
style='width:18.0cm;border-collapse:collapse'>
<tr>
<td width=680 valign=top style='width:18.0cm;border:solid windowtext 1.0pt;
padding:0cm 5.4pt 0cm 5.4pt'>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New";color:#3F7F5F'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
</span></p>
<p class=MsoNormal style='margin-bottom:12.0pt'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>package </span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>org.eclipse.graphiti.examples.tutorial<b>;</b></span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>public</span></b><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'> <b><span
style='color:#7F0055'>class</span></b> TutorialUtil {<br>
&nbsp;</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp; public</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <b><span
style='color:#7F0055'>static</span></b> Collection&lt;Diagram&gt;
getDiagrams(IProject p) {</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; final</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
List&lt;IFile&gt; files = <i>getDiagramFiles</i>(p);</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; final</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
List&lt;Diagram&gt; diagramList = <b><span style='color:#7F0055'>new</span></b>
ArrayList&lt;Diagram&gt;();</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; final</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> ResourceSet
rSet = <b><span style='color:#7F0055'>new</span></b> ResourceSetImpl();</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> (<b><span
style='color:#7F0055'>final</span></b> IFile file : files) {</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
final</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
Diagram diagram = <i>getDiagramFromFile</i>(file, rSet);</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
(diagram != <b><span style='color:#7F0055'>null</span></b>) {</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
diagramList.add(diagram);</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> diagramList;</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;
}<br>
&nbsp;</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp; private</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <b><span
style='color:#7F0055'>static</span></b> List&lt;IFile&gt;
getDiagramFiles(IContainer folder) {</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; final</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
List&lt;IFile&gt; ret = <b><span style='color:#7F0055'>new</span></b>
ArrayList&lt;IFile&gt;();</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> {</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
final</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
IResource[] members = folder.members();</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
for</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
(<b><span style='color:#7F0055'>final</span></b> IResource resource :
members) {</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
(resource <b><span style='color:#7F0055'>instanceof</span></b> IContainer) {</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ret.addAll(<i>getDiagramFiles</i>((IContainer) resource));</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
} <b><span style='color:#7F0055'>else</span></b> <b><span style='color:#7F0055'>if</span></b>
(resource <b><span style='color:#7F0055'>instanceof</span></b> IFile) {</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
final</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
IFile file = (IFile) resource;</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
(file.getName().endsWith(<span style='color:#2A00FF'>&quot;.diagram&quot;</span>))
{ <span style='color:#3F7F5F'>//$NON-NLS-1$</span></span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ret.add(file);</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
} <b><span style='color:#7F0055'>catch</span></b> (<b><span style='color:
#7F0055'>final</span></b> CoreException e) {</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
e.printStackTrace();</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> ret;</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;
}<br>
&nbsp;</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp; private</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <b><span
style='color:#7F0055'>static</span></b> Diagram getDiagramFromFile(IFile
file, <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ResourceSet resourceSet) {</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#3F7F5F'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Get the URI of the
model file.</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; final</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> URI
resourceURI = <i>getFileURI</i>(file, resourceSet);</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#3F7F5F'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Demand load the
resource for this file.</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Resource resource;</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> {</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
resource = resourceSet.getResource(resourceURI, <b><span style='color:#7F0055'>true</span></b>);</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
(resource != <b><span style='color:#7F0055'>null</span></b>) {</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#3F7F5F'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
// does resource contain a diagram as root object?</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
final</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
EList&lt;EObject&gt; contents = resource.getContents();</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
for</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
(<b><span style='color:#7F0055'>final</span></b> EObject object : contents) {</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
(object <b><span style='color:#7F0055'>instanceof</span></b> Diagram) {</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
return</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
(Diagram) object;</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
} <b><span style='color:#7F0055'>catch</span></b> (<b><span style='color:
#7F0055'>final</span></b> WrappedException e) {</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
e.printStackTrace();</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <b><span
style='color:#7F0055'>null</span></b>;</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;
}<br>
&nbsp;</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp; private</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> <b><span
style='color:#7F0055'>static</span></b> URI getFileURI(IFile file,
ResourceSet resourceSet) {</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; final</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'> String
pathName = file.getFullPath().toString();</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
URI resourceURI = URI.<i>createFileURI</i>(pathName);</span></p>
<p class=MsoNormal><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
resourceURI = resourceSet.getURIConverter().normalize(resourceURI);</span></p>
<p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></b><b><span
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>return</span></b><span
style='font-size:10.0pt;font-family:"Courier New"'> resourceURI;</span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New"'>}</span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>&nbsp;</span></p>
</td>
</tr>
</table>
<p class=MsoNormal>&nbsp;</p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>Before we test our
drill-down feature, we have link EClasses to our diagrams. In our small example
there is no obvious reasoning, which EClass to assign to a diagram. Because of
that we create a new custom feature, where the user himself can assign selected
EClasses to the current diagram. </span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>&nbsp;</span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>You can see the
complete implementation of this custom feature here:</span></p>
<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=680
style='width:18.0cm;border-collapse:collapse'>
<tr>
<td width=680 valign=top style='width:18.0cm;border:solid windowtext 1.0pt;
padding:0cm 5.4pt 0cm 5.4pt'>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='color:black'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>package</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>
org.eclipse.graphiti.examples.tutorial.features;</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>public</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'> </span><b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>class</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>
TutorialAssociateDiagramEClassFeature </span><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>extends</span></b></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
AbstractCustomFeature {</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>public</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'>
TutorialAssociateDiagramEClassFeature(IFeatureProvider fp) {</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>super</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'>(fp);</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#646464'>@Override</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>public</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> String getName() {</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>return</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#2A00FF'>&quot;Associate
diagram&quot;</span><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:black'>;</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#646464'>@Override</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>public</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> String getDescription() {</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>return</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#2A00FF'>&quot;Associate
the diagram with this EClass&quot;</span><span lang=EN-US style='font-size:
10.0pt;font-family:"Courier New";color:black'>;</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#646464'>@Override</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>public</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>boolean</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'> canExecute(ICustomContext
context) {</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>boolean</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> ret = </span><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>false</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>;</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
PictogramElement[] pes = context.getPictogramElements();</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>if</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> (pes != </span><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>null</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>
&amp;&amp; pes.</span><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New";color:#0000C0'>length</span><span lang=EN-US style='font-size:
10.0pt;font-family:"Courier New";color:black'> &gt;= 1) {</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ret = </span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>true</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'>;</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>for</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> (PictogramElement pe : pes) {</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Object bo = getBusinessObjectForPictogramElement(pe);</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>if</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> (! (bo </span><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>instanceof</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>
EClass)) {</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ret = </span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>false</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'>;</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>return</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> ret;</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>public</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>void</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>
execute(ICustomContext context) {</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
PictogramElement[] pes = context.getPictogramElements();</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
EClass eClasses[] = </span><b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:#7F0055'>new</span></b><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'> EClass[pes.</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>length</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>];</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>for</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> (</span><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>int</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'> i
= 0; i &lt; eClasses.</span><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:#0000C0'>length</span><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>; i++) {</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
eClasses[i] =</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
(EClass) getBusinessObjectForPictogramElement(pes[i]);</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#3F7F5F'>// associate selected EClass with diagram</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
link(getDiagram(), eClasses);</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;
</span><span style='font-size:10.0pt;font-family:"Courier New";color:black'>}</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New"'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt;
font-family:"Courier New";color:black'>}</span></p>
<p class=MsoNormal>&nbsp;</p>
</td>
</tr>
</table>
<p class=MsoNormal><span lang=EN-GB style='color:black'>&nbsp;</span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>Finally the feature
provider has to deliver our newly created custom features (overwrite the method
</span><span class=code1><span lang=EN-US style='color:black'><a
href="../../../javadoc/org/eclipse/graphiti/features/IFeatureProvider.html#getCustomFeatures(org.eclipse.graphiti.features.context.ICustomContext)"><span
style='font-style:normal'>getCustomFeatures</span></a></span></span><span
class=code1><span lang=EN-US style='color:black;font-style:normal'>)</span></span><i><span
lang=EN-GB style='color:black'>. </span></i></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>This implementation can
be seen here:</span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>&nbsp;</span></p>
<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=680
style='width:18.0cm;border-collapse:collapse'>
<tr>
<td width=680 valign=top style='width:18.0cm;border:solid windowtext 1.0pt;
padding:0cm 5.4pt 0cm 5.4pt'>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New";color:#3F7F5F'>&nbsp;</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#646464'>@Override</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>public</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> ICustomFeature[]
getCustomFeatures(ICustomContext context) {</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>return</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> </span><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>new</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>
ICustomFeature[] </span><span lang=EN-US style='font-size:10.0pt;font-family:
"Courier New"'><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style='color:black'>{ </span><b><span style='color:#7F0055'>new</span></b><span
style='color:black'> TutorialRenameEClassFeature(</span><b><span
style='color:#7F0055'>this</span></b><span style='color:black'>),</span></span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>new</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> TutorialDrillDownEClassFeature(</span><b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>this</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>),</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#7F0055'>new</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'>
TutorialAssociateDiagramEClassFeature(</span><b><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'>this</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'>)};</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New";color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>&nbsp;</span></p>
</td>
</tr>
</table>
<p class=MsoNormal><span lang=EN-GB style='color:black'>&nbsp;</span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>&nbsp;</span></p>
<h2><span lang=EN-GB>Test: Navigate to Diagram Associated with a EClass</span></h2>
<p class=MsoNormal><span lang=EN-GB style='color:black'>&nbsp;</span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>Now start the editor
and test this new drill-down feature:</span></p>
<ol style='margin-top:0cm' start=1 type=1>
<li class=MsoNormal style='color:black;text-align:justify'><span lang=EN-GB>create
or open two diagrams</span></li>
<li class=MsoNormal style='color:black;text-align:justify'><span lang=EN-US>in
the first diagram </span><span lang=EN-GB>create a new EClass</span></li>
<li class=MsoNormal style='color:black;text-align:justify'><span lang=EN-GB>use
“copy &amp; paste” to copy this EClass to the second diagram (the
underlying business object is remains the same!)</span></li>
<li class=MsoNormal style='color:black;text-align:justify'><span lang=EN-GB>open
the context menu on the EClass in the second diagram; choose “Associate
diagram”</span></li>
<li class=MsoNormal style='color:black;text-align:justify'><span lang=EN-GB>save
both diagrams and close the second diagram</span></li>
<li class=MsoNormal style='color:black;text-align:justify'><span lang=EN-GB>open
the context menu on the EClass in the first diagram; choose “Open
associated diagram”</span></li>
<li class=MsoNormal style='color:black;text-align:justify'><span lang=EN-GB>now
the second diagram is opened again </span></li>
</ol>
<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
<div class=MsoNormal align=center style='text-align:center'>
<hr size=3 width="100%" align=center>
</div>
<p class=MsoNormal><a href="http://www.eclipse.org/legal/epl-v10.html"
shape=rect>Copyright (c) SAP AG 2005, 2010.</a> </p>
</div>
</body>
</html>