Changes for page Graphical Modeling with Graphiti
Last modified by msp on 2025/01/30 12:03
Summary
-
Page properties (1 modified, 0 added, 0 removed)
-
Objects (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -8,14 +8,22 @@ 8 8 9 9 = Defining the Diagram Type = 10 10 11 -The main documentation of Graphiti is found in the [[Eclipse online help>>url:http://help.eclipse.org/juno/nav/23||shape="rect"]], which is also found in the Eclipse application (//Help// → //Help Contents//). If you don't have Graphiti yet, install it from the Juno release update site, //Modeling// category. 11 +The main documentation of Graphiti is found in the [[Eclipse online help>>url:http://help.eclipse.org/juno/nav/23||shape="rect"]], which is also found in the Eclipse application (//Help// → //Help Contents//). If you don't have Graphiti yet, install it from the Juno release update site, //Modeling// category. The first step of this tutorial consists of defining a diagram type for Turing Machines and adding a wizard dialog for the creation of new diagrams. 12 12 13 13 1. Read the [[Graphiti Introduction>>url:http://help.eclipse.org/juno/topic/org.eclipse.graphiti.doc/resources/docu/gfw/graphiti-introduction.htm?cp=23_0_0||shape="rect"]]. 14 14 1. Create a new plugin named de.cau.cs.rtprak.login.turing.graphiti (like in previous tutorials, replace "login" by your login name) and add dependencies to the following plugins:\\ 15 +1*. org.eclipse.core.runtime 16 +1*. org.eclipse.core resources 17 +1*. org.eclipse.ui 18 +1*. org.eclipse.ui.ide 19 +1*. org.eclipse.emf.ecore.xmi 20 +1*. org.eclipse.emf.transaction 21 +1*. org.eclipse.emf.workspace 15 15 1*. org.eclipse.graphiti 16 16 1*. org.eclipse.graphiti.ui 24 +1*. de.cau.cs.rtprak.login.turingmodel 17 17 1. Create a class {{code language="none"}}TuringDiagramTypeProvider{{/code}} with superclass {{code language="none"}}org.eclipse.graphiti.dt.AbstractDiagramTypeProvider{{/code}}. 18 -1. Open {{code language="none"}}plugin.xml{{/code}}and create an extension for org.eclipse.graphiti.ui.diagramTypes with a //diagramType// element:\\26 +1. Open plugin.xml and create an extension for org.eclipse.graphiti.ui.diagramTypes with a //diagramType// element:\\ 19 19 1*. //id: //de.cau.cs.rtprak.TuringDiagramType 20 20 1*. //type: //turing 21 21 1*. //name: //Turing Diagram Type ... ... @@ -37,3 +37,21 @@ 37 37 } 38 38 {{/code}} 39 39 ))) 48 +1. Copy [[attach:GraphitiNewWizard.java]] and [[attach:CreationWizardPage.java]] to your plugin, adapting the package name accordingly. These files implement a generic wizard dialog for creating Graphiti-based models. 49 +1. Create a subclass of {{code language="none"}}GraphitiNewWizard{{/code}} for specifying a concrete wizard dialog for your models.\\ 50 +1*. ((( 51 +Add a constructor that calls a super-constructor with according parameters for configuration: 52 + 53 +{{code theme="Eclipse" language="java"}} 54 +super("Turing Machine", "tudi", "turing", "turing", 55 + org.eclipse.graphiti.ui.editor.DiagramEditor.DIAGRAM_EDITOR_ID); 56 +{{/code}} 57 + 58 +Diagrams are stored in two separate files, one containing the actual Turing Machine model and one containing the specific graphical elements used to represent the model. Here it is assumed that {{code language="none"}}"turing"{{/code}} is the file extension for Turing Machine models (this depends on how you configured your EMF model), while {{code language="none"}}"tudi"{{/code}} will be the file extension for diagrams. 59 +))) 60 +1*. Implement the {{code language="none"}}createModel{{/code}} method by creating and returning an instance of the top-level element of your Turing Machines, e.g. {{code language="none"}}TuringMachine{{/code}}. 61 +1*. Register the new wizard class in your plugin.xml using a //wizard// extension for org.eclipse.ui.newWizards (you only need to choose an id and name and set the correct class name). 62 +1. Include the new plugin in your Eclipse run configuration and start it. Create a Turing Machine diagram with your new wizard: //File//→ //New//→ //Other...//→ //Other//→ //Turing Machine//. This opens a Graphiti diagram editor for the new file, but you cannot do anything in that editor, since the palette is still empty. 63 +1. In order to open a previously created {{code language="none"}}tudi{{/code}} file, right-click it → //Open With//→ //Other...//→ //Graphiti Diagram Editor//. This setting for {{code language="none"}}tudi{{/code}} files will be saved in your workspace preferences. 64 + 65 +
- Confluence.Code.ConfluencePageClass[0]
-
- Id
-
... ... @@ -1,1 +1,1 @@ 1 -360457 51 +3604579 - URL
-
... ... @@ -1,1 +1,1 @@ 1 -https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/WS12EclPract/pages/360457 5/Graphical Editors with Graphiti1 +https://rtsys.informatik.uni-kiel.de/confluence//wiki/spaces/WS12EclPract/pages/3604579/Graphical Editors with Graphiti