Show last authors
1 This tutorial will introduce another kind of concrete syntax for your models, namely a graphical syntax. Instead of writing models in a textual format, they are created by dragging elements from a palette into a two-dimensional plane. The framework we will employ here is [[Graphiti>>url:http://www.eclipse.org/graphiti/||shape="rect"]], which is based on the [[Graphical Editing Framework>>url:http://www.eclipse.org/gef/||shape="rect"]].
2
3 === Contents ===
4
5
6
7 {{toc maxLevel="2"/}}
8
9 = Defining the Diagram Type =
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.
12
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 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.graphiti
16 1*. org.eclipse.graphiti.ui
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:\\
19 1*. //id: //de.cau.cs.rtprak.TuringDiagramType
20 1*. //type: //turing
21 1*. //name: //Turing Diagram Type
22 1. Create an extension for org.eclipse.graphiti.ui.diagramTypeProviders with a //diagramTypeProvider// element:\\
23 1*. //id~:// de.cau.cs.rtprak.login.TuringDiagramTypeProvider
24 1*. //name~:// Turing Diagram
25 1*. //class~:// name of the {{code language="none"}}TuringDiagramTypeProvider{{/code}} class
26 1. Add a //diagramType// element to the //diagramTypeProvider// with id de.cau.cs.rtprak.TuringDiagramType.
27 1. Create a class {{code language="none"}}TuringFeatureProvider{{/code}} with superclass {{code language="none"}}org.eclipse.graphiti.ui.features.DefaultFeatureProvider{{/code}}.
28 1. (((
29 Add the following constructor to {{code language="none"}}TuringDiagramTypeProvider{{/code}}:
30
31 {{code theme="Eclipse" language="java"}}
32 /**
33 * Create a Turing diagram type provider.
34 */
35 public TuringDiagramTypeProvider() {
36 setFeatureProvider(new TuringFeatureProvider(this));
37 }
38 {{/code}}
39 )))