|Node model reconciler and editing domain [message #1007461]
||Tue, 05 February 2013 18:14
| Axel Guckelsberger
Registered: July 2009
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
Caused by: java.lang.NullPointerException
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,
|Re: Node model reconciler and editing domain [message #1010756 is a reply to message #1009677]
||Mon, 18 February 2013 02:32
| Jan Koehnlein
Registered: July 2009
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.
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?
> 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
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Powered by FUDForum
. Page generated in 0.04661 seconds