The example has been implemented with only a few changes to generated code: In Xtext, the following modifications were applied:
- A Formatter to define where to use what kind of whitespace, when the textual representation is derived from the semantic model.
- An IFragmentProvider that generates name-based fragments (IDs) for elements in an Xtext resource. That way, the correspondence of graphical nodes to semantic elements is preserved even if you delete a preceeding entity.
- An AbstractEntitiesJavaValidator has been implemented for Java based validation
On the GMF side:
- In the mapping model, I had to use feature initializers to make sure names are initialized properly on creation, to always have serializable models.
- In the generator model, I had to manually set the domain genmodel and the file extension.
- In the generator model, I enabled validation decorators and printing, and added the plug-in de.itemis.gmf.runtime.extensions from the GMFTools project containing a more sophisticated layout.
Additionally, I added a bit of glue code:
- An action to navigate from an EditPart to the textual representation, using Xtext's NodeAdapter.
- A listener that warns the user if (s)he's about to change a file that has already been changed in another dirty editor, and allows to abandon the changes.
The editor are synchronizing on save, to avoid GMF's canonical edit policies pruning nodes/edges belonging to temporarily lost elements.
Xtext plays well with EMF. It registers
- A resource factory for a specific XtextResource implementation that encapsulates the parser (text->model) as well as the serializer (model->text).
- An EValidator with a declarative Java implementation

9 comments:
Hi Jan,
great demo what is possible in the mix between text and graph.
Is there a place to get more info (perhaps download) of this demonstration?
Thanks, Uli
Nice! :)
Very impressive, this will make for some awesome use cases for combined editors.
Looks better than I had hoped given how the Xtext AST branches get contunually rebuilt.
Would love to see the demo code, something like this would be great as an Xtext example project with the plugins.
really nice demo.
it would beneficial to have a simple tutorial (with source) how it is possible to get the GMF stuff from an xtext project.
This is a great achievement, Jan. I have recommended your screencast to many people already and won't stop that soon...
Hi Jan, this is really cool.
It would help if you could provide the sample source code of the project in the screen cast.
Cheers
Andreas
Would love to get the source for this!
I've just published the source code. Please have a lok at http://koehnlein.blogspot.com/2009/07/source-code-for-screencast-of-xtext-and.html. Sorry for the long delay.
Post a Comment