February 18th, 2008
xtext with external references
I have just seen, that by now xText supports external references out of the box. This is a long awaited and really useful feature. Thanks a lot.
Archive for February, 2008
February 18th, 2008
I have just seen, that by now xText supports external references out of the box. This is a long awaited and really useful feature. Thanks a lot.
February 18th, 2008
Step 1 (real live): You have the wish to get a cup of tea of “Pai Mu Tan”.
Step 2 (model): You are creating a wish-model containing an element of type “Cup” which has an attribute named “content” of type string and the value “Pai Mu Tan”. The model is the digital representation of a real-life-wish.
Step 3 (metamodel): You want to create other wishes too and you are designing a metamodel. The wish-metamodel contains a the root element “Wishes” containing a many-containment reference “wishes” to the type “Wish”. The abstract type “Wish” is derived by the types “Cup”, “Book”, “FreshAir” and “OtherWish”. “Cup” has an attribute “content” while “Book” has an attribute “title” of type String. “FreshAir” does not need an attribute and “OtherWish” has no meaningful attributes. Using the wish-metamodel you could express a lot of wishes.
Step 4 (editor): You want others to express their wishes. Let’s create an editor, they could use to do that. Using Eclipse and your metamodel it is really simple to create an EMF based tree editor. You are happy.
Step 5 (great models): Your models grow (you have extended your metamodel with other wish-types) and you want to group your wishes by occasion (Birthday, Christmas, other) if they are of long-term, short-term or just-now. You are doing that by extending the metamodel with other types (AbstractOccasion, Birthday, Christmas, AbstractWhen, LongTerm, ShortTerm, JustNow) and some connection types connecting your wish with when they should be active. it is hard to keep the overview about all your wishes – you want a better editor (which is a wish-type of it’s own).
Step 6 (graphical editor): You have chosen GMF as your editor framework. It is great – you could express all you want – your wishes, the occasions and whether your wishes are more short- or long-term in a model driven way and without writing one single line of java-code. Now you have the overview about all the wishes.
Step 7 (more wish-types): Every time you create a new wish-type in your metamodel you have to copy-and-paste-and-change some parts of the GMF-models to express the editor object for your new type. You want more abstraction like a templating engine for GMF-models.
I am currently developing such a model-templating engine called GenGMF. You could create a template-tree for the GMF-Graph and for the GMF-Map models having place-holders for the type-names you want to instantiate (e.g. “__TYPENAME__NodeFigure”) and some modelled instructions how to instantiate the tree in the GMF-models. It is even possible to change the instantiated trees on-the-fly. For example – I reengineered the sample editor from one of my last posts. The rectangle and the elliptic nodes are instantiated from the same template (which only knows rectangles). A XTend-based creation Filter changes the Rectangle to Ellipse – the rest of the tree is the same. Post processing (also via XTend) is also available to insert more stuff into the generated models.
February 7th, 2008
10% done.
20% done.
30% done.
40% done.
50% done.
60% done.
70% done.
80% done.
90% done.
100% done.
110% done.
120% done.
130% done.