Community
Participate
Working Groups
Eclipse build id: I20080207-1530 The "undo" command is always disabled while entering commands in the shell view. The corresponding SystemCommandEditor#TextViewerAction is never enabled because ITextOperationTarget#canDoOperation(UNDO) always return false. However when ITextOperationTarget#doOperation(UNDO) is explicitly called, the undo is working fine. This seems like regression in org.eclipse.text and I will try to come up with a snippet which reproduces the problem and file a defect in Platform/Text.
According to the Patform/Text guys it is not a good idea to query the undo manager in a listener. Currently we need to know if undo is possible in order to enable or disable the context menu action. I think that the fix should be to query the undo manager prior opening the context menu not in the textListener. I will propose a patch when I find some time.
You should use org.eclipse.ui.operations.UndoActionHandler which takes care this. For details see: org.eclipse.ui.texteditor.AbstractTextEditor.createUndoRedoActions().
Rado can you look at this and implement it as proposed? - I'd like to have the alternative implementation in our M7 to make sure we can still give the Platform team some feedback in case we encounter unexpected issues.
Created attachment 98139 [details] patch using UndoActionHandler Proposing patch using the UndoActionHandler for implementing undo. I have tested on Eclipse 3.4M6 / Windows. Daniel, thanks for the help.
Marking as FIXED
Patch looks good to me, please go ahead and commit
Patch committed.