EuGENia: Kick-start your GMF editor development

By Dimitris Kolovos

GMF is a great piece of software in terms of features – and not only because it’s built atop GEF and EMF. Nevertheless, (here it comes) it also requires significant effort to learn, the error messages it produces during validation are often cryptic, the gmfmap wizard typically gets it all wrong, and all put together just make it too hard for the inexperienced user.

To reduce the effort required to build a basic editor we’ve implemented a tool, called EuGENia, which can derive the gmfgraph, gmftool and gmfmap models that are required to generate a fully functional GMF editor using only the ECore metamodel itself, augmented with a few GMF-specific annotations (I know that annotations pollute metamodels but they’re irresistibly convenient).

The Filesystem editor example

In this example we’ll construct a GMF editor for a filesystem metamodel. To generate a basic GMF editor from the metamodel, all we need to know is that:

  • The root of the diagram is FileSystem
  • File and all of its subclasses (Drive, Folder, Shortcut etc) are nodes with a label that reflects the value of their name attribute
  • Shortcut.target is a link
  • Sync is also a link class with Sync.source as the one end, Sync.target as the other and lastSync as the label

To capture the above, plus a bit of formatting information, we add the following @gmf.* annotations to the metamodel (in Emfatic):

@namespace(uri="filesystem", prefix="filesystem")
@gmf
package filesystem;

@gmf.diagram
class Filesystem {
    val Drive[*] drives;
    val Sync[*] syncs;
}

class Drive extends Folder {

}

class Folder extends File {
    @gmf.compartment
    val File[*] contents;
}

class Shortcut extends File {
    @gmf.link(target.decoration="arrow", style="dash")
    ref File target;
}

@gmf.link(label="lastSync", source="source",
                 target="target", style="dot", width="2")
class Sync {
    ref File source;
    ref File target;
    attr String lastSync;
}

@gmf.node(label = "name")
class File {
    attr String name;
}

Through the process demonstrated in this screencast EuGENia can generate the following editor without the user needing to touch any of the .gmfgraph, .gmfmap or .gmftool models manually.

image

Obviously EuGENia doesn’t support all the options the .gmfgraph and .gmfmap models do but only a small subset of commonly needed features. A complete list of the annotations EuGENia supports as well as instructions for obtaining it is available here.

Follow up: EuGENia: Polishing your GMF editor

13 Responses to “EuGENia: Kick-start your GMF editor development”

  1. Ed Merks Says:

    Very cool. Nice screencast. Thanks for sharing it.

  2. Dimitrios Kolovos Says:

    Thanks Ed :) We’ll hopefully release some other stuff I’ve been working on lately (validation+quick-fixes for EMG/GMF editors) soon.

  3. Jevon Says:

    Nice project :)

  4. Dimitrios Kolovos Says:

    Thanks. Looking forward to bug reports – although I’m quite sure there aren’t any ;) – and feature requests.

  5. Tor Neple Says:

    Dimitros!

    This looks oh so promising. Looking forward to discuss this in York in September. I will give it a spin on one or two of our examples.

  6. Dimitrios Kolovos Says:

    Hey Tor. Nice to hear from you! See you in September in York (or in internet-less Portsmouth :) )

  7. Sami Says:

    Hi!
    I am interested in EuGENia. What are the requirements? If i click filesytem.emf, An error has occurred : antlr/TokenStreamException”. What is my fault? Thanks.

  8. Dimitrios Kolovos Says:

    Hi Sami,

    Thanks for your interest in EuGENia. Could you please re-post your question to the GMT newsgroup (subject prefixed with [Epsilon])? Instructions for posting to the newsgroup are available in http://wiki.eclipse.org/index.php/Webmaster_FAQ#How_do_I_access_the_Eclipse_newsgroups.3F

    Cheers,
    Dimitrios

  9. randomice.net » GMF toolkits Says:

    [...] your metamodel (*.ecore) – preferably generated using Emfatic. Dimitrios Kolovos has written a nice tutorial and created a [...]

  10. Error Markers and Quick Fixes in GMF editors using EVL « Epsilon Weblog Says:

    [...] The following screenshot shows a file system model in a GMF-based editor (constructed here). [...]

  11. New in Epsilon 0.8.5 « Epsilon Weblog Says:

    [...] added support for several more options to EuGENia (the front-end provided by Epsilon for simplifying the development of GMF editors), such as for [...]

  12. Omar Says:

    I do not find this useful. I need a more detailed steps..

Leave a Reply