| Summary: | Linked resources are not overwritten pressing "yes" on "do you wish to overwrite" | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | valentin Mising name <intellij> |
| Component: | IDE | Assignee: | Serge Beauchamp <serge> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | pwebster, Szymon.Brandys |
| Version: | 3.8 | ||
| Target Milestone: | 3.8 M5 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
valentin Mising name
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. |