Skip to main content



      Home
Home » Eclipse Projects » GEF » Clear the undo history within a command
Clear the undo history within a command [message #705179] Fri, 29 July 2011 10:38 Go to next message
Eclipse UserFriend
Hi,

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 !
Re: Clear the undo history within a command [message #705620 is a reply to message #705179] Sat, 30 July 2011 01:00 Go to previous messageGo to next message
Eclipse UserFriend
i am assuming that comand execution happens in a display thread.. so when u run the clear history code inside display async thread (Display.Default.asyncExexc()) it will be executed when the ui thread is free. ui thread becomes free only after current command execution is finished which will ensure that current command is also cleared in the clear history action..
Re: Clear the undo history within a command [message #707955 is a reply to message #705620] Tue, 02 August 2011 05:11 Go to previous message
Eclipse UserFriend
Alright, will try that, thanks !
Previous Topic:How to add shape in GEF editor using BPMN2
Next Topic:How to avoid Overlapping of components/figure
Goto Forum:
  


Current Time: Thu Apr 17 10:40:00 EDT 2025

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

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

Back to the top