|Clear the undo history within a command [message #705179]
||Fri, 29 July 2011 14:38
Registered: July 2011
I'm in a case where I use a Command that triggers some checking. In some cases, I want to clear the undo history to not let the user make an undo.
As I am within a Command, and this command is still not added to the UndoHistory, if I use for instance :
OperationHistoryFactory.getOperationHistory().dispose(new EditingDomainUndoContext(getEditingDomain()), true, true, true);
It won't work, as it will clear the history but the current command will still be added to it after it's finished.
What would be the best way to clear the UndoHistory after the current command ? If I create another command I will have the same issue over and over again. I tried to use an CommandStackListener or a IOperationHistoryListener, but using those kind of listeners will be slow things heavily, plus it's very complicated to filter the good kind of event (not much relevant information in them) to know when I have to clear the history, given my workflow.
Feel free to give me some advice, maybe I'm not seeing something simple ?
Thanks a lot !
Powered by FUDForum
. Page generated in 0.01599 seconds