Community
Participate
Working Groups
Build Identifier: M20110909-1335 I drop the files into project resources. When there exists a file with such name, "do you wish to overwrite" dialog appears. Pressing does nothing -- I see that resource is still linked to the previous file location. The same thing happens in e4. There is an easy workaround but it is definitely a bug. Either complete overwriting or do not claim that you will. Reproducible: Always Steps to Reproduce: 1.Drop a file into a project. Link it. 2.Drop another file with the same name from another location. Choose linking import also. 3.Agree on "do you wish to overwrite?" dialog In the resource properties, see that location still links to the first file location.
Serge, could you take a look? For me it looks like a problem with ImportOperation#importFile around line 571.
Here's a patch to address this issue: diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/wizards/datatransfer/ImportOperation.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/wizards/datatransfer/ImportOperation.java index 6d588f6..f3c035e 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/wizards/datatransfer/ImportOperation.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/wizards/datatransfer/ImportOperation.java @@ -568,16 +568,24 @@ public class ImportOperation extends WorkspaceModifyOperation { } try { - if (targetResource.exists()) { - targetResource.setContents(contentStream, - IResource.KEEP_HISTORY, null); + if (createVirtualFolder || createLinks || createLinkFilesOnly) { + if (targetResource.exists()) + targetResource.delete(true, null); + targetResource.createLink(createRelativePath( + new Path(provider + .getFullPath(fileObject)), targetResource), 0, null); } else { - if (createVirtualFolder || createLinks || createLinkFilesOnly) - targetResource.createLink(createRelativePath( - new Path(provider - .getFullPath(fileObject)), targetResource), 0, null); - else - targetResource.create(contentStream, false, null); + if (targetResource.exists()) { + if (targetResource.isLinked()) { + targetResource.delete(true, null); + targetResource.create(contentStream, false, null); + } + else + targetResource.setContents(contentStream, + IResource.KEEP_HISTORY, null); + } + else + targetResource.create(contentStream, false, null); } setResourceAttributes(targetResource, fileObject); I verified and tested the following use case: - Drag and drop a simple linked resource file - Drag and drop a simple file - Drag and drop a simple file, overriding an existing resource - Drag and drop a simple linked resource file an existing linked resource - Drag and drop a simple file, overriding an existing linked resource - Drag and drop a simple linked resource file an existing resource Note: the last 2 cases, there's bug in the UI, it doesn't refresh so the linked resource overlay doesn't disappear: filed bug with it. F5 does update it properly)
The bug in the Project Explorer has been filed as Bug 366380
I also verified that the folder import operation works as expected.
Now fixed on the git repo. Szymon, you mentioned there was another branch I should commit it to, which one was it?
The fix should be in master and R3_development.
(In reply to comment #6) > The fix should be in master and R3_development. Thanks, now fixed on R3_development as well.