Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 26294 - [resources] delete should be best-case and leave resources consistent
Summary: [resources] delete should be best-case and leave resources consistent
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 2.1 M5   Edit
Assignee: Rafael Chaves CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 26465 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-11-14 09:18 EST by Michael Valenta CLA
Modified: 2016-09-06 03:35 EDT (History)
2 users (show)

See Also:


Attachments
patches for core.resources and core.tests.resources (5.14 KB, patch)
2003-01-02 14:37 EST, Rafael Chaves CLA
no flags Details | Diff
patches for core.resources and core.tests.resources (4.05 KB, patch)
2003-01-15 14:54 EST, Rafael Chaves CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Valenta CLA 2002-11-14 09:18:37 EST
When I upgrade to a new build, I keep my old workspace. When I re-import all my 
binary plugins, I will often get an error that one or more fragments (*.win32) 
cannot be deleted. This leads to several problems:

1. If I go to the navigator and try to delete the fragment (and remove its 
contents from disk), I get an error that the fragment cannot be deleted because 
the .project file is missing (I think it would be OK to delete the project in 
this case anyway). 

2. I trigger the creation of the .project file by adding a project reference 
and try to delete the fragment again. I get another error saying the project 
cannot be deleted but there are no further details and nothing in the log. 
Furthermore, the .project was removed from the file system but not from the 
navigator (i.e. the project is out-of-sync).

3. I suspect that the deletion cannot occur becuase the import of the fragment 
which failed either left the jar file for the plugin open or locked in the OS. 
I verified this by shutting down Eclipse and restarting. I could then delete 
the fragment. 

I will enter a separate report againsts PDE for this as well. It would be nice 
if the delete failure indicated why the delete failed and didn't leave the 
project in an inconsistent state.
Comment 1 Michael Valenta CLA 2002-11-14 09:21:58 EST
Bug 26296 has been logged against PDE for the jar file being locked or open 
after the import.
Comment 2 DJ Houghton CLA 2002-11-15 14:31:29 EST
*** Bug 26465 has been marked as a duplicate of this bug. ***
Comment 3 DJ Houghton CLA 2002-11-23 16:46:55 EST
Old summary:
[resources] Cannot delete project after failed binary project import

we should investigate making the delete operation best-case so we try and 
delete as much as we can. 

Also, when there are resources which we cannot delete, we should leave the 
parent container in a consistent state and not out of sync with the file 
system.
Comment 4 John Arthorne CLA 2002-11-26 11:56:01 EST
It looks like the old best effort deletion code still exists.  This is currently
dead code, so it should either be revived or removed.  The unreferenced delete
methods are:

FileSystemResourceManager.delete
DeleteVisitor class
three delete methods on FileSystemStore.
Comment 5 Rafael Chaves CLA 2003-01-02 14:37:39 EST
Created attachment 2881 [details]
patches for core.resources and core.tests.resources

Deletes open projects by best-effort using the (revived) DeleteVisitor.

Please verify and release.
Comment 6 Rafael Chaves CLA 2003-01-13 14:13:48 EST
Released code for best-case deletion for projects.
Need to add code for folders as well.
Comment 7 Rafael Chaves CLA 2003-01-15 14:54:20 EST
Created attachment 2995 [details]
patches for core.resources and core.tests.resources

Same fix applied for when deleting folders.
Additional test case for folder deletion.
Test cases are platform-specific: Windows and Linux (w/natives).
I ran all tests in both platforms, with no errors.
Comment 8 Rafael Chaves CLA 2003-01-17 12:04:14 EST
Reviewed and released into HEAD.