Tuesday, July 28, 2009

Source code for the screencast of Xtext and GMF

Having received a lot of positive feedback for my last post, I finally found the time to make the source code available. You can find it in the SVN repository of the GMFTools project.

I have put the installation instructions here.

Note that this is proof-of-concept code rather than production quality. See my previous post for implementational details. Also note that two open bugs
currently limit the fun a little bit, but we're at least working on the Xtext part.

9 comments:

Maurice said...

Thanks for posting this!

Unknown12 said...

Thanks for the sourcecode, Uli

Stéphane said...

Hi Jan,

How to you deal with invalid models? If the original model has a linking error (e.g. a ref to an unexisting entity), you will be able to open the diagram, but not to save it afterwards (for instance, you shall get an exception as
Error serializing CrossRefs: Unable to create a string represenation for reference 'Entity' using org.eclipse.xtext.linking.impl.DefaultLinkingService EReference: type Context:org.xtext.cg2009.entities.impl.ReferencePropertyImpl@508317 (name: bar) (many: false) Target:org.xtext.cg2009.entities.impl.EntityImpl@179defb (eProxyURI: platform:/resource/gmf_xtext/src/model.entity#xtextLink_::World.bar::http://www.xtext.org/cg2009/Entities#//ReferenceProperty/type::/7)

Unknown said...

Hi Stéphane,

thanks for the feedback. Knut has cast it into a bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=285826

Note that the code is quite exemplary and far from production quality. There are several issues that still have to be taken care of. The main incompatibilities arising are

1) GMF makes strong assumptions on the structure of the Ecore model, e.g. with regard to containment references.
2) Xtext does neither assure nor check if a model that is modified from outside of Xtext can be serialized or not.

While I see little hope for the first point, we're working on improving the second.

Endre said...

Hi Jan,

I just stumbled upon your synchronized editor while reading up on Domain-Driven Design for my BSc thesis. I would really like to use it as a reference when introducing my own approach, which will be based on Eugenia.
However, I just spent several rather frustrating evenings trying to get your example to work.
I know of http://code.google.com/p/gmftools/wiki/GMF_and_Xtext and also of http://code.google.com/p/gmftools/wiki/Prerequistes .I just can't get all dependencies and needed extensions to work in the same time. Given that the post is almost a year old, it might even happen that I'm using plugin versions that are too new... I can't think of anything else anymore. Do you have like, a guide for dummies, or something that takes everything from the beginning, that I could follow step by step, and get to the same Eclipse configuration that you used when running your application?

Unknown said...

The code has become an example shipped with Xtext. Choosing File->New...->Example->Xtext GMF Integration Example in the HEAD revision of Xtext (Helios RC) will import the necessary plugins into your workspace. The Eclipse Help on Xtext also describes a lot of what is going on.

Mr Lonely said...

Hi Jan!

I'm a newbie in Xtext.
I was building a plugin with GMF model, it generated to XML code, and now, I want to generate to my templates code, Ex:
global {
var aaa type: int value: 1000;...
}

I was try with your introduction, but I build it with Eclipse Indigo,... some import not work,...

Can you help me build a editor with Indigo?

Thanks advance!!

Mr Lonely said...

Well done,

I just do it, everything okay.
I deleted Xtext project(*.solution and *.solution.ui), and then create new Xtext project, and step by step with your introduction. Done.

Thanks for posting this!

Mr Lonely said...

Hi Jan,

I created new project, but I can't create the transformer model by GMF Tools.

Help me please!!!