|
Re: Embedding xtext editors [message #43604 is a reply to message #43480] |
Fri, 08 May 2009 07:23 |
Jan Koehnlein Messages: 760 Registered: July 2009 Location: Hamburg |
Senior Member |
|
|
Hi,
integration will not be that easy as with EMF / GMF, as Xtext throws
away a complete section of the model on changes (fortunately, it's a
section rather than the whole model as we employ partial parsing). GMF's
CanonicalEditPolicy would then automatically delete all diagram elements
corresponding to the deleted model elements. No matter if the Xtext
parser reconstructs that model section later, the diagram information
would be lost.
When editing a textual model, the model is invalid most of the time, as
the user is in the midst of filling in something. That is a big
difference to structural model editors, such as tree or diagram editors,
which seldom go through inconsistent models. So a direct coupling to a
structural editor wouldn't offer much benefit. You can have an
impression of that if you enable "Synch with editor" in the Outline view
while editing an Xtext model. Watch sections of the model appear and
disppear while you type...
That's why I think synchronization on save would be a better approach.
I've prepared a small prototype for that, but there are still some minor
issues with TMF/Xtext that have to be fixed. We'll have that fixed for
Galileo.
The base integration mechanism is the XtextResource, which encapsulates
the parser (text->EMF) as well as the serializer (EMF->text). As GMF is
implemented against that resource API, you can in fact use the textual
format as the primary serialization format. That brings a lot of
benefits, such as easy diff/merge of models, resilience against
metamodel evolution etc.
I've done that integration with oAW/Xtext, but that was still kind of
hard to do, as the serializer part had to be coded by hand. But it
worked. You can see the result here:
http://ftp.itemis.de/oaw/screencast_converging_editors/conve rging_editors.html
It'd be also interesting to use Xtext for sections of the model: Imagine
to have a graphical overview, showing the rough structure of your model.
When you click on a specific node, an embedded textual editor opens that
allows to fill in the details. That way, you can have best of both
worlds: Element connections in graphical notation and details in
textual. As soon as I have a little time, I'll investigate on that.
Best regards
Jan
Porter schrieb:
> Would it be feasible to embed an xtext editor in one panel of a
> multipage editor together with an EMF and/or GMF editor?
>
> For example, there's a well-known tutorial on eclipse.org and a similar
> example in the GMF book showing how to integrate generated EMF and GMF
> editors into a multipage editor.
>
> Doing a similar thing with an xtext editor would be absolutely capital.
> Imagine having the GMF/EMF tree and xtext editors integrated or perhaps
> others such as the Generic emf form editor (originally from oaw). You'd
> then have something similar to one of the xsd editors or visual editors
> for your own metamodel. Since the xtext model works so well with EMF/GMF
> it would make sense to leverage this potential.
>
> Has anyone tried this? Where would one start? In the EMF/GMF example
> both editors share a TransactionalEditingDomain, with the EMF editor
> being modified to do so.
>
> I don't imagine this would be simple.
>
>
>
>
>
>
>
---
Get professional support from the Xtext committers at www.typefox.io
|
|
|
|
Powered by
FUDForum. Page generated in 0.04216 seconds