|Re: How UNDO works in graphiti? [message #1130238 is a reply to message #1130131]
||Wed, 09 October 2013 10:50
Le 09/10/13 10:45, Michael Wenz a écrit :
> I guess with clearing you mean deleting the objects. The default delete
> functionality in Graphiti (and also the called EMF delete) checks a lot
> more things and traverses the object tree to find and remove references
> pointing to the deleted elements. Looping over that 100 times will
> surely be slow.
> I think the best way would be to implement a custom delete that does
> exactly what you want (and only that). Not sure if there is a possibilty
> in EMF Transaction to store and replay (or rather revert) the recorded
> changes in the way you like to do...
It may be possible to subclass the BasicCommandStack used in the
TransactionalEditingDomain. I used once a long ago so I don't well
remember how I do that.
BasicCommandStack must have the list of executed commands stored in an
array list but not visible for users. Instead, the user can get the most
recent commands (used by the undo method).
Thus, if you subclass the command stack with your own implementation,
you may be able to define an array list that stores a restrained set of
specialized commands (only the ones you would undo). Then, you may
provide a custom undo implementation that undoes all the commands only
stored in this array list.
Finally you bind your custom commandStack with the transactional editing
domain used by Graphiti.
Is this possible ?
Powered by FUDForum
. Page generated in 0.08599 seconds