Skip to main content



      Home
Home » Eclipse Projects » Sirius » Rollback to a previous state of the model
Rollback to a previous state of the model [message #1791747] Wed, 04 July 2018 12:46 Go to next message
Eclipse UserFriend
Hello,

I'm trying to apply some modifications to the model programmatically. However, during the modification phase, it is possible to throw exceptions. I was wondering if there is any "neat" way to take a snapshot of the model at some point and then rollback to the last snapshot in case of the exception. Note that my model is an xText resource.

Any help would be appreciated.

Thanks,
Parsa
Re: Rollback to a previous state of the model [message #1791780 is a reply to message #1791747] Thu, 05 July 2018 04:27 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

If your modifications are done using RecordingCommands, if a modification throws exceptions it will be rollbacked to the previous state. Otherwise, I guess you can add a CommandStackListener to the commandStack (session.getTransactionalEditingDomain().getCommandStack()) and have it behaving as a flag where you can undo all following events.

Regards,
Steve
Re: Rollback to a previous state of the model [message #1791815 is a reply to message #1791780] Thu, 05 July 2018 10:19 Go to previous message
Eclipse UserFriend
Thanks a lot Steve :)

Bests,
Parsa
Previous Topic:Hide actions in tab-bar
Next Topic:Invoking AutoSize programmatically
Goto Forum:
  


Current Time: Mon Jun 30 23:14:54 EDT 2025

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

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

Back to the top