1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-03 15:15:25 +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
* 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
* Xuan Chen (IBM) - [191367] with supertransfer on, Drag & Drop Folder from DStore to DStore doesn't work
********************************************************************************/
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.RemoteFolderNotEmptyException;
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.SystemFileTransferModeRegistry;
import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem;
@ -1480,6 +1482,13 @@ public class UniversalFileTransferUtility
targetFS.copy(compressedFolder, newTargetParent, newTargetFolder.getName(), monitor);
// 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);
monitor.done();

View file

@ -20,6 +20,7 @@
* 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
* 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;
@ -2256,6 +2257,29 @@ public class UniversalFileSystemMiner extends Miner {
String newName = nameObj.getName();
String targetType = targetFolder.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)) {
@ -2268,24 +2292,29 @@ public class UniversalFileSystemMiner extends Miner {
return statusDone(status);
}
File srcFile = null;
if (srcType.equals(IUniversalDataStoreConstants.UNIVERSAL_FILE_DESCRIPTOR) || srcType.equals(IUniversalDataStoreConstants.UNIVERSAL_FOLDER_DESCRIPTOR)
|| srcType.equals(IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR)) {
srcFile = getFileFor(sourceFile);
}
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);
ISystemArchiveHandler shandler = getArchiveHandlerFor(svpath.getContainingArchiveString());
if (shandler == null) {
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
return statusDone(status);
if (shandler == null) {
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
return statusDone(status);
}
child = shandler.getVirtualFile(svpath.getVirtualPart());
}
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();
}
@ -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)) {
ISystemArchiveHandler shandler = null;
AbsoluteVirtualPath svpath = null;
if (null == child)
{
svpath = getAbsoluteVirtualPath(sourceFile);
shandler = getArchiveHandlerFor(svpath.getContainingArchiveString());
// extract from an archive to folder
AbsoluteVirtualPath svpath = getAbsoluteVirtualPath(sourceFile);
ISystemArchiveHandler shandler = getArchiveHandlerFor(svpath.getContainingArchiveString());
if (shandler == null) {
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
return statusDone(status);
if (shandler == null) {
status.setAttribute(DE.A_SOURCE, IServiceConstants.FAILED);
return statusDone(status);
}
child = shandler.getVirtualFile(svpath.getVirtualPart());
}
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 destination = new File(parentDir, newName);
@ -2329,7 +2366,7 @@ public class UniversalFileSystemMiner extends Miner {
}
else {
File tgtFolder = getFileFor(targetFolder);
File srcFile = getFileFor(sourceFile);
srcFile = getFileFor(sourceFile);
// regular copy
boolean folderCopy = srcFile.isDirectory();

View file

@ -13,7 +13,8 @@
*
* Contributors:
* {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;
@ -46,7 +47,7 @@ public interface ISystemFilePreferencesConstants
public static final int FILETRANSFERMODE_TEXT = 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;