Community
Participate
Working Groups
From the Package Explorer view in a Java perspective: 1. create a Java project, TestJavaProj 2. create a Source Folder in Test Java Proj named Java Source 3. create a Java class in Test Java Proj (Test1 in package my.pkg) 4. import a zip file which contains (newFolder/Java Source/my/pkg/Test2.java) into TestJavaProj. 5. to move the imported source file to the correct folder, drag the Java Source folder under newFolder to TestJavaProj. Was expecting that this would cause the new Java Source directory contents to be merged with the original Java Source directory contents (created in step 2); however, all of the original contents are now deleted (my.pkg.Test1 no longer exists). A prompt appeared asking "do you want to overwrite", but thought this meant "do you want to replace any files that may already exist in the folder", not "we're going to wipe out everything in the folder and only keep your new stuff". When you try the same scenario in the Navigator view, a folder "copy of Java Source" gets created, so you don't lose what was in Java Source. And in Windows Explorer, if you drag a Java Source folder that contains Test2.java onto a folder (Folder1) that contains Java Source/Test1.java, a prompt appears saying, "This folder already contains a folder named 'Java Source'. If the files in the existing folder have the same name as files in the folder you are moving or copying, they will be replaced. Do you still want to copy the folder?" So, Windows Explorer clearly describes what is meant by overwrite and performs a replace only if files of the same name are encountered. So, in summary, drag/drop or copy/cut/paste of a folder within the Package Explorer view overwrites existing folder contents instead of merging contents (when files in one folder do NOT share file names with files in the other folder). The prompt does not clearly explain what is meant by overwrite too, so users who may expect a merge to occur (when files names do not conflict between folders) will be disappointed when the contents of their original folder are lost/deleted.
Adam, can you please have a look. I would also expect that Test1.java still exists after the operation. That would be consistent with normal Explorer behavior.
will have a look
Created attachment 3154 [details] example newFolder/Java Source/my/pkg/Test2.java
imo, this should be handled in core - IResource.move should have a flag that, when set, merges folders. it's strange that the ui has to do workarounds for this limitation suggest doing nothing for now - putting all these workarounds for missing core function would be risky at this point i think the existing code assumed that IResource.move would do the right thing, but it was wrong
asking core for comment on the suggested MERGE_FOLDERS flag for move
Old Summary: [resources] replace instead of copy/merge being performed within Package Explorer [ccp] [dnd] Changed summary to reflect request. Not for 2.1
*** Bug 19372 has been marked as a duplicate of this bug. ***
Re-opening for investigation.
Marking as duplicate since both methods should be changed at the same time. *** This bug has been marked as a duplicate of 31883 ***