1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-14 20:45:22 +02:00

[191367] fix with supertransfer on, Drag & Drop Folder from DStore to DStore doesn't work

This commit is contained in:
Xuan Chen 2007-08-10 02:02:44 +00:00
parent 423c7c50b2
commit 78b6739a1c
3 changed files with 69 additions and 22 deletions

View file

@ -22,6 +22,7 @@
* Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core * Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core
* Xuan Chen (IBM) - [187548] Editor shows incorrect file name after renaming file on Linux dstore * Xuan Chen (IBM) - [187548] Editor shows incorrect file name after renaming file on Linux dstore
* David McKnight (IBM) - [191472] should not use super transfer with SSH/FTP Folder Copy and Paste * David McKnight (IBM) - [191472] should not use super transfer with SSH/FTP Folder Copy and Paste
* Xuan Chen (IBM) - [191367] with supertransfer on, Drag & Drop Folder from DStore to DStore doesn't work
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.files.ui.resources; package org.eclipse.rse.files.ui.resources;
@ -73,6 +74,7 @@ import org.eclipse.rse.services.files.RemoteFileIOException;
import org.eclipse.rse.services.files.RemoteFileSecurityException; import org.eclipse.rse.services.files.RemoteFileSecurityException;
import org.eclipse.rse.services.files.RemoteFolderNotEmptyException; import org.eclipse.rse.services.files.RemoteFolderNotEmptyException;
import org.eclipse.rse.subsystems.files.core.SystemIFileProperties; import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString;
import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility; import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
import org.eclipse.rse.subsystems.files.core.model.SystemFileTransferModeRegistry; import org.eclipse.rse.subsystems.files.core.model.SystemFileTransferModeRegistry;
import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem; import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem;
@ -1480,6 +1482,13 @@ public class UniversalFileTransferUtility
targetFS.copy(compressedFolder, newTargetParent, newTargetFolder.getName(), monitor); targetFS.copy(compressedFolder, newTargetParent, newTargetFolder.getName(), monitor);
// delete the temp remote archive // delete the temp remote archive
//Since this archive file has never been cache before, a default filter DStore Element
//will be created before we send down "delete" commad to dstore server. Since "delete"
//command is not a registered command for a filter
//element, the delete command query will not be sent to dstore server.
//To overcome this problem, we need to do query on it first to cache
//its information so that it could be deleted properly.
targetFS.resolveFilterString(newPath + RemoteFileFilterString.SWITCH_NOSUBDIRS, monitor);
targetFS.delete(remoteArchive, monitor); targetFS.delete(remoteArchive, monitor);
monitor.done(); monitor.done();

View file

@ -20,6 +20,7 @@
* Kevin Doyle (IBM) - [195709] Windows Copying doesn't work when path contains space * Kevin Doyle (IBM) - [195709] Windows Copying doesn't work when path contains space
* Kevin Doyle (IBM) - [196211] DStore Move tries rename if that fails copy/delete * Kevin Doyle (IBM) - [196211] DStore Move tries rename if that fails copy/delete
* Xuan Chen (IBM) - [198046] [dstore] Cannot copy a folder into an archive file * Xuan Chen (IBM) - [198046] [dstore] Cannot copy a folder into an archive file
* Xuan Chen (IBM) - [191367] with supertransfer on, Drag & Drop Folder from DStore to DStore doesn't work
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.dstore.universal.miners; package org.eclipse.rse.dstore.universal.miners;
@ -2256,6 +2257,29 @@ public class UniversalFileSystemMiner extends Miner {
String newName = nameObj.getName(); String newName = nameObj.getName();
String targetType = targetFolder.getType(); String targetType = targetFolder.getType();
String srcType = sourceFile.getType(); String srcType = sourceFile.getType();
//In the case of super transfer, the source file is a virtual file/folder inside the temporary zip file, and its type information is set to
//default UNIVERSAL_FILTER_DESCRIPTOR since its information never been cached before.
//We need to find out its real type first before going to different if statement.
File srcFile = null;
VirtualChild child = null;
if (IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR == srcType)
{
if (ArchiveHandlerManager.isVirtual(sourceFile.getValue()))
{
String goodFullName = ArchiveHandlerManager.cleanUpVirtualPath(sourceFile.getValue());
child = _archiveHandlerManager.getVirtualObject(goodFullName);
if (child.exists())
{
if (child.isDirectory)
{
srcType = IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR;
} else
{
srcType = IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR;
}
}
}
}
if (targetType.equals(IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR) || targetType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR)) { if (targetType.equals(IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR) || targetType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR)) {
@ -2268,24 +2292,29 @@ public class UniversalFileSystemMiner extends Miner {
return statusDone(status); return statusDone(status);
} }
File srcFile = null;
if (srcType.equals(IUniversalDataStoreConstants.UNIVERSAL_FILE_DESCRIPTOR) || srcType.equals(IUniversalDataStoreConstants.UNIVERSAL_FOLDER_DESCRIPTOR) if (srcType.equals(IUniversalDataStoreConstants.UNIVERSAL_FILE_DESCRIPTOR) || srcType.equals(IUniversalDataStoreConstants.UNIVERSAL_FOLDER_DESCRIPTOR)
|| srcType.equals(IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR)) { || srcType.equals(IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR)) {
srcFile = getFileFor(sourceFile); srcFile = getFileFor(sourceFile);
} }
else if (srcType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR) || srcType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR)) { else if (srcType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR) || srcType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR)) {
ISystemArchiveHandler shandler = null;
if (null == child)
{
AbsoluteVirtualPath svpath = getAbsoluteVirtualPath(sourceFile);
shandler = getArchiveHandlerFor(svpath.getContainingArchiveString());
AbsoluteVirtualPath svpath = getAbsoluteVirtualPath(sourceFile); if (shandler == null) {
ISystemArchiveHandler shandler = getArchiveHandlerFor(svpath.getContainingArchiveString()); status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
return statusDone(status);
if (shandler == null) { }
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED); child = shandler.getVirtualFile(svpath.getVirtualPart());
return statusDone(status); }
else
{
//If child is not null, it means the sourceFile is a type of UNIVERSAL_FILTER_DESCRIPTOR, and has already been handled
shandler = child.getHandler();
} }
VirtualChild child = shandler.getVirtualFile(svpath.getVirtualPart());
srcFile = child.getExtractedFile(); srcFile = child.getExtractedFile();
} }
@ -2305,17 +2334,25 @@ public class UniversalFileSystemMiner extends Miner {
} }
} }
else if (srcType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR) || srcType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR)) { else if (srcType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR) || srcType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR)) {
ISystemArchiveHandler shandler = null;
AbsoluteVirtualPath svpath = null;
if (null == child)
{
svpath = getAbsoluteVirtualPath(sourceFile);
shandler = getArchiveHandlerFor(svpath.getContainingArchiveString());
// extract from an archive to folder if (shandler == null) {
AbsoluteVirtualPath svpath = getAbsoluteVirtualPath(sourceFile); status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
ISystemArchiveHandler shandler = getArchiveHandlerFor(svpath.getContainingArchiveString()); return statusDone(status);
}
if (shandler == null) { child = shandler.getVirtualFile(svpath.getVirtualPart());
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED); }
return statusDone(status); else
{
//If child is not null, it means the sourceFile is a type of UNIVERSAL_FILTER_DESCRIPTOR, and has already been handled
shandler = child.getHandler();
svpath = getAbsoluteVirtualPath(sourceFile.getValue());
} }
VirtualChild child = shandler.getVirtualFile(svpath.getVirtualPart());
File parentDir = getFileFor(targetFolder); File parentDir = getFileFor(targetFolder);
File destination = new File(parentDir, newName); File destination = new File(parentDir, newName);
@ -2329,7 +2366,7 @@ public class UniversalFileSystemMiner extends Miner {
} }
else { else {
File tgtFolder = getFileFor(targetFolder); File tgtFolder = getFileFor(targetFolder);
File srcFile = getFileFor(sourceFile); srcFile = getFileFor(sourceFile);
// regular copy // regular copy
boolean folderCopy = srcFile.isDirectory(); boolean folderCopy = srcFile.isDirectory();

View file

@ -13,7 +13,8 @@
* *
* Contributors: * Contributors:
* {Name} (company) - description of contribution. * {Name} (company) - description of contribution.
* David McKnight (IBM) - [191367] seeting supertransfer to be disabled by default * David McKnight (IBM) - [191367] setting supertransfer to be disabled by default
* Xuan Chen (IBM) - [191367] setting supertransfer back to enabled by default
*******************************************************************************/ *******************************************************************************/
package org.eclipse.rse.internal.subsystems.files.core; package org.eclipse.rse.internal.subsystems.files.core;
@ -46,7 +47,7 @@ public interface ISystemFilePreferencesConstants
public static final int FILETRANSFERMODE_TEXT = 1; public static final int FILETRANSFERMODE_TEXT = 1;
public static final String DEFAULT_SUPERTRANSFER_ARCHIVE_TYPE = "zip"; //$NON-NLS-1$ public static final String DEFAULT_SUPERTRANSFER_ARCHIVE_TYPE = "zip"; //$NON-NLS-1$
public static final boolean DEFAULT_DOSUPERTRANSFER = false; public static final boolean DEFAULT_DOSUPERTRANSFER = true;
public static final int DEFAULT_DOWNLOAD_BUFFER_SIZE = 40; public static final int DEFAULT_DOWNLOAD_BUFFER_SIZE = 40;