7
Spray A Quick way of Creating Graphiti A (very) short Introduction Jos Warmer ([email protected])

Spray A Quick way of Creating Graphiti A (very) short Introduction Jos Warmer ([email protected])

Embed Size (px)

Citation preview

Page 1: Spray A Quick way of Creating Graphiti A (very) short Introduction Jos Warmer (jos.warmer@openmodeling.nl)

Spray A Quick way of Creating Graphiti

A (very) short Introduction

Jos Warmer ([email protected])

Page 2: Spray A Quick way of Creating Graphiti A (very) short Introduction Jos Warmer (jos.warmer@openmodeling.nl)

© SAP AG 2009. All rights reserved. / Page 2

OpenModeling

Adapted from presentation at Code Generation 2011, Cambridge

Graphiti Approach

No code generation but: Uses a runtime engine Programmed using a Java API Easy (relatively) to understand code Easy to keep up with evolving metamodel

But … Programming the editor in Java is much (simple and

repetitive) work

Page 3: Spray A Quick way of Creating Graphiti A (very) short Introduction Jos Warmer (jos.warmer@openmodeling.nl)

© SAP AG 2009. All rights reserved. / Page 3

OpenModeling

Adapted from presentation at Code Generation 2011, Cambridge

The Spray Graphiti Generator

Started out as generic generator Had to be adapted to the PMW project Is currently partly generic, partly project specific

Used by non IT users in production Works well (at least for PMW )

Page 4: Spray A Quick way of Creating Graphiti A (very) short Introduction Jos Warmer (jos.warmer@openmodeling.nl)

© SAP AG 2009. All rights reserved. / Page 4

OpenModeling

Adapted from presentation at Code Generation 2011, Cambridge

The Spray DSL

class Product icon "Product16.png": container (figure="PmwProduct“) [ text ( bold ) "Product“ ; text ( italic) name ; text ( normal) "V" version ; ] [ reference attributeSpecs : connection ( ) reference note : connection ( ) ] behavior [ create palette “PartPalette” openVersionedPartEditor "Open Part“ ; selectInExplorer "Select In Explorer“; deletePart "Delete Part" ; refresh "Refresh Diagram“ ; ]

Define visualization for metaclass

Product

Definition of shape

Contents of the

container

References to properties of

Product

References of product shown as

connections

Behaviour for

Product shape

Popup menu

Will be in palette to create in named

compartment

Icon shown in palette

Page 5: Spray A Quick way of Creating Graphiti A (very) short Introduction Jos Warmer (jos.warmer@openmodeling.nl)

© SAP AG 2009. All rights reserved. / Page 5

OpenModeling

Adapted from presentation at Code Generation 2011, Cambridge

The Spray DSL

class ConceptComposition icon "connection16.gif“ : connection (width=2) [ from part to concept toText multiplicity ]

Define visualization for metaclass

ConceptComposition

Shown as a connection (line)

Part and concept are references in class

ConceptComposition

Text to show at the “to” side, also options for “from” and middle of

connection

Page 6: Spray A Quick way of Creating Graphiti A (very) short Introduction Jos Warmer (jos.warmer@openmodeling.nl)

© SAP AG 2009. All rights reserved. / Page 6

OpenModeling

Adapted from presentation at Code Generation 2011, Cambridge

Spray Generator

Using textual model to define graphical editor Xtext, Xtend, Xpand

Mixing generated and handwritten code by design Uses Generation Gap pattern 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.

Page 7: Spray A Quick way of Creating Graphiti A (very) short Introduction Jos Warmer (jos.warmer@openmodeling.nl)

© SAP AG 2009. All rights reserved. / Page 7

OpenModeling

Adapted from presentation at Code Generation 2011, Cambridge

Spray Future

Spray will become open source later this year Oops, already there at:

http://code.google.com/a/eclipselabs.org/p/spray/ Version 0.1 will be the version used for PMW Need to generalize PMW specific generator code and then … first contribution expected a.s.a.p.

EPL License Might become an Eclipse project (or part of an existing

Eclipse project)

Plans Growing Spray by adding more features as we go …..