blob: c606c7063855e8d33d06a0bdd872d3f005f18851 [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>Palette</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: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:"Heading 1 Char";
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:"Heading 2 Char";
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:"Heading 3 Char";
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:"Heading 4 Char";
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:"Heading 5 Char";
margin-right:0cm;
margin-left:0cm;
font-size:10.0pt;
font-family:"Times New Roman","serif";
font-weight:bold;}
h6
{mso-style-link:"Heading 6 Char";
margin-right:0cm;
margin-left:0cm;
font-size:7.5pt;
font-family:"Times New Roman","serif";
font-weight:bold;}
p.MsoCaption, li.MsoCaption, div.MsoCaption
{margin-top:6.0pt;
margin-right:0cm;
margin-bottom:24.0pt;
margin-left:0cm;
text-align:justify;
font-size:10.0pt;
font-family:"Times New Roman","serif";
font-weight:bold;}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:blue;
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 Preformatted Char";
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:"Balloon Text Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma","sans-serif";}
span.Heading1Char
{mso-style-name:"Heading 1 Char";
mso-style-link:"Heading 1";
font-family:"Cambria","serif";
color:#365F91;
font-weight:bold;}
span.Heading2Char
{mso-style-name:"Heading 2 Char";
mso-style-link:"Heading 2";
font-family:"Cambria","serif";
color:#4F81BD;
font-weight:bold;}
span.Heading3Char
{mso-style-name:"Heading 3 Char";
mso-style-link:"Heading 3";
font-family:"Cambria","serif";
color:#4F81BD;
font-weight:bold;}
span.Heading4Char
{mso-style-name:"Heading 4 Char";
mso-style-link:"Heading 4";
font-family:"Cambria","serif";
color:#4F81BD;
font-weight:bold;
font-style:italic;}
span.Heading5Char
{mso-style-name:"Heading 5 Char";
mso-style-link:"Heading 5";
font-family:"Cambria","serif";
color:#243F60;}
span.Heading6Char
{mso-style-name:"Heading 6 Char";
mso-style-link:"Heading 6";
font-family:"Cambria","serif";
color:#243F60;
font-style:italic;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-link:"HTML Preformatted";
font-family:Consolas;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-link:"Balloon Text";
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;}
.MsoChpDefault
{font-size:10.0pt;}
@page Section1
{size:595.45pt 841.7pt;
margin:72.0pt 89.85pt 72.0pt 89.85pt;}
div.Section1
{page:Section1;}
-->
</style>
</head>
<body bgcolor=white lang=DE link=blue vlink=blue style='margin-bottom:12.0pt'>
<div class=Section1>
<h1><span lang=EN-GB>Palette</span></h1>
<p class=MsoNormal><span lang=EN-GB style='color:black'>&nbsp;</span></p>
<h2><span lang=EN-US>Palette Entries</span></h2>
<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
<p class=MsoNormal><span lang=EN-US>The palette of a graphical editor provides
tools to create connections and objects in the diagram.</span></p>
<p class=MsoNormal><span lang=EN-US>There are different types of palette
entries available in the palette:</span></p>
<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
<p class=MsoNormal><span lang=EN-US><a
href="../../../javadoc/org/eclipse/graphiti/palette/impl/PaletteCompartmentEntry.html">PaletteCompartmentEntry</a></span></p>
<p class=MsoNormal><span lang=EN-US>This is a container which allows
structuring the tools into different compartments, which can be collapsed and
expanded. The tools (see below) can be added to the container by calling
addToolEntry. </span></p>
<p class=MsoNormal><img border=0 width=128 height=218
src="visio/palette-compartment.png"></p>
<p class=MsoCaption><span lang=EN-US>Figure: Compartments containing several
creation tools</span></p>
<p class=MsoNormal><span lang=EN-US><a
href="../../../javadoc/org/eclipse/graphiti/palette/impl/ConnectionCreationToolEntry.html">ConnectionCreationToolEntry</a></span></p>
<p class=MsoNormal><span lang=EN-US>This tool lets the user create a connection
between two objects by starting the connection on a source object dropping it
on a target object. It is also possible (if enabled) to drop the connection on
the canvas, in which case a new target object will be created. </span></p>
<p class=MsoNormal><span lang=EN-US>You can add an arbitrary number of <a
href="create-connection-feature.htm">create connection features</a> to this
tool. If you add exactly one create connection feature, then this feature will
be executed directly on drop. If you provide more than one create connection
feature, a popup menu containing all features appears on drop and the user can
select the one to execute.</span></p>
<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
<p class=MsoNormal><span lang=EN-US><a
href="../../../javadoc/org/eclipse/graphiti/palette/impl/ObjectCreationToolEntry.html">ObjectCreationToolEntry</a></span></p>
<p class=MsoNormal><span lang=EN-US>This tool lets the user create objects in
the diagram using one <a href="create-feature.htm">create feature</a>.</span></p>
<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
<p class=MsoNormal><span lang=EN-US><a
href="../../../javadoc/org/eclipse/graphiti/palette/impl/StackEntry.html">StackEntry</a></span></p>
<p class=MsoNormal><span lang=EN-US>A stack can contain an arbitrary number of
creation tools (not directly create features) which belong semantically
together. The user can choose the creation tool which is active on this stack
in a drop down list.</span></p>
<p class=MsoNormal><img border=0 width=130 height=384
src="visio/palette-stack.png"><img border=0 width=125 height=270
src="visio/palette-stack-2.png"></p>
<p class=MsoCaption><span lang=EN-US>Figure: Drop down list (on the left
expanded) of the stack tool </span></p>
<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
<h2><span lang=EN-US>Creating a Palette</span></h2>
<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>The palette is
defined in the tool behavior provider.</span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>If you didn’t do so
already you must <b>first create a tool behavior provider and add it to the
diagram type provider as described <a href="tool-behavior-provider.htm">here</a>.</b></span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>There is one method of
the tool behavior provider to overwrite: </span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>The method </span><span
lang=EN-US>
<a href="../../../javadoc/org/eclipse/graphiti/tb/IToolBehaviorProvider.html#getPalette()">
getPalette</a><b>
</b></span><span lang=EN-GB style='color:black'>has to return the palette
entries (which implement <a
href="../../../javadoc/org/eclipse/graphiti/palette/IPaletteCompartmentEntry.html">IPaletteCompartmentEntry</a>)</span></p>
<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
<p class=MsoNormal><span lang=EN-US>The default implementation of this method
in the class <a
href="../../../javadoc/org/eclipse/graphiti/tb/DefaultToolBehaviorProvider.html">DefaultToolBehaviorProvider</a>
builds a palette with two compartments. The first compartment contains a
connection creation tool for each <a href="create-connection-feature.htm">create
connection feature</a> and the second compartment contains a creation tool for
each <a href="create-feature.htm">create feature</a> you provide in your
feature provider.</span></p>
<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>In this example we want
create one additional compartment at below the compartments of the default
implementation. This compartment contains one stack entry, which allows to
choose between all create features. &nbsp;</span></p>
<p class=MsoNormal><span lang=EN-US style='color:black'>&nbsp;</span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>You can see the
complete implementation of the palette here:</span></p>
<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
<table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=851
style='width:18.0cm;border-collapse:collapse'>
<tr>
<td width=851 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-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'> IPaletteCompartmentEntry[]
getPalette() {</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;
List&lt;IPaletteCompartmentEntry&gt; 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;&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'>
ArrayList&lt;IPaletteCompartmentEntry&gt;();</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;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#3F7F5F'>// add compartments from super class</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;
IPaletteCompartmentEntry[] superCompartments =</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'>super</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'>.getPalette();</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; superCompartments.</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;
ret.add(superCompartments[i]);</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;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#3F7F5F'>// add new compartment at the end of the existing compartments</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;
PaletteCompartmentEntry compartmentEntry =</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'>new</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Courier New";color:black'> PaletteCompartmentEntry(</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:#2A00FF'>&quot;Stacked&quot;</span><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'>null</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;
ret.add(compartmentEntry);</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;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New";
color:#3F7F5F'>// add new stack entry to new compartment</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;
StackEntry stackEntry = </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'> StackEntry(</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:#2A00FF'>&quot;EObject&quot;</span><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;EObject&quot;</span><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'>null</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;
compartmentEntry.addToolEntry(stackEntry);</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;&nbsp;&nbsp;&nbsp;&nbsp;
</span><span lang=EN-US style='font-size:10.0pt;color:#3F7F5F'>/</span><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:#3F7F5F'>/
add all create-features to the new stack-entry</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;
IFeatureProvider featureProvider = getFeatureProvider();</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;
ICreateFeature[] createFeatures = featureProvider.getCreateFeatures();</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; for</span></b><span
lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
(ICreateFeature cf : createFeatures) {</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;
ObjectCreationToolEntry objectCreationToolEntry = </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;
<b><span style='color:#7F0055'>new</span></b>
ObjectCreationToolEntry(cf.getCreateName(),</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;
cf.getCreateDescription(), cf.getCreateImageId(),</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;cf.getCreateLargeImageId(), cf);</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;
stackEntry.addCreationToolEntry(objectCreationToolEntry);</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;
}</span></p>
<p class=MsoNormal style='text-autospace:none'><span lang=EN-US
style='font-size:10.0pt;font-family:"Courier New"'>&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"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<span style='color:#3F7F5F'>// add all create-connection-features to the new
stack-entry</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;
ICreateConnectionFeature[] createConnectionFeatures =</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;
featureProvider.getCreateConnectionFeatures();<br>
<b><span style='color:#7F0055'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for</span></b>
(ICreateConnectionFeature cf : createConnectionFeatures) {</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;
ConnectionCreationToolEntry connectionCreationToolEntry = </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;
new</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"'>
ConnectionCreationToolEntry(cf.getCreateName(), cf</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;
.getCreateDescription(), cf.getCreateImageId(),</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;
cf.getCreateLargeImageId());</span></p>
<p class=MsoNormal><span lang=EN-US>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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"'>connectionCreationToolEntry.addCreateConnectionFeature(cf);</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;
stackEntry.addCreationToolEntry(connectionCreationToolEntry);</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;
}</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;&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.toArray(</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'>
IPaletteCompartmentEntry[ret.size()]);</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><span lang=EN-US>&nbsp;</span></p>
</td>
</tr>
</table>
<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
<h2><span lang=EN-GB>Test: Use the Stack Entry to Create Objects</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 verify that the palette has a new stack entry providing all objects, which
can be created (same as the simple create object entries in the palette).</span></p>
<p class=MsoNormal><span lang=EN-GB style='color:black'>Use the stack entry to
create an instance of the object, which is currently active in the stack entry.
Afterwards change the active object of the stack entry (if several objects are
available) and use the stack entry to create an instance of that object. </span></p>
<p class=MsoNormal><span lang=EN-US>&nbsp;</span></p>
</div>
<hr>
<a href="http://www.eclipse.org/legal/epl-v10.html" shape="rect">Copyright (c) SAP AG 2005, 2010.</a>
</body>
</html>