Sei sulla pagina 1di 29

A quick way of creating Graphiti

Marko Boger HTWG Konstanz Karsten Thoms - temis !os Warmer - n"epen"ant #a$io #i%ipe%%i& Markus Gerhart& Michae% Bauer& 'teffen Ko%%osche HTWG Konstanz

(o"eGeneration )*+) - Marko Boger

'pray is an open source pro,ect


'tarte" at the (o"eGen )*++ By !os Warmer& Karten Thoms an" Marko Boger Hoste" at http-..co"e/goog%e/com.a.ec%ipse%a$s/org.p.spray.

0ur goa% is to make the "e1e%opement of graphica% 2"itors as simp%e as a te3tua% e"itor with too%s %ike 4te3t #irst Target 5%atform is 2c%ipse with Graphiti an" 2M# 6ersion */7/* re%ease" in March )*+)
(o"eGeneration )*+) - Marko Boger )

Graphiti

Framework approach Easy to understand (relatively...) Hides complexity of GEF, Draw2D Only few core concepts Everything is a Feature

Add, Update, Move, Delete, ... Diagram Type Provider, Tool Provider, Image Provider, ...
8

Providers

(o"eGeneration )*+) - Marko Boger

Graphiti

Much code, often repetitive implementation Per mapped meta class

at least AddFeature, CreateFeature, UpdateFeature Remove, Delete, Move, Layout, DrillDown, ... Registration in FeatureProvider Configure palette in ToolBehaviourProvider

Repeat this e.g. for 10 meta classes...

(o"eGeneration )*+) - Marko Boger

- A quick way of creating Graphiti


Metamodel Spray (Core) DSL "iagram c%ass Shape DSL Style DSL

shape connection

sty%e c%ass

Model-Driven Generation Eclipse Plugin for Graphical Editor !ML (Plugin) ava Properties (Plugin)

(o"eGeneration )*+) - Marko Boger

'pray :';

(o"eGeneration )*+) - Marko Boger

<

'pray :';

(o"eGeneration )*+) - Marko Boger

:efining 'hapes

The Shape

(o"eGeneration )*+) - Marko Boger

>

:efining 'hapes - with Graphiti

(o"eGeneration )*+) - Marko Boger

:efining 'hapes - with 'pray


'pray pro1i"es a simp%e :'; to "efine 'hapes
#rom primiti1e neste" shapes with properties

(o"eGeneration )*+) - Marko Boger

+*

'hapes create" with this 'hape :';

(o"eGeneration )*+) - Marko Boger

++

'ty%es
'ty%e :';
(o%or #ont ;ine

nherita$%e @eferra$%e for 'hapes

(o"eGeneration )*+) - Marko Boger

+)

The 'ty%es :';


n%ine 23terna% Mi3e"

(o"eGeneration )*+) - Marko Boger

+8

6arious 'ty%es
'ty%es can $e reuse" 'ty%es can $e inherite"
n"i1i"ua% attri$utes can $e o1erri""en

The who%e "iagram can ha1e a "efau%t sty%e


Auick%y changes the entire %ook an" fee% to a (

Gra"ients an" sha"ows in preparation


(o"eGeneration )*+) - Marko Boger +7

(onnections are 'hapes

(o"eGeneration )*+) - Marko Boger

+9

Anchor
An Anchor is the connection point of a connection to a shape ts position is a property of the shape There are 7 options
(enter B"efau%tC (orners #i3e" @e%ati1e
+<

(o"eGeneration )*+) - Marko Boger

23ten"ing the (o"e


The co"e is generate" in a way to a%%ow manua% e3tension
Generate goo" co"e for most situations 5rogram e3tensions for rare e3ceptiona% cases B23ten"e"C Generation Gap 5attern 23tensi$i%ity of generator using :epen"ency n,ection BGuiceC

(o"eGeneration )*+) - Marko Boger

+=

0ur To"o-;ist
(%ipping @esize cons (opy-5aste 0ut%ine Dn"er%ine @api" Button (onte3t menu 'ha"ows an" G%ows Gra"ients 5roperty 2"itor Te3t-'upport (ompartments Mo"e% 1a%i"ation Mo"e% $rowser

(o"eGeneration )*+) - Marko Boger

+>

#uture 5%ans
(omp%e3 :iagrams- B5ME& DM;& 5etriEet 21o%1e :';s 'e1era% Bui%" targets
'wing We$

:ata$ase support Mu%ti-Dser support


(o"eGeneration )*+) - Marko Boger +?

;W(- 5iping an" nstrumentation


Graphica% 2"itor
'imp%e Metamo"e% in 2M# 'pray BcoreC :'; 'hapes

(o"eGeneration )*+) - Marko Boger

)*

The Metamo"e%
2M# metamo"e%
(an $e create" with any 2M# comp%iant too%
2c%ipse tree e"itor 5osei"on for :';s

(o"eGeneration )*+) - Marko Boger

)+

The 'pray BcoreC :';


diagram LWC for LWC odelElement class LWC!essel"ori#ontal alias "ori#ontal : shape LWC_!essel_"ori#ontal { shapeName = name behavior { create into modelElements palette "!essels" askFor name;

class LWCLocationNoLine alias Noline : shape LWC_Location_NoLine { shapeName = name.substring(0,name.indexOf(";")) valueName = name.substring(name.indexOf(";")+1, name.length) behavior { create into modelElements palette "Locations" askFor name;
(o"eGeneration )*+) - Marko Boger ))

The 'pray BcoreC :'; B(onnectionsC


class LWC$ipe : connection LWC_$ipe%& { from fromElement; to toElement; behavior { create into modelElements palette "Connections";

class LWC'o(rceE)ha(st'tart : connection LWC_'o(rce_E)ha(st %& { from fromElement; to toElement; behavior { create into modelElements palette "Connections";

(o"eGeneration )*+) - Marko Boger

)8

The 'hape :';


shape LWC_!essel_"ori#ontal % *ava+lang+'tring shapeName & { ro(nded,rectangle { position%)-./0-.& si#e%1idth-2./height-34.& c(rve%1idth-5./height-5.& te)t { si#e%1idth-2./height-4.& position%)-6/0-5.& val(e-shapeName

(o"eGeneration )*+) - Marko Boger

)7

shape LWC_"eatE)changer %*ava+lang+'tring shapeName& { ellipse { position%)-./0-4.& si#e%1idth-2./height-2.& pol0line { point%)-7./0-8.& point%)-6./0-8.& point%)-5./0-5.& point%)-6./0-6.& point%)-7./0-6.& te)t { position%)-./0-.& si#e%1idth-3../height-4.& val(e-shapeName anchor { position%)-./0-5.& position%)-7./0-6.& position%)-7./0-8.&
(o"eGeneration )*+) - Marko Boger )9

shape LWC_"eatE)changer %*ava+lang+'tring shapeName& { ro(nded,rectangle { position%)-./0-4.& si#e%1idth-2./height-7.& c(rve%1idth-5./ height-5.& pol0line { point%)-7./0-7.& point%)-6./0-7.& point%)-5./0-8.& point%)-6./0-5.& point%)-7./0-5.& te)t { position%)-./0-.& si#e%1idth-3../height-4.& val(e-shapeName anchor { position%)-./0-5.& position%)-./0-7.& position%)-7./0-5.& position%)-7./0-7.&
(o"eGeneration )*+) - Marko Boger )<

The (ha%%enge

(o"eGeneration )*+) - Marko Boger

)=

0ur 5roposa% Bat this timeC

(o"eGeneration )*+) - Marko Boger

)>

(osts
Metamo"e%- )? %ines 'pray BcoreC :';- +89 %ines 'hape :';- 8*8 %ines 'ty%e- * %ines

Tota%- 7=< %ines


F hours or "ays

Generate" (o"e- )7* #i%es& G+)/*** %ines


F weeks or months
(o"eGeneration )*+) - Marko Boger )?

Potrebbero piacerti anche