Bug 250714 - [ltk] Cannot delete an unsaved file in eclipse 3.4
Summary: [ltk] Cannot delete an unsaved file in eclipse 3.4
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.5 M5   Edit
Assignee: Markus Keller CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 210200 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-10-14 02:12 EDT by Radhakrishnan CLA
Modified: 2008-12-12 08:16 EST (History)
5 users (show)

See Also:


Attachments
Fix (7.44 KB, patch)
2008-12-12 08:13 EST, Markus Keller CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Radhakrishnan CLA 2008-10-14 02:12:26 EDT
Build ID: I20080617-2000

Steps To Reproduce:
1.Create a file and update it but don't save it
2.Delete the file
3.Press OK for confirm delete dialog
4.It reports the unsaved change as found problems with continue option
5.Press continue button
6.Opens a refactoring dialog which says has the problem of unsaved changes


More information:
Comment 1 Kevin McGuire CLA 2008-10-22 18:07:55 EDT
The appearance of the refactoring dialog is rather odd too.  

Its possible we should prompt, "The file is modified in an editor and there are unsaved changes.  Do you wish to proceed with the delete?" only because (1) you may have hit the wrong key and (2) undo of deletion won't get back contents that have never been saved.
Comment 2 Susan McCourt CLA 2008-10-22 18:34:01 EDT
This seems to be introduced by the LTK implementation for deleting resources.  In Eclipse 3.3.2, here is what happens:

- create the file and edit it, but don't save
- "Are you sure want to delete foo.txt?"
- press Yes
- Now we see the "Confirm Delete" dialog with the list of problems including the warning File '/Test/foo.txt' has unsaved changes.
- if I press cancel, the delete is canceled, file is still there, etc.
- if I press continue, the file is deleted.
- during the delete, the file gets saved and the open editor closed.
- if I "Undo delete" then the file is restored including the changes I had not manually saved.

Here's the same scenario in 3.5 stream

- create the file and edit it, but don't save
- "Are you sure want to delete foo.txt?" (in 3.5 this includes a preview button courtesy of LTK)
- press Yes
- Now we see the "Confirm Delete" dialog with the list of problems including the warning File '/Test/foo.txt' has unsaved changes.
- if I press cancel, the delete is canceled, file is still there, etc.
- if I press continue, I get the refactoring dialog that says
"The operation cannot be performed due to the following problem:"
Test/foo.txt has unsaved changes.

So I think this problem belongs to the LTK participant in resource delete.
Comment 3 Markus Keller CLA 2008-12-12 08:13:41 EST
Created attachment 120312 [details]
Fix
Comment 4 Markus Keller CLA 2008-12-12 08:14:30 EST
Fixed in HEAD. 
Comment 5 Markus Keller CLA 2008-12-12 08:14:54 EST
*** Bug 210200 has been marked as a duplicate of this bug. ***