Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 16:46 Go to next message
Parsa Pourali is currently offline Parsa PouraliFriend
Messages: 192
Registered: February 2014
Senior Member
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 08:27 Go to previous messageGo to next message
Steve Monnier is currently offline Steve MonnierFriend
Messages: 366
Registered: May 2011
Senior Member
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


Steve Monnier - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Rollback to a previous state of the model [message #1791815 is a reply to message #1791780] Thu, 05 July 2018 14:19 Go to previous message
Parsa Pourali is currently offline Parsa PouraliFriend
Messages: 192
Registered: February 2014
Senior Member
Thanks a lot Steve :)

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


Current Time: Thu Sep 20 08:24:30 GMT 2018

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

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

Back to the top