Bug 209780 - Prevent moving project to a non-empty directory
Summary: Prevent moving project to a non-empty directory
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: IDE (show other bugs)
Version: 3.3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: bugday
Depends on:
Blocks:
 
Reported: 2007-11-14 07:21 EST by Tobias Schwarz CLA
Modified: 2019-10-27 04:53 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Schwarz CLA 2007-11-14 07:21:20 EST
Build ID: 3.3.1.1

Steps To Reproduce:
first prblem:
1.create general project "test" in workspace
2.select project and click File->Move...
3. -> ok button is greyed out
4.deselect "use default location"
5.select "use default location"
6. -> ok button is enabled ???!!!

second problem:
7.deselect "use default location" again
8.choose location outside workspace (e.g. "c:\temp\")
9.hit ok
10. -> error dialog comes up reporting a problem "ressource already exists on disk c:\temp."
but there is no project on c:\temp called test!
Comment 1 Tobias Schwarz CLA 2007-11-15 07:00:53 EST
the main problem is the not working move operation - the enablement of the ok button is a secondary problem.
so i change the summary to the main problem.
Comment 2 Susan McCourt CLA 2008-01-16 14:49:21 EST
This is an IDE/Dialog issue.
Comment 3 Tod Creasey CLA 2008-02-28 10:26:12 EST
The first problem isn't a problem - you are trying to move it back to it's current location.

If you do the same steps with a project that is not at the default location it will work for you.

The second part is from our call to project.move(description, IResource.FORCE | IResource.SHALLOW, monitor).

Moving to resources and renaming.
Comment 4 Szymon Brandys CLA 2008-02-29 12:56:41 EST
I can reproduce it.
Comment 5 Helmut J. Haigermoser CLA 2011-09-05 12:22:52 EDT
(In reply to comment #4)
> I can reproduce it.

CQ:WIND00084563

Hi Szymon :)
Any news on this one?
Thanks a lot! :)
Helmut
Comment 6 John Arthorne CLA 2011-09-06 13:09:29 EDT
I can reproduce this, but it is expected behaviour. You can't move a project to a location that already exists.

I think there is a user misunderstanding here. If you select the location C:\temp for a project called test, the project location will be C:\temp, not C:\temp\test. I.e., the directory you enter here *IS* the location of the project. The directory name and project name do not have to match.
Comment 7 Helmut J. Haigermoser CLA 2011-09-07 04:31:46 EDT
(In reply to comment #6)
> I can reproduce this, but it is expected behavior. You can't move a project to
> a location that already exists.
> 
> I think there is a user misunderstanding here. If you select the location
> C:\temp for a project called test, the project location will be C:\temp, not
> C:\temp\test. I.e., the directory you enter here *IS* the location of the
> project. The directory name and project name do not have to match.

Hi John :)
I'm not sure I understand the reasoning here:
Q: Why is moving into an existing directory not allowed, all the difference is one "mkdir" in between, right?

Q: If moving into an existing directory is not allowed, why isn't the dialog just plainly refusing the existing directory with a reasonable message, like "You cannot move the project "test" into the existing directory <whatever dir> because it already exists and <explain why>"

Let me know what you think! :)
Helmut
Comment 8 John Arthorne CLA 2011-09-07 14:32:35 EDT
(In reply to comment #7)
> I'm not sure I understand the reasoning here:
> Q: Why is moving into an existing directory not allowed, all the difference is
> one "mkdir" in between, right?

If the existing directory is empty, then the move will succeed. If the existing directory contains other files, then the move would involve merging the existing files at the destination into the project. This is more than a mkdir and potentially involves a complex merge. Also, it would strike me as strange as an end-user that "moving" a project could result in it acquiring new contents as part of the process. 

> Q: If moving into an existing directory is not allowed, why isn't the dialog
> just plainly refusing the existing directory with a reasonable message, like
> "You cannot move the project "test" into the existing directory <whatever dir>
> because it already exists and <explain why>"

Yes I agree the UI could check this first.
Comment 9 John Arthorne CLA 2011-09-07 14:37:07 EDT
One might think we could add this test to IWorkspace#validateProjectLocation. However this method is used for both project creation and project move, so it can't add this extra check. This is why the javadoc says, "This method does not consider whether files or directories exist in the file system at the specified path." I think the easiest option is to add a check in the UI to the effect of 

if (fileStore#childNames(EFS.NONE,null).length > 0)
  error("The destination directory is not empty");
Comment 10 Helmut J. Haigermoser CLA 2011-09-08 04:11:09 EDT
(In reply to comment #9)
> One might think we could add this test to IWorkspace#validateProjectLocation.
> However this method is used for both project creation and project move, so it
> can't add this extra check. This is why the javadoc says, "This method does not
> consider whether files or directories exist in the file system at the specified
> path." I think the easiest option is to add a check in the UI to the effect of 
> 
> if (fileStore#childNames(EFS.NONE,null).length > 0)
>   error("The destination directory is not empty");

Thanks John, this sounds like a good resolution to me: the UI will refuse an operation we know would fail. The error message could go into more details, or the associated help entry could, so that customers know we do not want to get into the merging business and thus refuse this kind of operation..
Helmut
Comment 11 Martin Oberhuber CLA 2012-11-15 09:32:00 EST
Ping, this looks like a great bug for a bugday or hackathon ... adding a "bugday" keyword for now, do we have any other kind of markup ?
Comment 12 Eclipse Genie CLA 2019-10-27 04:53:35 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.