Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 94009 - Field rename cannot be undone in one UNDO action
Summary: Field rename cannot be undone in one UNDO action
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: VE (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Richard Kulp CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-06 17:19 EDT by Srimanth CLA
Modified: 2011-06-13 11:39 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Srimanth CLA 2005-05-06 17:19:57 EDT
Drop a JButton on an empty file and rename it from the Java Beans view. Once the
snippet update finishes hit UNDO and only a small piece of the original changes
are undone. UNDO should include all changes made by the rename instead of a
portion. 

When a command is executed in the command stack, the following steps generally
happen:
  disableDocumentListeners();
  enableTextCompoundChange();
     command1.execute();
     command2.execute();
     ....
     commandx.execute();
  disableTextCompoundChange();
  enableDocumentListeners();

The reason why this bug occurs is that - when the rename command executes, the
actual document changes are done in an async() AFTER the
enableDocumentListeners() step. Because of this one good and one bad thing happen: 
(good) Document changes are listened to and snippet update happens
(bad) Being outside the ...TextCompoundChange() block, it doesnt come under one undo

Since doing the rename in an async() is not acceptable, the command execution
process should provide a mechanism by which something could be run after the
enabling of document listeners and before the disabling of text's compound
change. This will allow for a top-down command to activate a bottom-up snippet
update safely while allowing for a single UNDO to undo the changes.
  enableTextCompoundChange();
  disableDocumentListeners();
     command1.execute();
     command2.execute();  
     ....
     commandx.execute();
  enableDocumentListeners();
->execute-command-contribution();<----
  disableTextCompoundChange();
Comment 1 Srimanth CLA 2005-09-16 12:23:32 EDT
Actually, fixed the problem of multiple UNDO when fixing bug 109153 (internal
api cleanup for rename). Now the RenameCollector collects all changes and applys
them in one document change. Releasing classes AnnotationDecoderAdapter,
RenameRequestCollector, CodegenUtil.

Leaving this defect open as Rich wanted to add similar functionality for some
other purpose.
Comment 2 Srimanth CLA 2005-09-19 11:08:44 EDT
This problem is fixed in bug 59627.
Comment 3 Srimanth CLA 2005-12-16 11:16:24 EST
Now all renames are under one UNDO. Verified in  VE-SDK-I20051216.