Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Embedding xtext editors
Embedding xtext editors [message #43480] Fri, 08 May 2009 00:14 Go to next message
Porter is currently offline PorterFriend
Messages: 42
Registered: July 2009
Member
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.
Re: Embedding xtext editors [message #43604 is a reply to message #43480] Fri, 08 May 2009 07:23 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
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
Re: Embedding xtext editors [message #43692 is a reply to message #43604] Fri, 08 May 2009 11:35 Go to previous message
Krzysztof Kowalczyk is currently offline Krzysztof KowalczykFriend
Messages: 113
Registered: July 2009
Senior Member
> 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.
>

That was one of my ideas for GSoC
http://wiki.eclipse.org/GMF_and_Xtext_integration

ps. the location of wiki page is bad, I know.

Regards,
Krzysztof Kowalczyk
Previous Topic:[Announce] TMF XTEXT 0.7.0M7 is available
Next Topic:[xtext] propagate model changes to editor
Goto Forum:
  


Current Time: Fri Dec 27 02:54:42 GMT 2024

Powered by FUDForum. Page generated in 0.04216 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top