|Re: ResourceUndoContext has default Undo limit in DefaultOperationHistory [message #1562554 is a reply to message #1561838]
||Tue, 13 January 2015 19:40
|| Christian W. Damus
Registered: July 2009
Two ResourceUndoContexts are equal if they reference the same Resource.
So, if your editor knows a priori the resources that it edits (which
it probably does), it can create ResourceUndoContexts on those
resources to set their undo limits.
Just be sure to flush all of those ResourceUndoContexts when your
editor is closed, otherwise the contexts and the resources that they
reference will leak: the history will keep them in its 'limits' map
On 2015-01-13 13:18:07 +0000, Ais OGorman said:
> My project uses the DefaultOperationHistory, and I am currently trying
> to set an undo limit for my own editor's UndoContext.
> My limit is correctly being set for my UndoContext but my operation has
> 2 UndoContexts. One of these is the ResourceUndoContext and the other
> is my own UndoContext. But the ResourceUndoContext (which contains my
> affected resource) is being removed from the operation by the method
> forceUndoLimit() because it only has the default limit for Undo. I want
> to either, not remove the ResourceUndoContext by changing code in
> forceUndoLimit (which is hacky, I think) or try to figure out a way to
> add the same limit for the ResourceUndoContext as my own UndoContext.
> I've started down the path of extending the WorkspaceCommandStackImpl,
> copying in the DomainListener and creating my own DomainListener which
> will add an undo limit for the ResourceUndoContext when it is created.
> Is this the best way to resolve this? Thanks for any help in advance.
Powered by FUDForum
. Page generated in 0.02496 seconds