EuGENia: Kick-start your GMF editor development

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

About these ads
This entry was posted in Uncategorized. Bookmark the permalink.

18 Responses to EuGENia: Kick-start your GMF editor development

  1. Ed Merks says:

    Very cool. Nice screencast. Thanks for sharing it.

  2. 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. 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. 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. 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. Pingback: randomice.net » GMF toolkits

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

  11. Pingback: New in Epsilon 0.8.5 « Epsilon Weblog

  12. Omar says:

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

  13. new mdd says:

    I would like to know how to set up or customize

    gmf.compartment.layout = rowlist

    free

    list nodes in vertical order V
    (1)
    (2)
    (3)

    1.- Request
    rowlist nodes in horizontal order ESSENTIAL!!! >
    (1)(2)(3)

    2.- Filling first columns

    column.down-row.right v >
    (1)(4)(7)
    (2)(5)(-)
    (3)(6)(-)

    column.up-row.right ^ >
    (3)(6)(-)
    (2)(5)(-)
    (1)(4)(7)

    column.down-row.left V <
    (7)(4)(1)
    (-)(5)(2)
    (-)(6)(3)

    column.up-row.left ^ v
    (1)(2)(3)
    (4)(5)(6)
    (7)(-)(-)

    row.left-column.down ^
    (7)(-)(-)
    (4)(5)(6)
    (1)(2)(3)

    row.left-column.up < ^
    (-)(-)(7)
    (6)(5)(4)
    (3)(2)(1)

    4.- Random access

    matrix
    (5)(2)(7)
    (4)(-)(6)
    (-)(1)(3)

    I would need implement an ordered list of rows of ordered nodes.
    How could I do? If someone could help me, I would thank it.

    Thanks a lot.

    P.S. Moderator: Please, remove the previous 3 messages and this comment.

  14. new mdd says:

    I would like to know how to set up or customize

    gmf.compartment.layout = “rowlist”

    “free”

    “list” nodes in vertical order V
    (1)
    (2)
    (3)

    1.- Request
    “rowlist” nodes in horizontal order ESSENTIAL!!! order >
    (1)(2)(3)

    2.- Filling first columns (proposal)
    2.a.- “column.down-row.right” order v >
    (1)(4)(7)
    (2)(5)(-)
    (3)(6)(-)
    2.b.- “column.up-row.right” order ^ >
    2.c.- “column.down-row.left” order V <
    2.d.- "column.up-row.left" order ^ v
    (1)(2)(3)
    (4)(5)(6)
    (7)(-)(-)
    3.b.- “row.left-column.down” order ^
    3.d.- “row.left-column.up” order < ^
    (-)(-)(7)
    (6)(5)(4)
    (3)(2)(1)

    4.- Random access (proposal)
    matrix
    (5)(2)(7)
    (4)(-)(6)
    (-)(1)(3)

    I would need implement an ordered list of rows of ordered nodes.
    How could I do? If someone could help me, I would thank it.

    Thanks a lot.

    P.S. Moderator: Please, remove the previous 4 messages and this comment. I've had a problem of space when I pasted messages.

  15. Keith Duddy says:

    Please show me what the annotations end up looking like in the XMI or Ecore tree editor – I want to edit my existing Ecore, not redraft in your textual syntax.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s