### Eclipse Workspace Patch 1.0 #P org.eclipse.rse.ui Index: UI/org/eclipse/rse/internal/ui/view/SystemDNDTransferRunnable.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemDNDTransferRunnable.java,v retrieving revision 1.12 diff -u -r1.12 SystemDNDTransferRunnable.java --- UI/org/eclipse/rse/internal/ui/view/SystemDNDTransferRunnable.java 5 Nov 2007 15:55:23 -0000 1.12 +++ UI/org/eclipse/rse/internal/ui/view/SystemDNDTransferRunnable.java 31 Dec 2007 03:00:46 -0000 @@ -16,6 +16,7 @@ * Rupen Mardirossian (IBM) - [187713] Check to see if target is null before attempting to retrieve targetAdapter in tranferRSEResources method (line 248) * Martin Oberhuber (Wind River) - [200682] Fix drag&drop for elements just adaptable to IResource, like CDT elements * David McKnight (IBM) - [186363] get rid of obsolete calls to SubSystem.connect() + * Xuan Chen (IBM) - [191370] [dstore] Supertransfer zip not deleted when cancelling copy ********************************************************************************/ package org.eclipse.rse.internal.ui.view; @@ -219,6 +220,15 @@ } else if (droppedObjects.hasMessage()) { + //Even the droppedObject has message, it could still has + //dropped results. (user cancels the operation, but some objects + //has already been copied. + //Need to make sure we refresh those copied object. + List results = droppedObjects.getResourceSet(); + for (int d = 0; d < results.size(); d++) + { + _resultTgtObjects.add(results.get(d)); + } operationFailed(monitor); showErrorMessage(droppedObjects.getMessage()); } #P org.eclipse.rse.files.ui Index: src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java,v retrieving revision 1.70 diff -u -r1.70 UniversalFileTransferUtility.java --- src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java 13 Dec 2007 16:10:13 -0000 1.70 +++ src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java 31 Dec 2007 03:00:48 -0000 @@ -37,6 +37,7 @@ * David Mcknight (IBM) - [203114] don't treat XML files specially (no hidden prefs for bin vs text) * David McKnight (IBM) - [209552] get rid of copy APIs to be clearer with download and upload * David McKnight (IBM) - [143503] encoding and isBinary needs to be stored in the IFile properties + * Xuan Chen (IBM) - [191370] [dstore] Supertransfer zip not deleted when cancelling copy ********************************************************************************/ package org.eclipse.rse.files.ui.resources; @@ -1283,6 +1284,19 @@ { if (monitor != null && monitor.isCanceled()) { + try + { + IRemoteFile[] results = targetFS.getRemoteFileObjects((String[])newFilePathList.toArray(new String[newFilePathList.size()]), monitor); + resultSet = new SystemRemoteResourceSet(targetFS, results); + if (workspaceSet.hasMessage()) + { + resultSet.setMessage(workspaceSet.getMessage()); + } + } + catch (Exception e) + { + e.printStackTrace(); + } return resultSet; } @@ -1450,7 +1464,7 @@ } catch (SystemMessageException e) { - SystemMessageDialog.displayMessage(e); + workspaceSet.setMessage(e.getSystemMessage()); } catch (CoreException e) { @@ -1468,6 +1482,10 @@ { IRemoteFile[] results = targetFS.getRemoteFileObjects((String[])newFilePathList.toArray(new String[newFilePathList.size()]), monitor); resultSet = new SystemRemoteResourceSet(targetFS, results); + if (workspaceSet.hasMessage()) + { + resultSet.setMessage(workspaceSet.getMessage()); + } } catch (Exception e) { @@ -1730,6 +1748,9 @@ } IRemoteFile destinationArchive = null; String newPath = null; + IRemoteFileSubSystem targetFS = null; + IRemoteFile remoteArchive = null; + try { monitor.beginTask(FileResources.RESID_SUPERTRANSFER_PROGMON_MAIN,IProgressMonitor.UNKNOWN); @@ -1757,7 +1778,7 @@ IRemoteFile newTargetParent = newTargetFolder.getParentRemoteFile(); monitor.subTask(FileResources.RESID_SUPERTRANSFER_PROGMON_SUBTASK_POPULATE); IRemoteFile sourceDir = localSS.getRemoteFileObject(directory.getLocation().toOSString(), monitor); - IRemoteFileSubSystem targetFS = newTargetFolder.getParentRemoteFileSubSystem(); + targetFS = newTargetFolder.getParentRemoteFileSubSystem(); // FIXME @@ -1769,7 +1790,7 @@ // copy local zip to remote targetFS.upload(destinationArchive.getAbsolutePath(), SystemEncodingUtil.ENCODING_UTF_8, newPath, System.getProperty("file.encoding"), monitor); //$NON-NLS-1$ - IRemoteFile remoteArchive = targetFS.getRemoteFileObject(newPath, monitor); + remoteArchive = targetFS.getRemoteFileObject(newPath, monitor); monitor.subTask(FileResources.RESID_SUPERTRANSFER_PROGMON_SUBTASK_EXTRACT); String compressedFolderPath = newPath + ArchiveHandlerManager.VIRTUAL_SEPARATOR + directory.getName(); @@ -1777,20 +1798,21 @@ // extract the compressed folder from the temp archive on remote targetFS.copy(compressedFolder, newTargetParent, newTargetFolder.getName(), monitor); - - // delete the temp remote archive - // now, DStoreFileService#getFile() (which is invoked by getRemoteFileObject() call) - // has been updated to also put the query object into the dstore file map, - // we don't need to do the query on the remoteArchive object before the - // delete. - targetFS.delete(remoteArchive, monitor); - - monitor.done(); } catch (SystemMessageException e) { - SystemMessageDialog.displayMessage(e); + if (monitor.isCanceled()) + { + //If this operation if canceled, and if the destination has already been created (partially) + //in the host, we need to delete it. + if (newTargetFolder.exists()) + { + targetFS.delete(newTargetFolder, null); + } + } + throw e; + //SystemMessageDialog.displayMessage(e); } catch (Exception e) { @@ -1800,6 +1822,17 @@ finally { if (newPath == null) cleanup(destinationArchive, null); else cleanup(destinationArchive, new File(newPath)); + + // delete the temp remote archive + // now, DStoreFileService#getFile() (which is invoked by getRemoteFileObject() call) + // has been updated to also put the query object into the dstore file map, + // we don't need to do the query on the remoteArchive object before the + // delete. + if (remoteArchive != null && remoteArchive.exists()) + { + targetFS.delete(remoteArchive, null); + } + monitor.done(); } } Index: src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java,v retrieving revision 1.58 diff -u -r1.58 SystemViewRemoteFileAdapter.java --- src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java 19 Dec 2007 03:04:45 -0000 1.58 +++ src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java 31 Dec 2007 03:00:49 -0000 @@ -40,6 +40,7 @@ * David McKnight (IBM) - [209660] need to check if remote encoding has changed before using cached file * Xuan Chen (IBM) - [160775] [api] [breaking] [nl] rename (at least within a zip) blocks UI thread * Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations + * Xuan Chen (IBM) - [191370] [dstore] Supertransfer zip not deleted when cancelling copy ********************************************************************************/ package org.eclipse.rse.internal.files.ui.view; @@ -1844,12 +1845,42 @@ monitor.beginTask(_uploadMessage.getLevelOneText(), size); } // back to hierarchy - return UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)fromSet, targetFolder, monitor, true); + resultSet = UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)fromSet, targetFolder, monitor, true); } else { - return UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)fromSet, targetFolder, monitor, true); + resultSet = UniversalFileTransferUtility.uploadResourcesFromWorkspace((SystemWorkspaceResourceSet)fromSet, targetFolder, monitor, true); } + if (resultSet.hasMessage()) + { + SystemMessage msg = resultSet.getMessage(); + if (monitor.isCanceled() && resultSet.size() > 0) + { + //Get the moved file names + Object thisObject = resultSet.get(0); + String copiedFileNames = null; + if (thisObject instanceof IRemoteFile) + { + copiedFileNames = ((IRemoteFile)thisObject).getName(); + for (int i=1; i<(resultSet.size()); i++) + { + if (thisObject instanceof IRemoteFile) + { + copiedFileNames = copiedFileNames + "\n" + ((IRemoteFile)thisObject).getName(); + } + } + } + //getMessage("RSEG1125").makeSubstitution(movedFileName)); + if (copiedFileNames != null) + { + SystemMessage thisMessage = RSEUIPlugin.getPluginMessage(ISystemMessages.FILEMSG_COPY_INTERRUPTED); + thisMessage.makeSubstitution(copiedFileNames); + resultSet.setMessage(thisMessage); + //SystemMessageDialog.displayErrorMessage(shell, thisMessage); + } + } + } + return resultSet; } else if (fromSet instanceof SystemRemoteResourceSet) { #P org.eclipse.rse.services Index: clientserver/org/eclipse/rse/services/clientserver/archiveutils/SystemZipHandler.java =================================================================== RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services/clientserver/org/eclipse/rse/services/clientserver/archiveutils/SystemZipHandler.java,v retrieving revision 1.12 diff -u -r1.12 SystemZipHandler.java --- clientserver/org/eclipse/rse/services/clientserver/archiveutils/SystemZipHandler.java 30 Nov 2007 16:45:51 -0000 1.12 +++ clientserver/org/eclipse/rse/services/clientserver/archiveutils/SystemZipHandler.java 31 Dec 2007 03:00:51 -0000 @@ -18,6 +18,7 @@ * Xuan Chen (IBM) - [181784] [archivehandlers] zipped text files have unexpected contents * Xuan Chen (IBM) - [160775] [api] rename (at least within a zip) blocks UI thread * Xuan Chen (IBM) - [209828] Need to move the Create operation to a job. + * Xuan Chen (IBM) - [191370] [dstore] Supertransfer zip not deleted when cancelling copy *******************************************************************************/ package org.eclipse.rse.services.clientserver.archiveutils; @@ -1008,6 +1009,12 @@ int numFiles = files.length; for (int i = 0; i < numFiles; i++) { + if (archiveOperationMonitor != null && archiveOperationMonitor.isCanceled()) + { + //the operation has been canceled + closeZipFile(); + return false; + } if (!files[i].exists() || !files[i].canRead()) return false; String fullVirtualName = getFullVirtualName(virtualPath, names[i]); if (exists(fullVirtualName, archiveOperationMonitor)) @@ -1043,6 +1050,13 @@ // Now for each new file to add for (int i = 0; i < numFiles; i++) { + if (archiveOperationMonitor != null && archiveOperationMonitor.isCanceled()) + { + //the operation has been canceled + dest.close(); + closeZipFile(); + return false; + } // append the additional entry to the zip file. ZipEntry newEntry = appendFile(files[i], dest, virtualPath, names[i], sourceEncodings[i], targetEncodings[i], isText[i]); // Add the new entry to the virtual file system in memory