Community
Participate
Working Groups
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();
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.
This problem is fixed in bug 59627.
Now all renames are under one UNDO. Verified in VE-SDK-I20051216.