Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 13048 - [Navigator] Copy/Paste package is really inconvenient when package exists
Summary: [Navigator] Copy/Paste package is really inconvenient when package exists
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: Other other
: P3 normal (vote)
Target Milestone: 2.1   Edit
Assignee: Knut Radloff CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-09 00:30 EDT by Carolyn MacLeod CLA
Modified: 2002-09-05 17:47 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carolyn MacLeod CLA 2002-04-09 00:30:24 EDT
We have a student working on one of our example packages.
She does not have commit rights on eclipse.org.
So she makes a copy of the package, and works in another repository, where she 
does have commit rights.
When I went to commit her package to our example project, this is what happened:
- I loaded her project from her repository, and ran the code in the package
- When I was happy with it, I selected her package and said "Copy"
- Then, I scrolled to our example project, selected it, and said "Paste".
- Since this package already exists, I was dismayed to see that eclipse merrily 
created a new package called copyof.org.eclipse.swt.examples.layoutexample.
(This is, obviously, not at all what I wanted).
- So now I have to work around it. I deleted our example package so that I 
could rename the "copyof". The new CVS won't let me delete the package right 
away - it says I have to release the deletion for it to be "pruned". So I have 
to delete the "copyof" so that I can select the project and release the 
deletion before I re-copy the package and finally release it.
Needless to say, this process is sub-optimal. I would have preferred if I had 
been told that a package with the same name already existed, and did I really 
want to paste over top of that package? (yes)
Comment 1 Nick Edgar CLA 2002-04-09 14:25:35 EDT
This particular problem is in JDT's handling of paste, although I believe we do 
something similar in the Navigator.
In the case of the Navigator, it should work like the filesystem explorer.
It only generates a "Copy of" if an attempt is made to paste the folder over 
itself.
If you're pasting a different folder which happens to have the same name, then 
it copies the files and subfolders into the dest folder (prompting about 
overwrites first), but does not replace the dest folder or its contents.
We should do the same for the Navigator and Packages view.

The Packages view may want to also support replace, since packages have 
stronger semantics than just folders.

Moving to JDT for comment.
Comment 2 Nick Edgar CLA 2002-04-09 14:26:16 EDT
The Team Team should also be aware of this issue.
Comment 3 Randy Giffen CLA 2002-04-09 14:56:07 EDT
Verified that the navigator does not have this problem.
It only creates the copyof folder if you paste into the same folder/project as 
the source, otherwise you get the "do you want to overwrite" dialog.
Comment 4 Nick Edgar CLA 2002-04-09 16:56:16 EDT
However, I believe we're currently totally overwriting the dest, rather than 
merging their contents (overwriting individual files if needed).
This inconsistency with the file system explorer risks losing the user's work.
Comment 5 Dirk Baeumer CLA 2002-09-05 10:54:52 EDT
JDT is doing the following in 2.0.1 with is the same as Windows explorer does:

- it askes if it should overwrite since a package with the same already exists
- if you say yes it overwrites only the files that exist in the destination 
  package. So it does a kind of merge

Here is what I did to validate the PR

- Project with the following structure

  Test
    src1
      p1.p2
        A.java
    src2
      p1.p2
        A.java
        B.java

- selected p1.p2 from src1 and executed copy.
- selected src2
- executed paste.

Moving back to platform since Nick stated in his last comment that the platform 
might do something wrong.
Comment 6 Knut Radloff CLA 2002-09-05 17:47:26 EDT
This has been fixed in CopyFilesAndFoldersOperation.
See also bug 15894.