Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Integrating Xtext into GMF-based Editor
Integrating Xtext into GMF-based Editor [message #985834] Fri, 16 November 2012 10:15 Go to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
Hi,

i'm new to xtext and i've got a problem. i'd like to integrate xtext into my GMF-based editor. i've searched a lot an found a lot, but i still don't understand how to do it. i generated an GMF editor from a ecore-model. i've attached the ecore model. i'm not exactly sure if this is correct. but Root is the Model Object. Second is a node which can be placed in the GMF diagram editor. third is a node too.
now i want to define an attribute (expression) in Second, in which i can write a string with an Xtext editor which references the objects of Third. i created a new Xtext project from the existing ecore. but now i don't know how to combine the editors.
i found YAKUNDA but either it's hardly described, or i don't understand it. there also was some kind of example in xtext but it was removed.
can someone help me?

regards

gw
  • Attachment: My.ecore
    (Size: 1.20KB, Downloaded 57 times)
Re: Integrating Xtext into GMF-based Editor [message #985931 is a reply to message #985834] Fri, 16 November 2012 17:52 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan Koehnlein
Messages: 656
Registered: July 2009
Senior Member
The example is still in Xtext's git repository. Look into the examples
folder. The Xtext documentation contains a link to it and explains the
basic steps.

In the meantime, Xtext ships with an EmbeddedEditor, that should make
things easier.

Still, to get it running requires decent knowledge on EMF, GMF and
Xtext. In the end you might only get a partially working solution not
covering each and every usecase. This - and the assumed death of the GMF
project in former Eclipse releases - made us skip shipping the example.

Am 16.11.12 11:15, schrieb Gideon Weber:
> Hi,
>
> i'm new to xtext and i've got a problem. i'd like to integrate xtext into my GMF-based editor. i've searched a lot an found a lot, but i still don't understand how to do it. i generated an GMF editor from a ecore-model. i've attached the ecore model. i'm not exactly sure if this is correct. but Root is the Model Object. Second is a node which can be placed in the GMF diagram editor. third is a node too.
> now i want to define an attribute (expression) in Second, in which i can write a string with an Xtext editor which references the objects of Third. i created a new Xtext project from the existing ecore. but now i don't know how to combine the editors.
> i found YAKUNDA but either it's hardly described, or i don't understand it. there also was some kind of example in xtext but it was removed.
> can someone help me?
>
> regards
>
> gw


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: Integrating Xtext into GMF-based Editor [message #986153 is a reply to message #985931] Mon, 19 November 2012 08:37 Go to previous messageGo to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
okay thanks,
but how to access the git-repository? i've no experience with git

regards
Re: Integrating Xtext into GMF-based Editor [message #986159 is a reply to message #986153] Mon, 19 November 2012 08:58 Go to previous messageGo to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
ahh okay got it.
thank you very much. i'll have a look at it.
do i have to do something special to access that embedded editor you mentioned?

regards,

gw
Re: Integrating Xtext into GMF-based Editor [message #986180 is a reply to message #986159] Mon, 19 November 2012 10:42 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan Koehnlein
Messages: 656
Registered: July 2009
Senior Member
Not much docu so far. Get a grip on the UI injector
http://koehnlein.blogspot.com/2012/11/xtext-tip-how-do-i-get-guice-injector.html
and use the EmbeddedEditorFactory (with its builder pattern) to create
and configure the embedded editor.

The editor allows to only edit a partial model
EmbeddedEditor.createPartialEditor(String, String, String, boolean)
which is what I'd expect to be needed for labels in a GMF editor.


Am 19.11.12 09:58, schrieb Gideon Weber:
> ahh okay got it.
> thank you very much. i'll have a look at it.
> do i have to do something special to access that embedded editor you
> mentioned?
>
> regards,
>
> gw


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: Integrating Xtext into GMF-based Editor [message #987387 is a reply to message #986180] Mon, 26 November 2012 11:58 Go to previous messageGo to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
sorry for the late response.
thank you very much. i'm currently delayed because of another problem with the scoping.
Re: Integrating Xtext into GMF-based Editor [message #987899 is a reply to message #986180] Wed, 28 November 2012 15:24 Go to previous messageGo to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
hi again,

i retraced the example and adapted my editor. now it nearly works. i can add an element. then the xtext popup show and i can write some text which is checked to be suitable to my grammar.
the problem is that when i write something and hit crtl+enter the popup closes but in the model-file only the new element was added but not the text i wrote for that element.
in console-view i get:

!ENTRY org.apache.log4j 4 0 2012-11-28 15:54:25.079
!MESSAGE org.eclipse.xtext.parser.impl.PartialParsingHelper - Invalid replace region [146 / length: 12] originalLength=26

can you help?
Re: Integrating Xtext into GMF-based Editor [message #987900 is a reply to message #987387] Wed, 28 November 2012 15:26 Go to previous messageGo to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
hi again,

i retraced the example and adapted my editor. now it nearly works. i can add an element. then the xtext popup show and i can write some text which is checked to be suitable to my grammar.
the problem is that when i write something and hit crtl+enter the popup closes but in the model-file only the new element was added but not the text i wrote for that element.
in console-view i get:

!ENTRY org.apache.log4j 4 0 2012-11-28 15:54:25.079
!MESSAGE org.eclipse.xtext.parser.impl.PartialParsingHelper - Invalid replace region [146 / length: 12] originalLength=26

can you help?
Re: Integrating Xtext into GMF-based Editor [message #987901 is a reply to message #987900] Wed, 28 November 2012 15:30 Go to previous messageGo to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
sorry for posting two times, but the first time the post wasn't shown
Re: Integrating Xtext into GMF-based Editor [message #987930 is a reply to message #987901] Wed, 28 November 2012 17:03 Go to previous messageGo to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
could it be, that there's a problem with my formatter, so he can't find the right position to insert the changes?
Re: Integrating Xtext into GMF-based Editor [message #987935 is a reply to message #987901] Wed, 28 November 2012 17:03 Go to previous messageGo to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
could it be, that there's a problem with my formatter, so he can't find the right position to insert the changes?
Re: Integrating Xtext into GMF-based Editor [message #987940 is a reply to message #987901] Wed, 28 November 2012 17:03 Go to previous messageGo to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
could it be, that there's a problem with my formatter, so he can't find the right position to insert the changes?
Re: Integrating Xtext into GMF-based Editor [message #987947 is a reply to message #987901] Wed, 28 November 2012 17:03 Go to previous messageGo to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
could it be, that there's a problem with my formatter, so he can't find the right position to insert the changes?
Re: Integrating Xtext into GMF-based Editor [message #987956 is a reply to message #987901] Wed, 28 November 2012 17:03 Go to previous messageGo to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
could it be, that there's a problem with my formatter, so he can't find the right position to insert the changes?
Re: Integrating Xtext into GMF-based Editor [message #987965 is a reply to message #987901] Wed, 28 November 2012 17:03 Go to previous messageGo to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
could it be, that there's a problem with my formatter, so he can't find the right position to insert the changes?
Re: Integrating Xtext into GMF-based Editor [message #987977 is a reply to message #987901] Wed, 28 November 2012 17:03 Go to previous messageGo to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
could it be, that there's a problem with my formatter, so he can't find the right position to insert the changes?
Re: Integrating Xtext into GMF-based Editor [message #987990 is a reply to message #987901] Wed, 28 November 2012 17:03 Go to previous messageGo to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
could it be, that there's a problem with my formatter, so he can't find the right position to insert the changes?
Re: Integrating Xtext into GMF-based Editor [message #988006 is a reply to message #987901] Wed, 28 November 2012 17:03 Go to previous messageGo to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
could it be, that there's a problem with my formatter, so he can't find the right position to insert the changes?
Re: Integrating Xtext into GMF-based Editor [message #988023 is a reply to message #987901] Wed, 28 November 2012 17:03 Go to previous messageGo to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
could it be, that there's a problem with my formatter, so he can't find the right position to insert the changes?
Re: Integrating Xtext into GMF-based Editor [message #988040 is a reply to message #987901] Wed, 28 November 2012 17:03 Go to previous messageGo to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
could it be, that there's a problem with my formatter, so he can't find the right position to insert the changes?
Re: Integrating Xtext into GMF-based Editor [message #988057 is a reply to message #987901] Wed, 28 November 2012 17:03 Go to previous messageGo to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
could it be, that there's a problem with my formatter, so he can't find the right position to insert the changes?
Re: Integrating Xtext into GMF-based Editor [message #988075 is a reply to message #987901] Wed, 28 November 2012 17:03 Go to previous messageGo to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
could it be, that there's a problem with my formatter, so he can't find the right position to insert the changes?
Re: Integrating Xtext into GMF-based Editor [message #988095 is a reply to message #987901] Wed, 28 November 2012 17:03 Go to previous messageGo to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
could it be, that there's a problem with my formatter, so he can't find the right position to insert the changes?
Re: Integrating Xtext into GMF-based Editor [message #988114 is a reply to message #987901] Wed, 28 November 2012 17:03 Go to previous messageGo to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
could it be, that there's a problem with my formatter, so he can't find the right position to insert the changes?
Re: Integrating Xtext into GMF-based Editor [message #988138 is a reply to message #987901] Wed, 28 November 2012 17:03 Go to previous messageGo to next message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
could it be, that there's a problem with my formatter, so he can't find the right position to insert the changes?
Re: Integrating Xtext into GMF-based Editor [message #988296 is a reply to message #987935] Thu, 29 November 2012 10:13 Go to previous message
Gideon Weber is currently offline Gideon Weber
Messages: 26
Registered: May 2012
Junior Member
i'm sorry but i don't know why the message was posted so often. it wasn't on purpose.
Previous Topic:Model not being generated after plugin rename
Next Topic:Deploy Xtext as Standalone jar
Goto Forum:
  


Current Time: Wed Oct 01 18:18:09 GMT 2014

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

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