Bug 114536 - [refactoring] Single-CU refactorings should not save on undo/redo
Summary: [refactoring] Single-CU refactorings should not save on undo/redo
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2005-11-01 10:26 EST by Tom Hofmann CLA
Modified: 2009-08-30 02:06 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 Tom Hofmann CLA 2005-11-01 10:26:30 EST
3.2 M3 test pass

Most refactorings (except local variable rename and similar) force a save before
they execute, and everything is saved after executing them. This is expected as
I have a dialog and the 'save resources' query when triggering the refactoring.

Now, when the refactoring has executed, and I choose undo, there are two
possible paths:

A) the changes were local to one CU and it is the active editor:
  - there is no dialog
  - the changes are undone
  - the CU is saved

B) the changes span multiple CUs
  - a dialog warns me about the nature of the undo I am about to perform
  - choosing 'Ok' undoes all refactoring related changes and saves the CUs

Since B) shows an informational dialog, I understand that I am about to undo a
larger change which will modify more than just the CU and I understand that the
editor is saved afterwards. In case A), however, I do not understand why the
editor is saved after the undo. I can even execute Undo/Redo alternatingly,
which will change the CU in front of me, withouth the editor becoming dirty,
which is counterintuitive to what I am used to from using undo inside editors.

IMO it would me more intuitive to leave the editor dirty after the undo in case A).
Comment 1 Dirk Baeumer CLA 2005-11-01 11:12:29 EST
As discussed with Tom the problem is that refactoring doesn't know anything
about who is triggering the undo. For example if the undo of the rename
refactoring is triggered from the package explorer I think the file should be saved.

To achieve the requested behaviour we need some info from the editor to know
which files don't need saving. WE might be able to piggy back this information
using the IAdaptable info in IUndoableOperation#undo/redo.

Tom, Dani this information has to be provided by the editor undo/redo action.
Any comments here ?
Comment 2 Tom Hofmann CLA 2005-11-01 11:58:26 EST
(In reply to comment #1)
> As discussed with Tom the problem is that refactoring doesn't know anything
> about who is triggering the undo. For example if the undo of the rename
> refactoring is triggered from the package explorer I think the file should be 
> saved.

I agree - the package explorer has a different undo model (no dirty state, but a
workspace-global view).
Comment 3 Martin Aeschlimann CLA 2006-06-19 11:07:32 EDT
When trying that I'm not so surprised that the file is saved. Also other undos return to a saved state. Ok to close?
Comment 4 Tom Hofmann CLA 2006-06-19 11:18:48 EDT
No! :-) 

I still feel the same way - undo in the editor without a dialog must not touch the saved state.
Comment 5 Dani Megert CLA 2006-06-19 11:26:27 EDT
>Also other undos return to a saved state.
Yes, but only from the dirty state and not from a saved state.
Comment 6 Denis Roy CLA 2009-08-30 02:06:57 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.