Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 339814 - Move project to subdirectory deletes contents
Summary: Move project to subdirectory deletes contents
Status: CLOSED DUPLICATE of bug 307140
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.6.2   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: Platform-Resources-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-13 00:30 EST by Robin Rosenberg CLA
Modified: 2011-05-30 09:11 EDT (History)
1 user (show)

See Also:


Attachments
Screen shot (40.76 KB, image/png)
2011-05-27 17:06 EDT, John Arthorne CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Rosenberg CLA 2011-03-13 00:30:06 EST
Say you created a project and want to move it one level down.

/path/to/Location
/path/to/Location/BetterLocation

You can attempt this with Refactor/Move and enter the new path.

Eclipse will now delete the project, leaving only a .project file at BetterLocation. Everything else
is deleted.

Internallly Eclipse tries a File.renameTo, which fails. Then it performs a copy from Location
to BetterLocation followed by a delete of Location (oops).
Comment 1 John Arthorne CLA 2011-05-27 17:06:41 EDT
Created attachment 196813 [details]
Screen shot

When I try this, the dialog will not allow me to move the project to a sub-directory of itself. What version of Eclipse are you using, and how are you trying to move it?
Comment 2 Robin Rosenberg CLA 2011-05-27 17:59:48 EDT
Heres an exact procedure

Start with empty workspace.

Create a Java Project P in the workspace.

See what it contains.

$ find /Users/me/Documents/workspace/P
/Users/me/Documents/workspace/P
/Users/me/Documents/workspace/P/.classpath
/Users/me/Documents/workspace/P/.project
/Users/me/Documents/workspace/P/.settings
/Users/me/Documents/workspace/P/.settings/org.eclipse.jdt.core.prefs
/Users/me/Documents/workspace/P/bin
/Users/me/Documents/workspace/P/src

Select Refactor/Move and enter add /Q to the path. In my case:

/Users/me/Documents/workspace/P/Q

Eclipse 3.6 does NOT prevent this. During typing you wil se the error message
tha prevents the move (i.e. after /, but not after Q). Often the error message
appears and the move is prevented, but not always.

Eclipse says it moved the project.

Now look at the cotent again:

$ find /Users/me/Documents/workspace/P
/Users/me/Documents/workspace/P
/Users/me/Documents/workspace/P/Q
/Users/me/Documents/workspace/P/Q/.project
/Users/me/Documents/workspace/P/Q/bin
/Users/me/Documents/workspace/P/Q/bin/.project

Most file missing. I guess the .project files comes from Eclipse actually creating them after the move.

Eclipse Version: 3.6.2 Build id: M20110210-1200
Comment 3 John Arthorne CLA 2011-05-30 09:11:02 EDT
Thanks for the details.

*** This bug has been marked as a duplicate of bug 307140 ***