| <?xml version="1.0" encoding="UTF-8"?> |
| <cheatsheet title="GMF Tutorial"> |
| <intro> |
| <description> |
| This tutorial guides you through the definition, mapping, and generation of a graphical editor for mindmaps using GMF.<br/><br/>To start working on this cheatsheet, click the "Click to Begin" button below.<br/><br/>This cheatsheet is complemented by detailed steps in the online GMF Tutorial. |
| </description> |
| </intro> |
| <item title="Create a New Project" dialog="true" skip="true"> |
| <description> |
| First, we'll create a new project to hold our models.<br/><br/>The default name will be set and a new 'model' folder will be created for you, if you use the "Click to Perform" button below. |
| </description> |
| <action class="org.eclipse.gmf.internal.doc.ui.actions.OpenProjectWizardAction" pluginId="org.eclipse.gmf.doc.ui" confirm="false" param1="org.eclipse.gmf.examples.mindmap"> |
| </action> |
| </item> |
| <item title="The Domain Model" dialog="false" skip="true"> |
| <description> |
| At this point, you can either copy the provided mindmap.ecore or mindmap.xsd model into the 'model' folder, or use the ECore diagram to model it from the diagram provided online.<br/><br/>Next, we'll create a new mindmap.genmodel and generate the model and edit code. |
| <br/><br/>The following steps are required: |
| <br/><br/>1. Right-click the mindmap model file and select <b>New... | Other... | Eclipse Modeling Framework | EMF Model</b> and use the defaults of the wizard to create a new mindmap.genmodel. |
| <br/><br/>2. Select the Mindmap package below the root of the genmodel and in the Properties view, change the <b>Base Package</b> property to <b>org.eclipse.gmf.examples</b>. |
| <br/><br/>3. Right-click on the root of the genmodel and select <b>Generate Model Code</b> followed by <b>Generate Edit Code</b>. |
| <br/><br/><br/>Now, with our domain model ready, we can begin our graphical definition. Press "Click to Complete" below. |
| </description> |
| </item> |
| <item title="Create a Graphical Definition" dialog="true" skip="true"> |
| <description> |
| In a graphical definition, you will define figures, nodes, compartments, connections, etc.<br/><br/>Using the wizard, we can get started on our graphical definition by examining our domain model. Use the "Click to Perform" button to get started. |
| <br/><br/>The following steps are required: |
| <br/><br/>1. In the wizard, select the 'org.eclipse.gmf.examples.mindmap/model' as the parent folder for your mindmap.gmfgraph model. |
| <br/><br/>2. The second page of the wizard has a <b>Browse</b> button that should easily find our mindmap.ecore model. For Diagram Element, select the Map class. |
| <br/><br/>3. The last page of the wizard gives us options for those features found in our domain model (node, link, or label). For now, uncheck all but the 'Topic' element as a node, its 'name' attribute as a label, and the 'subtopics' relationship as a link. |
| </description> |
| <action class="org.eclipse.gmf.internal.doc.ui.actions.OpenGraphWizardAction" pluginId="org.eclipse.gmf.doc.ui" confirm="false" param1="mindmap.gmfgraph"> |
| </action> |
| </item> |
| <item title="Create a Tooling Definition" dialog="true" skip="true"> |
| <description> |
| Our graphical definition for our editor will need tooling to be useful. We will again use a wizard to get started by examining the domain model. Use the "Click to Perform" button to get started. |
| <br/><br/>The following steps are required: |
| <br/><br/>1. Again, select the 'model' folder to hold the mindmap.gmftool model. |
| <br/><br/>2. On the second page we will locate our mindmap.ecore file as before, and select our Map class for the Diagram Element. |
| <br/><br/>3. On the last page, uncheck all but our 'Topic' element and the 'subtopics' relationship. |
| </description> |
| <action class="org.eclipse.gmf.internal.doc.ui.actions.OpenToolWizardAction" pluginId="org.eclipse.gmf.doc.ui" confirm="false" param1="mindmap.gmftool"> |
| </action> |
| </item> |
| <item title="Create a Mapping Definition" dialog="true" skip="true"> |
| <description> |
| Now it's time to map our graphical elements and their tools to our domain model. Use the "Click to Perform" button to get started. |
| <br/><br/>The following steps are required: |
| <br/><br/>1. Again, select the 'model' folder to hold the mindmap.gmfmap model. |
| <br/><br/>2. On the second page, we find our mindmap.ecore model is already selected. Choose the Map class for the canvas and press <b>Next</b>. |
| <br/><br/>3. On the third page, we find our mindmap.tool model is already loaded. Keep the defaults and press <b>Next</b>. |
| <br/><br/>4. On the fourth page, we find our mindmap.gmfgraph model is already loaded. Keep the defaults and press <b>Next</b>. |
| <br/><br/>5. On the last page of the wizard, examine the mappings determined by the wizard. For now, remove all but 'Topic' in the Nodes list, and 'subtopics' in the Links list. Press <b>Finish</b> when you're done. |
| </description> |
| <action class="org.eclipse.gmf.internal.doc.ui.actions.OpenMapWizardAction" pluginId="org.eclipse.gmf.doc.ui" confirm="false" param1="org.eclipse.gmf.examples.mindmap/model" param2="mindmap.gmfmap" param3="platform:/resource/org.eclipse.gmf.examples.mindmap/model/mindmap.ecore" param4="platform:/resource/org.eclipse.gmf.examples.mindmap/model/mindmap.gmfgraph" param5="platform:/resource/org.eclipse.gmf.examples.mindmap/model/mindmap.gmftool"> |
| </action> |
| </item> |
| <item title="Create a Label Mapping" dialog="false" skip="true"> |
| <description> |
| We'll manually create a label mapping for our Topic element using the following steps: |
| <br/><br/>1.Right-click the 'Node Mapping' below the only 'Top Node Reference' in the mapping model and create a new <b>Feature Label Mapping</b>. |
| <br/><br/>2.In the properties view, select the <b>TopicName</b> diagram label. |
| <br/><br/>3.Select the <b>name</b> attribute for the <b>Features</b> property. |
| </description> |
| </item> |
| <item title="Code Generation" dialog="false" skip="true"> |
| <description> |
| The last model you'll need will be transformed from the mapping model and contain those properties needed to generate the source code for your editor.<br/><br/>To produce the generator model, right-click on your mindmap.gmfmap file and select <b>Create generator model...</b>.<br/><br/>You may want to browse this model and examine its properties. There are many options to consider when generating code. When you're ready, right-click the mindmap.gmfgen file and select <b>Generate diagram code</b>. |
| </description> |
| </item> |
| <item title="Running the Diagram" dialog="false" skip="false"> |
| <description> |
| You are ready to test the diagram. From the <b>Run | Run...</b> menu, create a new <b>Eclipse Application</b> runtime configuration and launch your diagram using the default settings.<br/><br/>You'll need to create a project and then a <b>New | Examples | Mindmap diagram</b>. Explore the functionality provided, including layout, alignment, selection, etc. |
| </description> |
| </item> |
| </cheatsheet> |