|Rollback to a previous state of the model [message #1792571]
||Thu, 19 July 2018 15:10
| Parsa Pourali
Registered: February 2014
[I have already asked this question on XText and Sirius forums but didn't get the answer I wanted, so I thought maybe someone here could help].
I was wondering if there is a way to get a snapshot of the model at some point and then revert back everything to it. So, basically, I need to do:
1- keeping the snapshot in the memory,
2- do sth with the model and modify it.
3- if the modification is not what I wanted, then revert everything back to the snapshot that is taken in the step 1.
I can't use RecordingCommand because there is not a single change that I roll back. I will show a dialog to the user where the user can do whatever he wants to do with the model and all these changes are within their own recording command. Then he can either accept or cancel the changes. By default, the Accept will do nothing because the changes that he made in the dialog are already saved to the original model at the time of the change. But if he selects the Cancel button, I need to revert back to the time before he opens the dialog.
I tried to create an element (i.e. snapshot resource) in the memory and use ecoreutils.copy to copy everything from the original resource to the snapshot resource. But the copy back from the snapshot to the original resource does not seem to work :(
Any help would be appreciated.
Powered by FUDForum
. Page generated in 0.03430 seconds