|
Re: Xtext integration with GMF [message #883882 is a reply to message #883745] |
Sat, 09 June 2012 17:04 |
Jan Koehnlein Messages: 760 Registered: July 2009 Location: Hamburg |
Senior Member |
|
|
Hi,
the Popup editor GMF integration example is quite outdated. Please use
the embedded editor that allows to have an Xtext based editor in any
SWT text control.
Unfortunately, there is not too much documentation yet. Start digging
yourself into the JavaDocs at EmbeddedEditorFactory
Regards
Jan
Am 09.06.12 10:52, schrieb Chris Rosas:
> Hi,
> I have implemented the Xtext integration with GMF described in the
> Xtext2.1 documentation (14.4.1 Stage 1) and on the blog from Jan
> Köhnlein for my Xtext grammar. And at this point it works as a charm.
> (Eclipse Indigo and Xtext 2.1)
>
> Additionally I have tried to implement a partial Xtext parser for
> parsing expressions in a GMF label as described on state 2 in the
> Xtext2.1 Documentation.
>
> However, I am stuck at the following problem:
> How can i update/replace the currently found semantic element (in this
> case the expression) after successfully parsing the GMF label content?
>
> If I change the contents of my GMFLabel (defined as a
> ExpressionLabelEditPart) my AntlrParserWrapper parses the contents and
> updates the semantic element for the XtextResource
> (UpdateXtextResourceCommand), but unfortunately the semantic model of
> the GMFEditor and so the contents of the gmf label is not updated.
> Thus, after the saving event the content in GMFEditor and in the
> XtextEditor are inconsistent.
>
> What does work are the following cases:
> -Changes in Xtext Editor => onSave: update of GMFEditor (because of
> semantic unloader of ModelEditPart)
> -Changes in GMFEditor (not the GMF Label) => onSave: update of contents
> in Xtext Editor
> -Changes in GMFEditor and XtextEditor => Dialog opening saying that
> other changes will be overwritten => onSave: updates the last edited
> content in both editors.
>
> For debugging purposes I already have used the NodeModelUtils to print
> the token text and compact dump of the CompositeNode to check the
> contents of the "old node" and the "new node" (=RootNode of the
> ParseResult with the valid newString).
>
> What I am searching for is how to replace both "nodes" or update the old
> node with the newString value in the semantic model.
>
> I also tried to implement a CompositeTransactionalCommand to first
> update the semantic model of GMF and THEN invoke the
> UpdateXtextResourceCommand. However, i could not manage to realize it
> because normally updating a label and its semantic model (done by the
> classes: LabelDirectEditPolicy, MessageFormatParser, AbtractParser)
> corresponds with EAttributes and not with EObject (in this case
> Expressions).
> Sorry for my long post. I hope my problem hab become clear.
>
> Thanks in advance.
>
> Christopher
>
>
>
>
>
>
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
---
Get professional support from the Xtext committers at www.typefox.io
|
|
|
|
Re: Xtext integration with GMF [message #892482 is a reply to message #892212] |
Thu, 28 June 2012 12:10 |
Jan Koehnlein Messages: 760 Registered: July 2009 Location: Hamburg |
Senior Member |
|
|
How about updating to the brand new 2.3? It will contain a couple of
bugfixes, too.
Am 27.06.12 14:29, schrieb Chris Rosas:
> Hi,
>
> it's quite a while since my first request. Thanks for the fast reply:-D
>
> I was on vacation and could not directly answer. Sorry.
>
> I tried to start to look for the EmbeddedEditorFactory based on your
> advice.
> But i was not able to find this Factory class in the Xtext 2.1
> distribution.
>
> Can you perhaps give me a hint in which distribution i can find the
> EmbeddedEditorFactory?
> I am still stucked with the problem i have described above.
> Thanks in advance.
>
> Chris
>
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
---
Get professional support from the Xtext committers at www.typefox.io
|
|
|
Powered by
FUDForum. Page generated in 0.03700 seconds