From fee9ecb4419ee8b5223b0fe3556296e1d24b943c Mon Sep 17 00:00:00 2001 From: David McKnight Date: Fri, 20 Apr 2007 18:16:38 +0000 Subject: [PATCH] [180974] fixed remote export --- .../SystemSelectRemoteFolderAction.java | 1 - .../files/RemoteExportWizardPage1.java | 2 +- .../importexport/files/RemoteExporter.java | 21 ++++++++++++------- .../importexport/files/Utilities.java | 8 +++++++ 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemSelectRemoteFolderAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemSelectRemoteFolderAction.java index 737820badc1..fe084300987 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemSelectRemoteFolderAction.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemSelectRemoteFolderAction.java @@ -361,7 +361,6 @@ public class SystemSelectRemoteFolderAction extends SystemBaseDialogAction public IRemoteFile getSelectedFolder() { Object o = getValue(); - System.out.println("selected = "+o); if (o instanceof IRemoteFile[]) return ((IRemoteFile[])o)[0]; else if (o instanceof IRemoteFile) diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteExportWizardPage1.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteExportWizardPage1.java index c6a824d04f3..f9fc65f0ba1 100644 --- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteExportWizardPage1.java +++ b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteExportWizardPage1.java @@ -418,7 +418,7 @@ class RemoteExportWizardPage1 extends WizardExportResourcesPage implements Liste { IHost host = Utilities.parseForSystemConnection(destValue); IRemoteFile path = Utilities.parseForIRemoteFile(destValue); - action.setHost(host); + action.setDefaultConnection(host); action.setPreSelection(path); } diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteExporter.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteExporter.java index 5e99eeff9f8..6f2cdc59d59 100644 --- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteExporter.java +++ b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteExporter.java @@ -30,14 +30,14 @@ import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; * Helper class for exporting resources to the file system. */ class RemoteExporter { - private Object as400 = null; + private IHost _host = null; /** * Create an instance of this class. Use this constructor if you wish to - * use an AS400 object */ + * use an host object */ public RemoteExporter(IHost s) { super(); - as400 = s; + _host = s; } /** @@ -53,8 +53,8 @@ class RemoteExporter { */ public void createFolder(IPath destinationPath) { // IFS: use IFSJaveFile object if necessary - if (as400 != null) - new UniFilePlus(Utilities.getIRemoteFile((IHost) as400, destinationPath.toString())).mkdir(); + if (_host != null) + new UniFilePlus(Utilities.getIRemoteFile((IHost) _host, destinationPath.toString())).mkdir(); else new File(destinationPath.toOSString()).mkdir(); } @@ -87,8 +87,15 @@ class RemoteExporter { * file system */ protected void writeFile(IFile file, IPath destinationPath) throws IOException, CoreException, RemoteFileSecurityException, RemoteFileException { - IRemoteFileSubSystem rfss = RemoteFileUtility.getFileSubSystem((IHost) as400); - rfss.upload(file.getLocation().makeAbsolute().toOSString(), SystemEncodingUtil.ENCODING_UTF_8, destinationPath.toString(), System.getProperty("file.encoding"), null); //$NON-NLS-1$ + IRemoteFileSubSystem rfss = RemoteFileUtility.getFileSubSystem((IHost) _host); + String dest = destinationPath.toString(); + char sep = rfss.getSeparatorChar(); + if (sep != '/') + { + // for windows + dest = dest.replace('/', sep); + } + rfss.upload(file.getLocation().makeAbsolute().toOSString(), SystemEncodingUtil.ENCODING_UTF_8, dest, System.getProperty("file.encoding"), null); //$NON-NLS-1$ } /** diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/Utilities.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/Utilities.java index 7e99d2836b0..5fab2452f6a 100644 --- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/Utilities.java +++ b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/Utilities.java @@ -42,6 +42,14 @@ public class Utilities { if (c != null) { try { IRemoteFileSubSystem ss = RemoteFileUtility.getFileSubSystem(c); + + char sep = ss.getSeparatorChar(); + if (sep != '/') + { + // on windows we need win path + path = path.replace('/', sep); + } + ret = ss.getRemoteFileObject(path); } catch (SystemMessageException e) { // get RemoteFileObject has been changed to raise