Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 470028

Summary: Redo-history is cleared after undoing a single relocate operation via Ctrl+Z.
Product: [Tools] GEF Reporter: Matthias Wienand <matthias.wienand>
Component: GEF MVCAssignee: Matthias Wienand <matthias.wienand>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 0.1.0   
Target Milestone: 3.10.1 (Mars SR1) M1   
Hardware: All   
OS: All   
Whiteboard:

Description Matthias Wienand CLA 2015-06-12 03:54:12 EDT
Steps to reproduce:
1. Open the "GEF4 MVC Logo Example" view.
2. Relocate a shape via mouse drag.
3. Undo the relocation via Ctrl+Z.
4. Try to redo the relocation.

When the menu item "Edit->Undo" is used to undo the relocation, the redo-history will not be cleared.

I believe clearing of the redo-history is related to calling IOperationHistory#closeOperation() within AbstractDomain#closeExecutionTransaction().
Comment 1 Matthias Wienand CLA 2015-06-12 05:04:50 EDT
I investigated further and found that an open execution transaction during undo causes the bug. When pressing Ctrl, the FXTypeTool opens an execution transaction. Then, when pressing Ctrl+Z, the undo is performed, but results in NOT OK, because an operation is currently open.

Therefore, we should probably register a listener for operation history events within AbstractDomain, and close a currently open (but empty) execution transaction upon the #notifyAboutToUndo() event. If the currently open execution transaction already contains operations, an exception can be thrown.
Comment 2 Matthias Wienand CLA 2015-06-25 07:03:24 EDT
I added an operation history listener within AbstractDomain that closes a currently open and empty execution transaction upon the OperationHistoryEvent#ABOUT_TO_UNDO. If a currently open execution transaction already contains operations, an exception is thrown. The code is published on the master branch, therefore I resolve this ticket as fixed for 3.10.1M1.