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

Bug 162920

Summary: [Undo] [IDE] - No prompt when deleting read only file via undo/redo
Product: [Eclipse Project] Platform Reporter: John Arthorne <john.arthorne>
Component: UIAssignee: Susan McCourt <susan>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: susan
Version: 3.3   
Target Milestone: 3.3 M4   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

Description John Arthorne CLA 2006-10-31 10:53:26 EST
Build: I20061031-0656

1) Create a simple project
2) Create file a.txt in the project
3) Right click a.txt, and under Properties > Resource, mark the file as read only
4) Edit > Undo New File

-> The file is deleted even though it is read only.  The same happens if you redo a file deletion after marking it read-only. Shouldn't it prompt when deleting a read only file here?
Comment 1 Susan McCourt CLA 2006-10-31 12:40:12 EST
In the original version, I had the operations check read-only status and prompt.  This proved quite annoying when the original operation was confirmed by the user.  For example...
- delete a read-only file, you are prompted.
- undo the delete
- redo the delete, you are prompted again.

In that case, I decided that once prompted on the original operation, it was redundant to keep asking. So I let the client action do the prompting and the operation do nothing.

But your case is different...the state changed after the original operation, so the check is valid.  

To be smarter here, the operation could provide the initial prompting (instead of the client) and then only prompt again if the read only state of its file changes.
Comment 2 Susan McCourt CLA 2006-11-08 17:10:36 EST
Fixed in HEAD >20061108.

The operation now checks read-only status on all deletes, including:
- undo of a create
- execute/redo of a delete
- undo of a copy

Removed read-only status checking from the DeleteResourceAction.  I did not add any logic to limit prompting on redo only if the read only state was added since the original operation.  That would have required changing the life-cycle of the resource description snapshots, and I don't think it's worth it.

The behavior now is that if the user refuses to delete read only file(s) on an undo or redo, the operation is either performed on the non-read only files, or if the user refused to delete any of the files, then the operation is cancelled and the undo/redo remains in the history (and will prompt again when the user tries it).

Verified with given scenarios and with deletion of a file that was read only from the beginning.  (Can't be verified in an automated test since it involves prompting.)
Comment 3 Susan McCourt CLA 2007-02-12 14:35:13 EST
verified on M5, WinXP, with scenario from comment #0