Bug 221392 - [shells] Undo command doesn't work with Eclipse 3.4M5
Summary: [shells] Undo command doesn't work with Eclipse 3.4M5
Status: RESOLVED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 3.0   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.0 M7   Edit
Assignee: Radoslav Gerganov CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords:
Depends on: 221638
Blocks:
  Show dependency tree
 
Reported: 2008-03-04 14:57 EST by Radoslav Gerganov CLA
Modified: 2008-05-03 03:19 EDT (History)
1 user (show)

See Also:
mober.at+eclipse: review+


Attachments
patch using UndoActionHandler (4.27 KB, patch)
2008-04-30 06:08 EDT, Radoslav Gerganov CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Radoslav Gerganov CLA 2008-03-04 14:57:13 EST
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.
Comment 1 Radoslav Gerganov CLA 2008-03-27 05:27:10 EDT
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.
Comment 2 Dani Megert CLA 2008-04-29 06:04:41 EDT
You should use org.eclipse.ui.operations.UndoActionHandler which takes care this. For details see: org.eclipse.ui.texteditor.AbstractTextEditor.createUndoRedoActions().
Comment 3 Martin Oberhuber CLA 2008-04-29 14:28:34 EDT
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.
Comment 4 Radoslav Gerganov CLA 2008-04-30 06:08:36 EDT
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.
Comment 5 Radoslav Gerganov CLA 2008-04-30 06:14:07 EDT
Marking as FIXED
Comment 6 Martin Oberhuber CLA 2008-05-02 18:38:07 EDT
Patch looks good to me, please go ahead and commit
Comment 7 Radoslav Gerganov CLA 2008-05-03 03:19:30 EDT
Patch committed.