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

Bug 173361

Summary: Incorrect undo menu contents after changing workbench part
Product: [Modeling] GMF-Runtime Reporter: Linda Damus <ldamus>
Component: GeneralAssignee: Alex Boyko <aboyko>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P1 CC: ahunter.eclipse, dmisic, me, shatalin
Version: 2.0   
Target Milestone: 2.0   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Linda Damus CLA 2007-02-07 17:41:52 EST
The Undo (and Redo) menu items use the wrong undo context after the user switches workbench parts.  The incorrect operation history is presented to the user until the next undoable change is made in the diagram editor.

The problem is that the GlobalUndoAction (and GlobalRedoAction) creates a new Eclipse UndoActionHandler delegate whenever the workbench part changes.  In Eclipse 3.3M4 (see bug 162964) the UndoActionHandler has a 'contextActive' state that is false when a new handler is created.  The UndoActionHandler#getUndoContext returns the global undo context for the workbench until the its real context is deemed active.

Steps to reproduce the problem in the logic example:
1. Launch a new workbench and open the resource perspective
2. Create a simple project
3. Create an example logic diagram.  Observe that the undo menu item when the diagram is selected is "Undo New Project".
4. Add a new circuit to the diagram using the tool palette.  Now the undo menu item says "Undo Create Circuit"
5. Change focus to the Outline view, then back to the diagram view.  Now the undo menu item is "Undo New Project". It should be "Undo Create Circuit"
5. Create an LED using the tool palette.  Undo.  Observe that the undo menu item is correctly back to "Undo Create Circuit"
Comment 1 Alex Boyko CLA 2007-04-30 11:38:55 EDT
The fix for bug 184604 addresses the issue of 'activeContext' member initialized to false when the handler is created. With the fix 'activeContext' will be initialized to true if there are operations in the local history. This eliminates the regression for us. Yet, we still have to look at the issue of creating handlers every time workbench part changes as Susan (the person who was fixing 184604 and 162964) suggests.
Anthony, is it OK to downgrade the priority and change the target milestone to '-'? Since, there is no regression the issue looks more as an enhancement.
Comment 2 Anthony Hunter CLA 2007-04-30 12:27:05 EDT
We can leave the priority and target as is.

Creating handlers every time the workbench part changes should be tracked through a new Bugzilla.
Comment 3 Alex Boyko CLA 2007-04-30 13:36:05 EDT
The priority and target milestone remain the same. The issue left open until verified.
Bug 184746 is raised to address the issue of creating undo/redo action handlers each time workbench part changes.
Comment 4 Anthony Hunter CLA 2007-05-18 10:01:39 EDT
*** Bug 183151 has been marked as a duplicate of this bug. ***
Comment 5 Alex Boyko CLA 2007-06-11 16:33:45 EDT
It has been fixed in Eclipse UI component
Comment 6 Richard Gronback CLA 2008-08-13 13:11:43 EDT
[target cleanup] 2.0 M7 was the original target milestone for this bug
Comment 7 Eclipse Webmaster CLA 2010-07-19 22:00:07 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Runtime was the original product and component for this bug