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.
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
Very cool. Nice screencast. Thanks for sharing it.
Thanks Ed
We’ll hopefully release some other stuff I’ve been working on lately (validation+quick-fixes for EMG/GMF editors) soon.
Nice project
Thanks. Looking forward to bug reports – although I’m quite sure there aren’t any
– and feature requests.
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.
Hey Tor. Nice to hear from you! See you in September in York (or in internet-less Portsmouth
)
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.
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
Pingback: randomice.net » GMF toolkits
Pingback: Error Markers and Quick Fixes in GMF editors using EVL « Epsilon Weblog
Pingback: New in Epsilon 0.8.5 « Epsilon Weblog
I do not find this useful. I need a more detailed steps..
http://www.eclipse.org/gmt/epsilon/doc/articles/eugenia-gmf-tutorial/ is what you’re probably looking for.
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.
Could you please post your question to the Epsilon forum? http://www.eclipse.org/forums/index.php?t=thread&frm_id=22
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.
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.
I’ve recorded the following screencast that demonstrates how to do this: http://dl.dropbox.com/u/5636547/ecoreanndemo.swf. If you have any further questions on this, could you please post them to Epsilon’s forum, which we check more regularly (http://www.eclipse.org/forums/index.php?t=thread&frm_id=22)?
Cheers,
Dimitris