| <html> |
| |
| <head> |
| <meta http-equiv=Content-Type content="text/html; charset=windows-1252"> |
| <meta name=Generator content="Microsoft Word 12 (filtered)"> |
| <title>Providing own images</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:"Ü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;} |
| 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 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","serif";} |
| 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;} |
| span.code1 |
| {mso-style-name:code1; |
| font-style:italic;} |
| span.code0 |
| {mso-style-name:code0; |
| font-style:italic;} |
| span.code00 |
| {mso-style-name:code00; |
| font-style:italic;} |
| span.heading2char |
| {mso-style-name:heading2char; |
| font-family:"Arial","sans-serif"; |
| color:black; |
| font-weight:bold; |
| 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>Providing Own Images</span></h1> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'> </span><span |
| lang=EN-US> </span></p> |
| |
| <h2><span lang=EN-GB>Prerequisite</span></h2> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'> </span></p> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'>Providing own images is |
| platform dependent (e.g. Eclipse specific). </span></p> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'>You have to <b>copy an |
| icon</b> representing an association to the location </span><span lang=EN-US |
| style='font-size:10.0pt;font-family:"Courier New";color:#2A00FF'>"icons/ereference.gif"</span><span |
| lang=EN-US style='color:black'> </span><span lang=EN-GB style='color:black'>of your |
| plugin. This icon will be registered and used in this chapter.</span></p> |
| |
| <p class=MsoNormal><span lang=EN-US> </span></p> |
| |
| <h2><span lang=EN-GB>Creating an Image Provider</span></h2> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'> </span></p> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'>Own images can be |
| provided through implementations of image providers, which have to be |
| registered using extensions in the plugin.xml. </span></p> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'>As Graphiti is (mostly) |
| platform independent but instances of images are platform dependent. Because of |
| this images in Graphiti are only used via |
| identifiers, and the task of the image provider is to deliver the |
| platform-dependent image for an image identifier.</span></p> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'> </span></p> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'>In the following |
| example we provide an own image representing an EReference, and use it for the <a |
| href="context-buttons.htm">context button</a> create connection we created |
| previously.</span></p> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'> </span></p> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'>First we have to create |
| an image provider.</span></p> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'>An image provider has |
| to implement the interface <a |
| href="../../../javadoc/com/sap/tc/emf/gfw/eclipse/platform/IImageProvider.html">IImageProvider</a>. |
| Instead of implementing it directly it is recommended to extend the base class <a |
| href="../../../javadoc/com/sap/tc/emf/gfw/eclipse/platform/AbstractImageProvider.html">AbstractImageProvider</a>. |
| </span></p> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'> </span></p> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'>In this case we have to |
| implement/overwrite one method:</span></p> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'>The method <a |
| href="../../../javadoc/com/sap/tc/emf/gfw/eclipse/platform/AbstractImageProvider.html#addAvailableImages()">addAvailableImages</a> |
| has to register all available image identifiers, and map them to their |
| platform-dependent images.</span></p> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'> </span></p> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'>You can see the |
| complete implementation of the image provider here: </span></p> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'> </span></p> |
| |
| <table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 |
| style='width:857px;border-collapse:collapse'> |
| <tr> |
| <td valign=top style='width:835px;border:1.0pt solid windowtext; |
| padding-left:5.4pt; padding-right:5.4pt; padding-top:0cm; padding-bottom:0cm'> |
| <p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US |
| style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'> </span></b></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;</span></p> |
| <p class=MsoNormal style='text-autospace:none'><span lang=EN-US |
| style='font-size:10.0pt;font-family:"Courier New"'> </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'>import</span></b><span |
| lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'> |
| org.eclipse.graphiti.ui.platform.AbstractImageProvider;</span></p> |
| <p class=MsoNormal style='text-autospace:none'><span lang=EN-US |
| style='font-size:10.0pt;font-family:"Courier New"'> </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'> |
| TutorialImageProvider </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'> |
| AbstractImageProvider {</span></p> |
| <p class=MsoNormal style='text-autospace:none'><span lang=EN-US |
| style='font-size:10.0pt;font-family:"Courier New"'> </span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:#3F7F5F'>// The prefix for all identifiers of this image provider</span></p> |
| <p class=MsoNormal style='text-autospace:none'><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'>protected</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'>static</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'>final</span></b><span |
| lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'> String |
| </span><i><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"; |
| color:#0000C0'>PREFIX</span></i><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'>"org.eclipse.graphiti.examples.tutorial."</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"'> </span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:#3F7F5F'>// The image identifier for an EReference.</span></p> |
| <p class=MsoNormal style='text-autospace:none'><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'>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'>static</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'>final</span></b><span |
| lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:black'> |
| String </span><i><span style='font-size:10.0pt;font-family:"Courier New"; |
| color:#0000C0'>IMG_EREFERENCE</span></i><span lang=EN-US style='font-size: |
| 10.0pt;font-family:"Courier New";color:black'>= </span><i><span lang=EN-US |
| style='font-size:10.0pt;font-family:"Courier New";color:#0000C0'>PREFIX</span></i><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'>"ereference"</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"'> </span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:#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'> |
| </span><b><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"; |
| color:#7F0055'>protected</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'> |
| addAvailableImages() {</span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:#3F7F5F'>// register the path for each image identifier</span></p> |
| <p class=MsoNormal style='text-autospace:none'><span lang=EN-US |
| style='font-size:10.0pt;font-family:"Courier New";color:black'> |
| addImageFilePath(</span><i><span style='font-size:10.0pt;font-family:"Courier New"; |
| color:#0000C0'>IMG_EREFERENCE</span></i><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'>"icons/ereference.gif"</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'> |
| </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";color:black'>}</span></p> |
| <p class=MsoNormal><span lang=EN-GB style='color:black'> </span></p> |
| </td> |
| </tr> |
| </table> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'> </span></p> |
| |
| <p class=MsoNormal><span lang=EN-US style='color:black'> </span></p> |
| |
| <p class=MsoNormal><span lang=EN-US style='color:black'> </span></p> |
| |
| <p class=MsoNormal><span lang=EN-GB>The newly created image provider is |
| registered through the extension point <a |
| href="../extension-points/imageProviders.html">imageProviders</a></span><span |
| lang=EN-US>. </span></p> |
| |
| <p class=MsoNormal><span lang=EN-US>Additionally the image provider has to be |
| added to the extension point <a |
| href="../extension-points/diagramTypeProviders.html">diagramTypeProviders</a><i>.</i> |
| </span></p> |
| |
| <p class=MsoNormal><span lang=EN-GB> <span style='color:black'> </span></span></p> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'>The corresponding part |
| of the <i>plugin.xml</i> should look like this:</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'><b><span lang=EN-US |
| style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'> </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'> </span><span |
| lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:navy'><extension</span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:navy'>point=</span><span lang=EN-US style='font-size:10.0pt;font-family: |
| "Courier New";color:green'>"org.eclipse.graphiti.ui.diagramTypeProviders"</span><span |
| lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:navy'>></span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:navy'><diagramTypeProvider</span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:navy'>class=</span><span lang=EN-US style='font-size:10.0pt;font-family: |
| "Courier New";color:green'>"org.eclipse.graphiti.examples.tutorial.diagram.</span></p> |
| <p class=MsoNormal style='text-autospace:none'><span lang=EN-US |
| style='font-size:10.0pt;font-family:"Courier New";color:green'> |
| MyTutorialDiagramTypeProvider"</span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:navy'>description=</span><span lang=EN-US style='font-size:10.0pt; |
| font-family:"Courier New";color:green'>"This is my editor for the Graphiti |
| tutorial"</span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:navy'>id=</span><span lang=EN-US style='font-size:10.0pt;font-family: |
| "Courier New";color:green'>"org.eclipse.graphiti.examples.tutorial.diagram.<br> |
| |
| MyTutorialDiagramTypeProvider"</span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:navy'>name=</span><span lang=EN-US style='font-size:10.0pt;font-family: |
| "Courier New";color:green'>"My tutorial editor"</span><span |
| lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:navy'>></span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:navy'><diagramType</span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:navy'>id=</span><span lang=EN-US style='font-size:10.0pt;font-family: |
| "Courier New";color:green'>"org.eclipse.graphiti.examples.tutorial.diagram.<br> |
| MyTutorialDiagramType"</span><span |
| lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:navy'>></span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:navy'></diagramType></span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:navy'><imageProvider</span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:navy'>id=</span><span lang=EN-US style='font-size:10.0pt;font-family: |
| "Courier New";color:green'>"org.eclipse.graphiti.examples.tutorial.MyTutorialImageProvider"</span><span |
| lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:navy'>></span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:navy'></imageProvider></span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:navy'></diagramTypeProvider></span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:navy'></extension></span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:navy'><extension</span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:navy'>point=</span><span lang=EN-US style='font-size:10.0pt;font-family: |
| "Courier New";color:green'>"org.eclipse.graphiti.ui.imageProviders"</span><span |
| lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:navy'>></span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:navy'><imageProvider</span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:navy'>class=</span><span lang=EN-US style='font-size:10.0pt;font-family: |
| "Courier New";color:green'>"org.eclipse.graphiti.examples.tutorial.MyTutorialImageProvider"</span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:navy'>id=</span><span lang=EN-US style='font-size:10.0pt;font-family: |
| "Courier New";color:green'>"org.eclipse.graphiti.examples.tutorial.MyTutorialImageProvider"</span><span |
| lang=EN-US style='font-size:10.0pt;font-family:"Courier New";color:navy'>></span></p> |
| <p class=MsoNormal style='text-autospace:none'><span lang=EN-US |
| style='font-size:10.0pt;font-family:"Courier New";color:black'> |
| </span><span style='font-size:10.0pt;font-family:"Courier New";color:navy'></imageProvider></span></p> |
| <p class=MsoNormal style='text-autospace:none'><span style='font-size:10.0pt; |
| font-family:"Courier New";color:black'> </span><span |
| style='font-size:10.0pt;font-family:"Courier New";color:navy'></extension></span></p> |
| <p class=MsoNormal> </p> |
| </td> |
| </tr> |
| </table> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'> </span></p> |
| |
| <p class=MsoNormal> </p> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'>Finally we can set the |
| image for the <a href="context-buttons.htm">context button we created |
| previously</a>. </span></p> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'>This has to be done in |
| the method <a |
| href="../../../javadoc/com/sap/tc/emf/gfw/tb/IToolBehaviorProvider.html#getContextButtonPadData(com.sap.tc.emf.gfw.features.context.IPictogramElementContext)">getContextButtonPadData</a><span |
| class=code00> </span>of the tool behavior provider, as you can see here:</span></p> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'> </span></p> |
| |
| <table class=MsoNormalTable border=0 cellspacing=0 cellpadding=0 width=962 |
| style='width:577.2pt;border-collapse:collapse'> |
| <tr> |
| <td width=940 valign=top style='width:564.0pt;border:solid windowtext 1.0pt; |
| padding:0cm 5.4pt 0cm 5.4pt'> |
| <p class=MsoNormal style='text-autospace:none'><b><span lang=EN-US |
| style='font-size:10.0pt;font-family:"Courier New";color:#7F0055'> </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'> |
| </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'> |
| </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'> IContextButtonPadData[] |
| getContextButtonPadData(IPictogramElementContext context) {</span></p> |
| <p class=MsoNormal style='text-autospace:none'><span lang=EN-US |
| style='font-size:10.0pt;font-family:"Courier New"'> </span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:#3F7F5F'>// ... EXISTING CODING ...</span></p> |
| <p class=MsoNormal style='text-autospace:none'><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'> |
| </span><span lang=EN-US style='font-size:10.0pt;font-family:"Courier New"; |
| color:#3F7F5F'>// create context button and add all applicable features</span></p> |
| <p class=MsoNormal style='text-autospace:none'><span lang=EN-US |
| style='font-size:10.0pt;font-family:"Courier New";color:black'> |
| ContextButtonEntry button = </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'> |
| ContextButtonEntry(</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'>, 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'> |
| button.setText(</span><span lang=EN-US style='font-size:10.0pt;font-family: |
| "Courier New";color:#2A00FF'>"Create connection"</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'> |
| button.setIconId(TutorialImageProvider.</span><i><span style='font-size:10.0pt; |
| font-family:"Courier New";color:#0000C0'>IMG_EREFERENCE</span></i><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'> </span></p> |
| <p class=MsoNormal style='text-autospace:none'><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:#3F7F5F'>// ... EXISTING CODING ...</span></p> |
| <p class=MsoNormal style='text-autospace:none'><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'> |
| </span><span style='font-size:10.0pt;font-family:"Courier New";color:black'>}</span></p> |
| <p class=MsoNormal><span lang=EN-GB style='color:black'> </span></p> |
| </td> |
| </tr> |
| </table> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'> </span></p> |
| |
| <p class=MsoNormal><span lang=EN-GB style='color:black'> </span></p> |
| |
| <h2><span lang=EN-GB>Test: Verify the Own Image for the Context-Button</span></h2> |
| |
| <p class=MsoNormal><span lang=EN-GB> </span></p> |
| |
| <p class=MsoNormal><span lang=EN-GB>Now start the editor and create a new |
| EClass. Hover on top of the EClass to display the context buttons. Verify that |
| the create connection context button has the image you provided before.</span></p> |
| |
| <p class=MsoNormal><span lang=EN-US style='color:black'> </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> |