diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java index 8d1a8125d34..7fbbbe5b197 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/dstore/universal/miners/UniversalFileSystemMiner.java @@ -13,6 +13,7 @@ * Contributors: * Martin Oberhuber (Wind River) - Fix 154874 - handle files with space or $ in the name * Xuan Chen (IBM) - Fix 160768 - [refresh][dstore] Refresh on renamed node within a zip does not work; + * Xuan Chen (IBM) - Fix 189487 - copy and paste a folder did not work - workbench hang ********************************************************************************/ package org.eclipse.rse.dstore.universal.miners; @@ -327,7 +328,19 @@ public class UniversalFileSystemMiner extends Miner { // handle special characters in source and target strings src = enQuote(src); - + + // handle window case separately, since xcopy command could not handler + // multiple source names + if (_isWindows) + { + tgt = tgtFolder.getAbsolutePath() + File.separatorChar + srcFile.getName(); + doCopyCommand(enQuote(src), enQuote(tgt), folderCopy, status); + if (status.getAttribute(DE.A_SOURCE) == IServiceConstants.FAILED) + { + break; + } + continue; + } if (numOfNonVirtualSources == 0) { source += src; @@ -356,7 +369,7 @@ public class UniversalFileSystemMiner extends Miner { if (folderCopy) { command = "xcopy " + source //$NON-NLS-1$ + " " + tgt //$NON-NLS-1$ - + " /S /E /K /Q /H /I"; //$NON-NLS-1$ + + " /S /E /K /Q /H /I /Y"; //$NON-NLS-1$ } else { String unquotedTgt = tgt.substring(1, tgt.length() - 1); @@ -3075,9 +3088,14 @@ private DataElement createDataElementFromLSString(DataElement subject, String tgt = tgtFolder.getAbsolutePath() + File.separatorChar + newName; File tgtFile = new File(tgt); - if (tgtFile.exists() && tgtFile.isDirectory() && newName.equals(srcFile.getName())) + if (tgtFile.exists() && tgtFile.isDirectory()) { - tgt = tgtFolder.getAbsolutePath(); + //For Windows, we need to use xcopy command, which require the new directory + //name be part of the target. + if (newName.equals(srcFile.getName()) && !_isWindows) + { + tgt = tgtFolder.getAbsolutePath(); + } } doCopyCommand(enQuote(src), enQuote(tgt), folderCopy, status); diff --git a/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/internal/services/local/files/LocalFileService.java b/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/internal/services/local/files/LocalFileService.java index 87775381bf8..df180438ee8 100644 --- a/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/internal/services/local/files/LocalFileService.java +++ b/rse/plugins/org.eclipse.rse.services.local/src/org/eclipse/rse/internal/services/local/files/LocalFileService.java @@ -15,6 +15,7 @@ * Martin Oberhuber (Wind River) - fix 168586 - isCaseSensitive() on Windows * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API * Kevin Doyle (IBM) - [182221] Throwing Proper Exceptions on create file/folder + * Xuan Chen (IBM) - Fix 189487 - copy and paste a folder did not work - workbench hang ********************************************************************************/ package org.eclipse.rse.internal.services.local.files; @@ -1110,7 +1111,7 @@ public class LocalFileService extends AbstractFileService implements IFileServic { if (folderCopy) { - command = "xcopy " + src + " " + target + " /S /E /K /Q /H /I"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + command = "xcopy " + src + " " + target + " /S /E /K /Q /H /I /Y"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } else { @@ -1284,7 +1285,7 @@ public class LocalFileService extends AbstractFileService implements IFileServic { if (folderCopy) { - command = "xcopy " + src + " " + target + " /S /E /K /Q /H /I"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + command = "xcopy " + src + " " + target + " /S /E /K /Q /H /I /Y"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } else command = _osCmdShell + "copy " + src + " " + target; //$NON-NLS-1$ //$NON-NLS-2$