EuGENia: GMF for mortals<br />Dimitris Kolovos, Louis Rose, Richard Paige<br />{dkolovos, louis, paige}@cs.york.ac.uk<br /...
Aim: Implement a graphical <br />editor for a DSL<br />
Technologies: Eclipse, EMF, GMF<br />
Our Metamodel (in EMF/Ecore)<br />
How EMF Works<br />
How GMF Works<br />Meta<br />Model<br />
How GMF Works<br />Meta<br />Model<br />
The GMF Tooling Model<br />
How GMF Works<br />Meta<br />Model<br />
The GMF Graph Model<br />
How GMF Works<br />Meta<br />Model<br />
Mapping Model Wizard<br />
The GMF Mapping Model<br />
How GMF Works<br />Meta<br />Model<br />
The Generator Model<br />
How GMF Works<br />Meta<br />Model<br />
Powerful<br />
Configurable<br />
Labour intensive<br />
Hard to master<br />
Error prone<br />
Replace it<br />Make it easier<br />
EuGENia<br />
How EuGENia Works<br />
Our Metamodel<br />
Our Metamodel (in Emfatic)<br />
Our annotated metamodel<br />
A closer look…<br />
Filesystem<br />@gmf.diagram<br />class Filesystem {<br />val Drive[*] drives;<br />val Sync[*] syncs;<br />}<br />
File<br />@gmf.node(label=“name”)<br />class File {<br />attr String name;<br />}<br />
Shortcut<br />@gmf.node(label=“name”)<br />class Shortcut extends File {<br />attr String name;<br />@gmf.link(target.deco...
Folder<br />@gmf.node(label=“name”)<br />class Folder extends File {<br />attr String name;<br />@gmf.compartment<br />val...
Drive<br />@gmf.node(label=“name”)<br />class Drive extends Folder {<br />attr String name;<br />@gmf.compartment<br />val...
Sync<br />@gmf.link(label=&quot;lastSync&quot;, source=&quot;source&quot;,<br />                 target=&quot;target&quot;...
How EuGENia Works<br />
Customize it!<br />
Polishing your Editor<br />Add EOL scripts next to your metamodel to customize the produced GMF models<br />ECore2GMF.eol ...
Polishing Example<br />// Set Shortcut’s label font to italic<br />varshortcutLabel = GmfGraph!Label.all.<br />selectOne(l...
More features<br />Custom Java figures<br />Internal/external/composite labels<br />Affixed nodes<br />Phantom nodes<br />...
Good stuff<br />Easy<br />High level<br />Hides GMF details<br />Change resilient<br />Can target different editor framewo...
Not so good stuff<br />Not 1:1 GMF mapping<br />By construction<br />Polishing compensates for this<br />Pollutes metamode...
Implementation Notes<br />2 Model-to-Model Transformations<br />1235 Lines of Code<br />Transformations in EOL<br />Epsilo...
Community<br />Well-received contribution<br />Forum activity<br />http://www.eclipse.org/gmt/epsilon/forum<br />Requests ...
Resources<br />Download<br />www.eclipse.org/gmt/epsilon<br />Tutorial (+ list of annotations)<br />www.eclipse.org/gmt/ep...
Próxima SlideShare
Cargando en…5
×

Eugenia

29.987 visualizaciones

Publicado el

EuGENia is a tool that automatically generates the .gmfgraph, .gmftool and .gmfmap models needed to implement a GMF editor from a single annotated Ecore metamodel. EuGENia provides high-level annotations that shield you from the complexity of GMF and lowers the entrance barrier for creating your first GMF editor. While EuGENia is very useful for getting started with GMF, it doesn't stop there and can be used all the way to the final polished version of your editor.

Publicado en: Tecnología, Educación
  • Sé el primero en comentar

Eugenia

  1. 1. EuGENia: GMF for mortals<br />Dimitris Kolovos, Louis Rose, Richard Paige<br />{dkolovos, louis, paige}@cs.york.ac.uk<br />@dskolovos, @louismrose, @richpaige<br />Department of Computer Science<br />University of York<br />
  2. 2. Aim: Implement a graphical <br />editor for a DSL<br />
  3. 3. Technologies: Eclipse, EMF, GMF<br />
  4. 4. Our Metamodel (in EMF/Ecore)<br />
  5. 5. How EMF Works<br />
  6. 6. How GMF Works<br />Meta<br />Model<br />
  7. 7. How GMF Works<br />Meta<br />Model<br />
  8. 8. The GMF Tooling Model<br />
  9. 9. How GMF Works<br />Meta<br />Model<br />
  10. 10. The GMF Graph Model<br />
  11. 11. How GMF Works<br />Meta<br />Model<br />
  12. 12. Mapping Model Wizard<br />
  13. 13. The GMF Mapping Model<br />
  14. 14. How GMF Works<br />Meta<br />Model<br />
  15. 15. The Generator Model<br />
  16. 16. How GMF Works<br />Meta<br />Model<br />
  17. 17.
  18. 18. Powerful<br />
  19. 19. Configurable<br />
  20. 20. Labour intensive<br />
  21. 21. Hard to master<br />
  22. 22. Error prone<br />
  23. 23. Replace it<br />Make it easier<br />
  24. 24. EuGENia<br />
  25. 25. How EuGENia Works<br />
  26. 26. Our Metamodel<br />
  27. 27. Our Metamodel (in Emfatic)<br />
  28. 28. Our annotated metamodel<br />
  29. 29. A closer look…<br />
  30. 30. Filesystem<br />@gmf.diagram<br />class Filesystem {<br />val Drive[*] drives;<br />val Sync[*] syncs;<br />}<br />
  31. 31. File<br />@gmf.node(label=“name”)<br />class File {<br />attr String name;<br />}<br />
  32. 32. Shortcut<br />@gmf.node(label=“name”)<br />class Shortcut extends File {<br />attr String name;<br />@gmf.link(target.decoration=&quot;arrow&quot;, <br /> style=&quot;dash&quot;)<br />ref File target;<br />}<br />
  33. 33. Folder<br />@gmf.node(label=“name”)<br />class Folder extends File {<br />attr String name;<br />@gmf.compartment<br />val File[*] contents;<br />}<br />
  34. 34. Drive<br />@gmf.node(label=“name”)<br />class Drive extends Folder {<br />attr String name;<br />@gmf.compartment<br />val File[*] contents;<br />}<br />
  35. 35. Sync<br />@gmf.link(label=&quot;lastSync&quot;, source=&quot;source&quot;,<br /> target=&quot;target&quot;, style=&quot;dot&quot;, width=&quot;2&quot;)<br />class Sync {<br />ref File source;<br />ref File target;<br />attr String lastSync;<br />}<br />
  36. 36. How EuGENia Works<br />
  37. 37. Customize it!<br />
  38. 38. Polishing your Editor<br />Add EOL scripts next to your metamodel to customize the produced GMF models<br />ECore2GMF.eol &lt;- .gmfgraph, .gmftool, .gmfmap<br />FixGMFGen.eol &lt;- .gmfgen<br />EuGENia picks them up and runs them after the built-in transformations<br />www.eclipse.org/gmt/epsilon/doc/articles/eugenia-polishing<br />
  39. 39. Polishing Example<br />// Set Shortcut’s label font to italic<br />varshortcutLabel = GmfGraph!Label.all.<br />selectOne(lbl | lbl.name = &quot;ShortcutLabelFigure&quot;);<br />shortcutLabel.font = createItalicFont();<br />operationcreateItalicFont() {<br />var font = new GmfGraph!BasicFont;<br />font.style = GmfGraph!FontStyle#ITALIC;<br />return font;<br />}<br />
  40. 40. More features<br />Custom Java figures<br />Internal/external/composite labels<br />Affixed nodes<br />Phantom nodes<br />Combined diagram/model file<br />Model/diagram extension<br />Copyright text (in separate copyright.txt file)<br />
  41. 41. Good stuff<br />Easy<br />High level<br />Hides GMF details<br />Change resilient<br />Can target different editor frameworks in the future<br />Further customization with EOL<br />www.eclipse.org/gmt/epsilon/doc/articles/eugenia-polishing<br />
  42. 42. Not so good stuff<br />Not 1:1 GMF mapping<br />By construction<br />Polishing compensates for this<br />Pollutes metamodel<br />Trade-off for usability<br />
  43. 43. Implementation Notes<br />2 Model-to-Model Transformations<br />1235 Lines of Code<br />Transformations in EOL<br />Epsilon Object Language (≈ JavaScript + OCL) www.eclipse.org/gmt/epsilon/doc/eol<br />Try EOL in your browserwww.eclipse.org/gmt/epsilon/live<br />
  44. 44. Community<br />Well-received contribution<br />Forum activity<br />http://www.eclipse.org/gmt/epsilon/forum<br />Requests for enhancements<br />#265145, #265285, #265609, #268085, #285912 … <br />Comments in Epsilon’s blog<br />http://epsilonblog.wordpress.com<br />
  45. 45. Resources<br />Download<br />www.eclipse.org/gmt/epsilon<br />Tutorial (+ list of annotations)<br />www.eclipse.org/gmt/epsilon/doc/eugenia<br />Examples<br />www.eclipse.org/gmt/epsilon/examples<br />Screencasts<br />www.eclipse.org/gmt/epsilon/cinema<br />Follow Epsilon on Twitter @epsilonews<br />

×