Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Node model reconciler and editing domain
Node model reconciler and editing domain [message #1007461] Tue, 05 February 2013 23:14 Go to next message
Axel Guckelsberger is currently offline Axel Guckelsberger
Messages: 224
Registered: July 2009
Senior Member
Hi,

I have been implementing the GMF example and it works quite fine except the following problem:

If a diagram element's property is changed (using direct editing or the property sheet) this works like expected. If the focus is changed to another diagram element and then back to the first one also a second property can be changed. What is not working is doing two transactions on the same element.

This exception occurs after the second update:

org.eclipse.core.commands.ExecutionException: While executing the operation, an exception occurred
    at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:521)
    at org.eclipse.gmf.runtime.emf.ui.properties.sections.UndoableModelPropertySheetEntry.executeValueChangedCommand(UndoableModelPropertySheetEntry.java:273)
    at org.eclipse.gmf.runtime.emf.ui.properties.sections.UndoableModelPropertySheetEntry.setValue(UndoableModelPropertySheetEntry.java:202)
    at org.eclipse.gmf.runtime.emf.ui.properties.sections.UndoableModelPropertySheetEntry.applyEditorValue(UndoableModelPropertySheetEntry.java:130)
...
Caused by: java.lang.NullPointerException
    at org.eclipse.emf.workspace.AbstractEMFOperation.inheritedOptions(AbstractEMFOperation.java:252)
    at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:138)
    at org.eclipse.core.commands.operations.TriggeredOperations.execute(TriggeredOperations.java:166)
    at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:513)

Basically the editing domain is null in the second attempt. I debugged a bit and found that the problem is probably related to something in the XtextNodeModelReconciler class. Things work without problems when commenting out the updateXtextResourceTextCommand.execute(null, null); call.

Of course I've read about the background of why this is required. But from looking at the code I can't see any obvious reason for the editing domain becoming null by this command. Does anybody know?

Wondering which possible approaches might be sensitive for coping with the problem above.

Maybe it makes sense to reinject the editing domain into the property sheet sections by using UndoableModelPropertySheetEntry#setEditingDomain(). Does not sound like an elegant solution with regards to coupling...

Another possibility would be to change/enhance the node model reconciler by introducing some custom conditions/methods for calling the command only sometimes. Don't know if it is possible to distinguish the outside context though.

Thanks for any hint,

Axel
Re: Node model reconciler and editing domain [message #1008133 is a reply to message #1007461] Sun, 10 February 2013 19:11 Go to previous messageGo to next message
Axel Guckelsberger is currently offline Axel Guckelsberger
Messages: 224
Registered: July 2009
Senior Member
Hi again,

I am currently stuck with this problem.

Does anybody use Xtext and GMF combined? If yes, can you reproduce this problem?

Thanks,

Axel
Re: Node model reconciler and editing domain [message #1009677 is a reply to message #1008133] Fri, 15 February 2013 14:02 Go to previous messageGo to next message
Axel Guckelsberger is currently offline Axel Guckelsberger
Messages: 224
Registered: July 2009
Senior Member
As a workaround I commented out the usage of the
updateXtextResourceTextCommand.execute() call.

It seems that this doesn't cause any difference. Things do still work.
Operations like renaming elements and establishing/removing relationships
are still reflected properly in the domain model file.

So here is my general question for understanding:

Can it be that the whole node model reconciler is only required if one wants
to have both GMF and Xtext editors open at the same time?

At the moment I am only using GMF editors working on a XtextResource, so I
wonder if I really need this for that purpose?

Thanks,

Axel


Axel Guckelsberger wrote:

> Hi again,
>
> I am currently stuck with this problem.
>
> Does anybody use Xtext and GMF combined? If yes, can you reproduce this
> problem?
>
> Thanks,
>
> Axel
Re: Node model reconciler and editing domain [message #1010756 is a reply to message #1009677] Mon, 18 February 2013 07:32 Go to previous message
Jan Koehnlein is currently offline Jan Koehnlein
Messages: 656
Registered: July 2009
Senior Member
Hi Axel,

the GMF example is no longer maintained.

As far as I remember, the node model reconciliation was also necessary
for subsequent changes on the semantic model. If you don't change the
node model information after a semantic change, the next calculation of
a text region will likely get wrong offsets.

Regards
Jan

Am 15.02.13 15:02, schrieb Axel Guckelsberger:
> As a workaround I commented out the usage of the
> updateXtextResourceTextCommand.execute() call.
>
> It seems that this doesn't cause any difference. Things do still work.
> Operations like renaming elements and establishing/removing relationships
> are still reflected properly in the domain model file.
>
> So here is my general question for understanding:
>
> Can it be that the whole node model reconciler is only required if one wants
> to have both GMF and Xtext editors open at the same time?
>
> At the moment I am only using GMF editors working on a XtextResource, so I
> wonder if I really need this for that purpose?
>
> Thanks,
>
> Axel
>
>
> Axel Guckelsberger wrote:
>
>> Hi again,
>>
>> I am currently stuck with this problem.
>>
>> Does anybody use Xtext and GMF combined? If yes, can you reproduce this
>> problem?
>>
>> Thanks,
>>
>> Axel
>


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Previous Topic:How to get an EObject from an EObjectNode
Next Topic:ImportUri and scoping
Goto Forum:
  


Current Time: Wed Oct 01 18:34:54 GMT 2014

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

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