DefaultUndoManager undoable() [message #115035] |
Fri, 22 August 2003 15:22 |
Eclipse User |
|
|
|
Originally posted by: jnorton.yellowbrix.com
I am trying to implement an undo action that enables/disables a toolbar
button based on a DefaultUndoManager connected to a TextViewer. I have
created a subclass of Action that contains the DefaultUndoManager and
listens for TextEvents from the TextViewer. When the Action receives the
TextEvents from the TextViewer, it checks undoable() on the undo manager -
if true, it enables the toolbar button, if false, it disables it.
This works most of the time, but I have noticed that after executing an
undo() and then performing another text edit undoable() is false when
checked in the handler for the resulting TextEvent. The undo manager has
indeed recorded the text operation, however, because if I ignore the state
of undoable() and make the call to undo(), the text edit is undone
correctly. Also, if another text edit is made (after the first which
results in the erroneous undoable()) then undoable() correctly returns true.
Note that the TextViewer is connected to the DefaultUndoManager before the
Action is added to the TextViewer's list of TextEvent listeners.
Has anyone else seen this problem or am I doing something incorrectly?
|
|
|
Powered by
FUDForum. Page generated in 0.03941 seconds