Upload
nickolas-black
View
213
Download
0
Embed Size (px)
Citation preview
Spraying The Natural Way of Creating Graphiti
Jos Warmer, Independent [email protected] Thoms, Itemis [email protected]
© SAP AG 2009. All rights reserved. / Page 2EclipseCon Europe 2011, Ludwigsburg
Graphiti Approach
No code generation but: Uses a runtime engine Programmed using a Java API Easy (relatively) to understand code
© SAP AG 2009. All rights reserved. / Page 3EclipseCon Europe 2011, Ludwigsburg
But …
Programming the editor in Java is much (often simple but repetitive) work.
E.g. for one shape for one metaclass: At least five feature classes: AddFeature, CreateFeature,
DeleteFeature, LayoutFeature, UpdateFeature Features all need to be configured in the FeatureProvider Need to configure palette in the ToolBehaviourProvider Need to configure used images in ImageProvider
Repeat this for e.g. ten metaclasses ……….
© SAP AG 2009. All rights reserved. / Page 4EclipseCon Europe 2011, Ludwigsburg
The Spray Graphiti Generator
Started a research project Got a government grant
Became useful before being finished Project for Visual Insurance Product Modeling language Spray had to be adapted to the PMW project Became partly generic, partly project specific
Resulting Editors are used by non IT users in production Works well (at least for PMW )
© SAP AG 2009. All rights reserved. / Page 5EclipseCon Europe 2011, Ludwigsburg
The Spray Graphiti Generator
Spray has become open source in July At: http://code.google.com/a/eclipselabs.org/p/spray/ Version 0.1 was the generalized version used for PMW EPL License
Current status Spray is in startup phase Much work done on infrastructure
Plans … growing Spray by adding more features as we go ….. … getting more users and more feedback …..
© SAP AG 2009. All rights reserved. / Page 6EclipseCon Europe 2011, Ludwigsburg
The Spray DSL
class BusinessClass icon “class.gif": container ( fill = dark_green ) [ text ( ) { "<<“ + eClass.name + ">> " + name}; line (color = black width = 2); reference properties attribute dataType; line (color = RGB(255,138,141)); text ( ) "::" + description; ] references [ superclass : connection(); ] behavior[ create palette "Shapes" ; doWithBusinessClass "Do It With“ ; ]
Define visualization for metaclass
BusinessClassContents of
the container References to
properties of metaclass
References of businessclass shown
as connections
Behaviour for
Product shape
Will be in palette to create in named
compartment
Icon shown in palette
List of referred objects
Custom behavior
© SAP AG 2009. All rights reserved. / Page 7EclipseCon Europe 2011, Ludwigsburg
The Spray DSL
class Association icon “association.gif“ : connection (width = 2) [ from source to target fromText text() source.name toText text() targetMultiplicity.name]
Define visualization for metaclass Association
Shown as a connection (line)
Source and target are references in class
AssociationText to show at the “’from’ and ‘to’ to” side, also options for middle of
connection
© SAP AG 2009. All rights reserved. / Page 8EclipseCon Europe 2011, Ludwigsburg
Spray Generator
Using textual model to define graphical editor Xtext 2, Xtend 2, Xbase
Mixing generated and handwritten code by design Uses Generation Gap pattern Allows full access to Graphiti API Managed by simply moving a generated file from “src-gen” to
“src” folder Generation of code from Spray DSL remains possible in full
project life-cycle.
© SAP AG 2009. All rights reserved. / Page 9EclipseCon Europe 2011, Ludwigsburg
Spray Vision
Making developing graphical DSL’s as easy as it is to develop textual DSL’s with e.g. Xtext.
© SAP AG 2009. All rights reserved. / Page 10EclipseCon Europe 2011, Ludwigsburg
Demo
Karsten will show a short demo by creating a simple Graphiti editor from scratch