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

Bug 307657

Summary: When importing a project that already exists in workspace, then deleting existing project, project to be imported gets deleted
Product: [Eclipse Project] JDT Reporter: Missing name <matthijs.snel>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: minor    
Priority: P3 CC: markus.kell.r
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Missing name CLA 2010-03-31 05:13:25 EDT
Build Identifier: M20100211-1343

I try to import a project B that has the same name as a project A that's already in the workspace but has no contents on disk. Because the projects have the same name, I cancel the import and first delete project A from the workspace. In the dialog box that pops up when deleting, I check the checkbox "Delete contents from disk". Eclipse proceeds to delete the contents of project B from disk, even though I cancelled the import.

Reproducible: Didn't try
Comment 1 Markus Keller CLA 2010-03-31 06:12:22 EDT
I don't see where something should be wrong. When you delete a project and check "Delete contents from disk", why shouldn't Eclipse delete the project and its contents? For the Delete command, it's irrelevant whether you opened the Import dialog before.

Maybe I didn't understand your exact scenario. If so, please reopen and provide more exact steps (give exact project names and their path on the file system).
Comment 2 Missing name CLA 2010-04-01 03:44:20 EDT
No, what I meant was this:

Project A is in the workspace settings of C:\workspace. I.e., it *does not have any contents on disk*, but is defined in the workspace so that when you open Eclipse, you see a closed icon for Project A in the Package Explorer (to see what I mean, create a project in Eclipse, then exit Eclipse, go to the filesystem and delete the project, reopen Eclipse, now you'll see a closed icon for that project).

Project B, in my case on USB stick E:\projects\ProjectB.

Now, I right-click the closed Project A in Package Explorer, select "Import", select "Existing project into workspace", then I select "E:\projects\ProjectB" as the project to import. Eclipse grays out the Next and Finish button with the message "Some projects cannot be imported because they have the same name as a project already in the workspace". So I click Cancel.

Then I right-click Project A in the Package Explorer, select "Delete", select "Delete contents from disk (cannot be undone)". Eclipse then deleted Project B from my USB stick.

The problem is, I now tried to reproduce this but it's not reproducible, so I'm keeping the status as closed.

(In reply to comment #1)