Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
E GENi GMF f lEuGENia: GMF for mortals
Dimitris Kolovos, Louis Rose, Richard Paige{dkolovos, louis, paige}@cs.york.ac.uk@dskolovos, @louismrose, @richpaige
Department of Computer SciencefUniversity of York
Aim: Implement a graphical p g peditor for a DSL
Technologies: Eclipse, EMF, GMFg p , ,
Our Metamodel (in EMF/Ecore)Our Metamodel (in EMF/Ecore)
How EMF WorksHow EMF Works
Metamodel
Generator Model Code Generator
How GMF WorksHow GMF Works
Meta
Model
Graph Model
Tooling Model
Mapping Model
Generator Model Code Generator
How GMF WorksHow GMF Works
Meta
Model
Graph Model
Tooling Model
Mapping Model
Generator Model Code Generator
The GMF Tooling ModelThe GMF Tooling Model
How GMF WorksHow GMF Works
Meta
Model
Graph Model
Tooling Model
Mapping Model
Generator Model Code Generator
The GMF Graph ModelThe GMF Graph Model
How GMF WorksHow GMF Works
Meta
Model
Graph Model
Tooling Model
Mapping Model
Generator Model Code Generator
Mapping Model WizardMapping Model Wizard
The GMF Mapping ModelThe GMF Mapping Model
How GMF WorksHow GMF Works
Meta
Model
Graph Model
Tooling Model
Mapping Model
Generator Model Code Generator
The Generator ModelThe Generator Model
How GMF WorksHow GMF Works
Meta
Model
Graph Model
Tooling Model
Mapping Model
Generator Model Code Generator
Powerful
Configurable
Labour intensive
Hard to master
Error prone
Replace itp
EuGENia
How EuGENia WorksHow EuGENia Works
Metamodel+
AnnotationsAnnotations
Graph ModelTooling ModelMapping Model
GMF
Our MetamodelOur Metamodel
Our Metamodel (in Emfatic)Our Metamodel (in Emfatic)
Our annotated metamodelOur annotated metamodel
A closer look…
FilesystemFilesystem
@gmf [email protected] Filesystem {val Drive[*] drivesval Drive[*] drives;val Sync[*] syncs;
}}
FileFile
@gmf node(label “name”)@gmf.node(label=“name”)class File {attr String nameattr String name;
}
ShortcutShortcut
@gmf node(label “name”)@gmf.node(label=“name”)class Shortcut extends File {attr String nameattr String name;@gmf.link(target.decoration="arrow",
style "dash")style="dash")ref File target;
}}
FolderFolder
@gmf node(label “name”)@gmf.node(label=“name”)class Folder extends File {attr String nameattr String name;@gmf.compartmentval File[*] contentsval File[*] contents;
}
DriveDrive
@gmf node(label “name”)@gmf.node(label=“name”)classDrive extends Folder {attr String nameattr String name;@gmf.compartmentval File[*] contentsval File[*] contents;
}
SyncSync
@gmf link(label "lastSync" source "source"@gmf.link(label="lastSync", source="source",target="target", style="dot", width="2")
class Sync {class Sync {ref File source;ref File targetref File target;attr String lastSync;
}}
How EuGENia WorksHow EuGENia Works
Metamodel+
AnnotationsAnnotations
Graph ModelTooling ModelMapping Model
GMF
Customize it!
Polishing your EditorPolishing your Editor
Add EOL scripts next to your metamodel to customize the produced GMF modelscustomize the produced GMF models
ECore2GMF.eol <‐ .gmfgraph, .gmftool, .gmfmapFi GMFG l fFixGMFGen.eol <‐ .gmfgen
EuGENia picks them up and runs them after the built‐in transformations
www.eclipse.org/gmt/epsilon/doc/articles/eugenia‐polishing
Polishing ExamplePolishing Example
// Set Shortcut’s label font to italic// Set Shortcut’s label font to italicvar shortcutLabel = GmfGraph!Label.all.selectOne(lbl | lbl.name = "ShortcutLabelFigure");
shortcutLabel.font = createItalicFont();
operation createItalicFont() {operation createItalicFont() {var font = new GmfGraph!BasicFont;font st le GmfGraph!FontSt le#ITALICfont.style = GmfGraph!FontStyle#ITALIC;return font;
}
Live Demo
More featuresMore features
Custom Java figuresInternal/external/composite labelsInternal/external/composite labelsAffixed nodesPhantom nodesCombined diagram/model fileCombined diagram/model fileModel/diagram extensionCopyright text (in separate copyright.txt file)
Good stuffGood stuff
EasyHigh levelHigh levelHides GMF detailsChange resilientCan target different editor Can target different editor frameworks in the futureF h i i i h EOLFurther customization with EOL
www.eclipse.org/gmt/epsilon/doc/articles/eugenia‐polishing
Not so good stuffNot so good stuff
Not 1:1 GMF mappingBy constructionBy constructionPolishing compensates for this
ll d lPollutesmetamodelTrade‐off for usability
Implementation NotesImplementation Notes
2 Model‐to‐Model Transformations1235 Lines of Code1235 Lines of CodeTransformations in EOL
Epsilon Object Language (≈ JavaScript + OCL) www.eclipse.org/gmt/epsilon/doc/eolTry EOL in your browserwww.eclipse.org/gmt/epsilon/live
CommunityCommunity
Well‐received contributionForum activityForum activityhttp://www.eclipse.org/gmt/epsilon/forum
R t f h tRequests for enhancements#265145, #265285, #265609, #268085, #285912 …
C l blComments in Epsilon’s bloghttp://epsilonblog.wordpress.com
ResourcesResources
Downloadwww eclipse org/gmt/epsilonwww.eclipse.org/gmt/epsilon
Tutorial (+ list of annotations)www.eclipse.org/gmt/epsilon/doc/eugenia
Examplespwww.eclipse.org/gmt/epsilon/examples
ScreencastsScreencastswww.eclipse.org/gmt/epsilon/cinema
Follow Epsilon on Twitter @epsilonews
AcknowledgementsAcknowledgements
ModelPlex EU Projectwww modelplex orgwww.modelplex.org