Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » rolling back model changes
rolling back model changes [message #1082927] Fri, 09 August 2013 08:07 Go to next message
Henrik Rentz-Reichert is currently offline Henrik Rentz-ReichertFriend
Messages: 261
Registered: July 2009
Senior Member
Hi,

eTrice has diagram editors based on Graphiti.
We use property dialogs wrapped in custom features to change properties of the underlying domain model objects.
In case the dialog was canceled the custom feature returns false for hasDoneChanges.

I'm quite sure that in an earlier version also the model changes that have been applied (despite hasDoneChanges returned false)
have been rolled back by the framework (the wrapping RecordingCommand has this capability).
Unfortunately I can't tell in which version I've tested this successfully. We also have no unit test for that since that would
require SWTBot which we don't use. I've tested with 10.0, 9.2 and 9.0 but always observed that changes were not rolled back.

Is it possible that this is a regression in Graphiti?
Or was a roll back behavior never intended for this case and the Graphiti client has to care about that?

Thanks,
Henrik
Re: rolling back model changes [message #1092897 is a reply to message #1082927] Fri, 23 August 2013 09:51 Go to previous messageGo to next message
Felix Velasco is currently offline Felix VelascoFriend
Messages: 43
Registered: July 2009
Member
If I understand you right, your feature does some changes, then gets canceled by the user, and you return false in the hasDoneChanges() method? If so, I doubt this ever worked.

The hasDoneChanges() method is used to determine whether to put the command in undo/redo stack, and has no effect on the command execution. If you want to cancel an already running feature, and want the framework to undo your changes, you must throw an OperationCanceledException, and then Graphiti (EMF transaction really) will undo the changes for you.

This has the collateral effect that an info log entry will be created in the error log (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=411129), but hopefully that soon will be optional.
Re: rolling back model changes [message #1092905 is a reply to message #1082927] Fri, 23 August 2013 10:03 Go to previous messageGo to next message
Felix Velasco is currently offline Felix VelascoFriend
Messages: 43
Registered: July 2009
Member
If I understand you right, your feature does some changes, then gets canceled by the user, and you return false in the hasDoneChanges() method? If so, I doubt this ever worked.

The hasDoneChanges() method is used to determine whether to put the command in undo/redo stack, and has no effect on the command execution. If you want to cancel an already running feature, and want the framework to undo your changes, you must throw an OperationCanceledException, and then Graphiti (EMF transaction really) will undo the changes for you.

This has the collateral effect that an info log entry will be created in the error log (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=411129), but hopefully that soon will be optional.
Re: rolling back model changes [message #1092906 is a reply to message #1082927] Fri, 23 August 2013 10:04 Go to previous messageGo to next message
Felix Velasco is currently offline Felix VelascoFriend
Messages: 43
Registered: July 2009
Member
If I understand you right, your feature does some changes, then gets canceled by the user, and you return false in the hasDoneChanges() method? If so, I doubt this ever worked.

The hasDoneChanges() method is used to determine whether to put the command in undo/redo stack, and has no effect on the command execution. If you want to cancel an already running feature, and want the framework to undo your changes, you must throw an OperationCanceledException, and then Graphiti (EMF transaction really) will undo the changes for you.

This has the collateral effect that an info log entry will be created in the error log (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=411129), but hopefully that soon will be optional.
Re: rolling back model changes [message #1093765 is a reply to message #1092906] Sat, 24 August 2013 16:30 Go to previous message
Robert Brodt is currently offline Robert BrodtFriend
Messages: 811
Registered: August 2010
Location: Colorado Springs, CO
Senior Member

Hi Henrik,

We are doing exactly the same thing in the eclipse BPMN2 Modeler project (i.e. using a modal dialog for configuring model elements). Since submitting this feature request, I've rethought some of this behavior and have found the best way to handle this is to create a nested transaction within the dialog. Have a look at the AbstractObjectEditingDialog class in the BPMN2 Modeler git repository.

HTH,
Bob
Previous Topic:Update/refresh automatically feature
Next Topic:Caching of features
Goto Forum:
  


Current Time: Thu Mar 28 08:54:08 GMT 2024

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

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

Back to the top