Community
Participate
Working Groups
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)
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.
The Team Team should also be aware of this issue.
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.
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.
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.
This has been fixed in CopyFilesAndFoldersOperation. See also bug 15894.