Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'rse/plugins/org.eclipse.rse.importexport')
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/.classpath7
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/.cvsignore1
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/.project34
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/.settings/org.eclipse.jdt.core.prefs75
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/HelpContexts.xml32
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/META-INF/MANIFEST.MF31
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/about.html28
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/build.properties20
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/icons/full/etool16/file_export.gifbin187 -> 0 bytes
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/icons/full/etool16/file_import.gifbin189 -> 0 bytes
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/icons/full/wizards/fsicon_wiz.gifbin173 -> 0 bytes
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/icons/full/wizban/export_wiz.gifbin2816 -> 0 bytes
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/icons/full/wizban/import_wiz.gifbin2960 -> 0 bytes
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/plugin.properties58
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/plugin.xml259
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/IRemoteImportExportConstants.java71
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportDescriptionFilesViewerFilter.java93
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportPlugin.java90
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportProblemDialog.java141
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportResources.java80
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportResources.properties89
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportRunnable.java42
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportUtil.java143
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/SystemImportExportResources.java87
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/SystemImportExportResources.properties104
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/Debug.java20
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/FileSystemElement.java233
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/FileSystemStructureProvider.java101
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/IImportStructureProvider.java64
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/IRemoteFileExportDescriptionReader.java25
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/IRemoteFileExportDescriptionWriter.java25
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/IRemoteFileImportDescriptionReader.java25
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/IRemoteFileImportDescriptionWriter.java25
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/MinimizedFileSystemElement.java62
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteExportWizard.java131
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteExportWizardPage1.java989
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteExporter.java156
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportActionDelegate.java182
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportData.java197
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportDescriptionReader.java211
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportDescriptionWriter.java172
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportFromProjectActionDelegate.java31
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportOperation.java573
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportActionDelegate.java187
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportData.java230
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportDescriptionReader.java202
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportDescriptionWriter.java174
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportExportActionDelegate.java119
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportOperation.java707
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportToProjectActionDelegate.java31
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileOpenExportWizardActionDelegate.java83
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileOpenImportWizardActionDelegate.java83
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileOverwriteQuery.java95
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteImportWizard.java128
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteImportWizardPage1.java1647
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/TreeExpandDropListener.java89
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/TreeScrollDropListener.java145
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/UniFilePlus.java432
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/Utilities.java245
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/ISynchronizeData.java124
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/RSEResourceVariantComparator.java150
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/RSESyncUtils.java285
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/SynchronizeData.java205
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/FileModificationValidator.java104
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/FileSystemOperations.java564
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/FileSystemPlugin.java135
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/FileSystemProvider.java436
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/FileSystemProviderType.java36
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/Policy.java103
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/messages.properties46
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/subscriber/FileSystemMergeContext.java122
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/subscriber/FileSystemRemoteTree.java78
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/subscriber/FileSystemResourceVariant.java186
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/subscriber/FileSystemSubscriber.java235
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/subscriber/FileSystemSyncInfo.java70
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/CompoundResourceTraversal.java291
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/FileSystemOperation.java181
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/FileSystemSynchronizeParticipant.java296
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/GetOperation.java120
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/MergeOperation.java116
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/ModelGetAction.java85
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/ModelMergeAction.java89
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/ModelPutAction.java87
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/PutOperation.java136
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizeByteCalculator.java52
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizeConnectionManager.java42
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizeFilter.java28
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizeOperation.java76
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizePerspectiveSelector.java30
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizer.java34
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/SynchronizeConnectionManager.java33
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/SynchronizeFilter.java36
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/SynchronizeOperation.java82
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/SynchronizePerspectiveSelector.java161
-rw-r--r--rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/Synchronizer.java158
95 files changed, 0 insertions, 14316 deletions
diff --git a/rse/plugins/org.eclipse.rse.importexport/.classpath b/rse/plugins/org.eclipse.rse.importexport/.classpath
deleted file mode 100644
index 64c5e31b7..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/rse/plugins/org.eclipse.rse.importexport/.cvsignore b/rse/plugins/org.eclipse.rse.importexport/.cvsignore
deleted file mode 100644
index ba077a403..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/rse/plugins/org.eclipse.rse.importexport/.project b/rse/plugins/org.eclipse.rse.importexport/.project
deleted file mode 100644
index 51eec03a7..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/.project
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.rse.importexport</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
- </natures>
-</projectDescription>
diff --git a/rse/plugins/org.eclipse.rse.importexport/.settings/org.eclipse.jdt.core.prefs b/rse/plugins/org.eclipse.rse.importexport/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 7fb85b98b..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,75 +0,0 @@
-#Fri Feb 06 12:03:25 CET 2009
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.doc.comment.support=enabled
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=warning
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
-org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
-org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
-org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.5
diff --git a/rse/plugins/org.eclipse.rse.importexport/HelpContexts.xml b/rse/plugins/org.eclipse.rse.importexport/HelpContexts.xml
deleted file mode 100644
index 15203023b..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/HelpContexts.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved.
-This program and the accompanying materials are made available under the terms
-of the Eclipse Public License v1.0 which accompanies this distribution, and is
-available at http://www.eclipse.org/legal/epl-v10.html
-
-Initial Contributors:
-The following IBM employees contributed to the Remote System Explorer
-component that contains this file: David McKnight, Kushal Munir,
-Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
-Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
-
-Contributors:
-Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
--->
-<?NLS TYPE="org.eclipse.help.contexts"?>
-<contexts>
-
-<!-- Import wizard help -->
-<context id="import_context">
- <description>Import files from a remote server to a project on your local workstation.</description>
- <topic href="../org.eclipse.rse.doc.user/tasks/tremoimp.htm" label="Importing resources from a remote file system"/>
-</context>
-
-<!-- Export wizard help -->
-<context id="export_context">
- <description>Export files from your local workstation to a folder on a remote server.</description>
- <topic href="../org.eclipse.rse.doc.user/tasks/tremoexp.htm" label="Exporting resources to a remote file system"/>
-</context>
-
-</contexts> \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.importexport/META-INF/MANIFEST.MF b/rse/plugins/org.eclipse.rse.importexport/META-INF/MANIFEST.MF
deleted file mode 100644
index 3e12ca870..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,31 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.rse.importexport; singleton:=true
-Bundle-Version: 1.2.102.qualifier
-Bundle-Activator: org.eclipse.rse.internal.importexport.RemoteImportExportPlugin
-Bundle-Localization: plugin
-Export-Package: org.eclipse.rse.internal.importexport;x-internal:=true,
- org.eclipse.rse.internal.importexport.files;x-internal:=true,
- org.eclipse.rse.internal.synchronize;x-internal:=true,
- org.eclipse.rse.internal.synchronize.filesystem;x-internal:=true,
- org.eclipse.rse.internal.synchronize.filesystem.subscriber;x-internal:=true,
- org.eclipse.rse.internal.synchronize.filesystem.ui;x-internal:=true,
- org.eclipse.rse.internal.synchronize.provisional;x-internal:=true
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.ui,
- org.eclipse.ui.ide,
- org.eclipse.ui.views,
- org.eclipse.rse.services;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.rse.core;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.rse.ui;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.rse.subsystems.files.core;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.rse.files.ui;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.compare,
- org.eclipse.team.core,
- org.eclipse.team.ui
-Bundle-ActivationPolicy: lazy
-Eclipse-LazyStart: true
-Bundle-Vendor: %providerName
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/rse/plugins/org.eclipse.rse.importexport/about.html b/rse/plugins/org.eclipse.rse.importexport/about.html
deleted file mode 100644
index d4cc693f9..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 5, 2007</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.importexport/build.properties b/rse/plugins/org.eclipse.rse.importexport/build.properties
deleted file mode 100644
index 4d88b2fcc..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/build.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2007 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-# Martin Oberhuber (Wind River) - remove branding plugin files
-###############################################################################
-bin.includes = META-INF/,\
- .,\
- about.html,\
- icons/,\
- plugin.properties,\
- plugin.xml
-src.includes = about.html
-source.. = src/
-output.. = bin/
diff --git a/rse/plugins/org.eclipse.rse.importexport/icons/full/etool16/file_export.gif b/rse/plugins/org.eclipse.rse.importexport/icons/full/etool16/file_export.gif
deleted file mode 100644
index a13e02f6b..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/icons/full/etool16/file_export.gif
+++ /dev/null
Binary files differ
diff --git a/rse/plugins/org.eclipse.rse.importexport/icons/full/etool16/file_import.gif b/rse/plugins/org.eclipse.rse.importexport/icons/full/etool16/file_import.gif
deleted file mode 100644
index 5709c2ec8..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/icons/full/etool16/file_import.gif
+++ /dev/null
Binary files differ
diff --git a/rse/plugins/org.eclipse.rse.importexport/icons/full/wizards/fsicon_wiz.gif b/rse/plugins/org.eclipse.rse.importexport/icons/full/wizards/fsicon_wiz.gif
deleted file mode 100644
index af038fa69..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/icons/full/wizards/fsicon_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/rse/plugins/org.eclipse.rse.importexport/icons/full/wizban/export_wiz.gif b/rse/plugins/org.eclipse.rse.importexport/icons/full/wizban/export_wiz.gif
deleted file mode 100644
index 41a782321..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/icons/full/wizban/export_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/rse/plugins/org.eclipse.rse.importexport/icons/full/wizban/import_wiz.gif b/rse/plugins/org.eclipse.rse.importexport/icons/full/wizban/import_wiz.gif
deleted file mode 100644
index caffb689e..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/icons/full/wizban/import_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/rse/plugins/org.eclipse.rse.importexport/plugin.properties b/rse/plugins/org.eclipse.rse.importexport/plugin.properties
deleted file mode 100644
index f49c8197a..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/plugin.properties
+++ /dev/null
@@ -1,58 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2009 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-# Martin Oberhuber (Wind River) - add providerName
-# Takuya Miyamoto - [185925] Integrate Platform/Team Synchronization
-# David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
-###############################################################################
-
-# NLS_MESSAGEFORMAT_NONE
-# NLS_ENCODING=UTF-8
-
-# Plugin name
-pluginName = RSE Import/Export
-providerName = Eclipse.org - DSDP
-
-# Remote file import and export wizards
-newWizardCategoryName = Remote Systems
-
-RemoteFileSystemExportWizard.label = Remote file system
-RemoteFileSystemExportWizard.description = Export resources to a remote file system
-RemoteFileSystemImportWizard.label = Remote file system
-RemoteFileSystemImportWizard.description = Import resources from a remote file system
-
-# Remote file export action
-RemoteFileExportAction.label = E&xport to Remote File System
-RemoteFileExportAction.tooltip = Exports resources to a remote file system based on the selected export description file
-
-# Open remote file export wizard
-OpenRemoteFileExport.label = Ope&n Remote File Exporter...
-OpenRemoteFileExport.tooltip = Opens the remote file system export wizard based on the selected export description file
-
-# Remote file import action
-RemoteFileImportAction.label = Import from Remote File System
-RemoteFileImportAction.tooltip = Imports resources from a remote file system based on the selected import description file
-
-# Open remote file import wizard
-OpenRemoteFileImport.label = Ope&n Remote File Importer...
-OpenRemoteFileImport.tooltip = Opens the remote file system import wizard based on the selected import description file
-
-# Import to project
-ImportToProject.label = Import To Project...
-ImportToProject.tooltip = Import contents of selected folder to a project
-
-# Export from project
-ExportFromProject.label = Export From Project...
-ExportFromProject.tooltip = Export contents of project to the selected folder
-
-# Run synchronization
-Synchronize.label = Synchronize with ...
-Synchronize.tooltip = Synchronize contents in local with remote
-
-RSESyncParticipant.name = RSE Synchronize \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.importexport/plugin.xml b/rse/plugins/org.eclipse.rse.importexport/plugin.xml
deleted file mode 100644
index 05b0d9e92..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/plugin.xml
+++ /dev/null
@@ -1,259 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (c) 2002, 2009 IBM Corporation and others. All rights reserved.
-This program and the accompanying materials are made available under the terms
-of the Eclipse Public License v1.0 which accompanies this distribution, and is
-available at http://www.eclipse.org/legal/epl-v10.html
-
-Initial Contributors:
-The following IBM employees contributed to the Remote System Explorer
-component that contains this file: David McKnight, Kushal Munir,
-Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
-Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
-
-Contributors:
-David McKnight (IBM) - [261019] New File/Folder actions available in Work Offline mode
-Takuya Miyamoto - [185925] Integrate Platform/Team Synchronization (adapted from org.eclipse.team.examples.filesystem / plugin.xml)
-David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
--->
-
-<?eclipse version="3.0"?>
-<plugin>
-
-<!-- ========================================================================= -->
-<!-- Remote File System import and export wizards. -->
-<!-- ========================================================================= -->
- <extension point="org.eclipse.ui.importWizards">
- <category name="%newWizardCategoryName" id="org.eclipse.rse.importexport.importWizards">
- </category>
- <wizard
- name="%RemoteFileSystemImportWizard.label"
- icon="icons/full/etool16/file_import.gif"
- category="org.eclipse.rse.importexport.importWizards"
- class="org.eclipse.rse.internal.importexport.files.RemoteImportWizard"
- id="org.eclipse.rse.files.importexport.fileImportWizard">
- <description>
- %RemoteFileSystemImportWizard.description
- </description>
- <selection
- class="org.eclipse.core.resources.IResource">
- </selection>
- </wizard>
- </extension>
-
- <extension
- point="org.eclipse.ui.popupMenus">
- <objectContribution
- objectClass="org.eclipse.core.resources.IResource"
- nameFilter="*.rimpfd"
- id="org.eclipse.rse.files.importexport.runFileImport">
- <action
- label="%RemoteFileImportAction.label"
- tooltip="%RemoteFileImportAction.tooltip"
- class="org.eclipse.rse.internal.importexport.files.RemoteFileImportActionDelegate"
- menubarPath="additions"
- enablesFor="+"
- id="importRemoteFiles">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.core.resources.IResource"
- nameFilter="*.rimpfd"
- id="org.eclipse.rse.files.importexport.openFileImport">
- <action
- label="%OpenRemoteFileImport.label"
- tooltip="%OpenRemoteFileImport.tooltip"
- class="org.eclipse.rse.internal.importexport.files.RemoteFileOpenImportWizardActionDelegate"
- menubarPath="additions"
- enablesFor="1"
- id="openRemoteFileImport">
- </action>
- </objectContribution>
- </extension>
-
- <extension
- point="org.eclipse.ui.exportWizards">
-
- <category name="%newWizardCategoryName" id="org.eclipse.rse.importexport.exportWizards">
- </category>
- <wizard
- name="%RemoteFileSystemExportWizard.label"
- icon="icons/full/etool16/file_export.gif"
- category="org.eclipse.rse.importexport.exportWizards"
- class="org.eclipse.rse.internal.importexport.files.RemoteExportWizard"
- id="org.eclipse.rse.files.importexport.fileExportWizard">
- <description>
- %RemoteFileSystemExportWizard.description
- </description>
- <selection
- class="org.eclipse.core.resources.IResource">
- </selection>
- </wizard>
- </extension>
-
- <extension
- point="org.eclipse.ui.popupMenus">
- <objectContribution
- objectClass="org.eclipse.core.resources.IResource"
- nameFilter="*.rexpfd"
- id="org.eclipse.rse.files.importexport.runFileExport">
- <action
- label="%RemoteFileExportAction.label"
- tooltip="%RemoteFileExportAction.tooltip"
- class="org.eclipse.rse.internal.importexport.files.RemoteFileExportActionDelegate"
- menubarPath="additions"
- enablesFor="+"
- id="exportRemoteFiles">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.core.resources.IResource"
- nameFilter="*.rexpfd"
- id="org.eclipse.rse.files.importexport.openFileExport">
- <action
- label="%OpenRemoteFileExport.label"
- tooltip="%OpenRemoteFileExport.tooltip"
- class="org.eclipse.rse.internal.importexport.files.RemoteFileOpenExportWizardActionDelegate"
- menubarPath="additions"
- enablesFor="1"
- id="openRemoteFileExport">
- </action>
- </objectContribution>
- </extension>
-
- <extension
- point="org.eclipse.ui.popupMenus">
- <objectContribution
- objectClass="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile"
- id="org.eclipse.rse.files.importexport.projectImportExport">
- <filter name="isDirectory" value="true"/>
-
- <action
- label="%ImportToProject.label"
- tooltip="%ImportToProject.tooltip"
- class="org.eclipse.rse.internal.importexport.files.RemoteFileImportToProjectActionDelegate"
- menubarPath="group.importexport"
- enablesFor="1"
- id="importToProject">
- <enablement>
- <objectState name="offline" value="false"/>
- </enablement>
- </action>
-
- <action
- label="%ExportFromProject.label"
- tooltip="%ExportFromProject.tooltip"
- class="org.eclipse.rse.internal.importexport.files.RemoteFileExportFromProjectActionDelegate"
- menubarPath="group.importexport"
- enablesFor="1"
- id="exportFromProject">
- <enablement>
- <objectState name="offline" value="false"/>
- </enablement>
- </action>
- </objectContribution>
- </extension>
-
- <!-- ======================================= -->
- <!-- Synchronize Popup Menu Actions -->
- <!-- ======================================= -->
-<!-- <extension point="org.eclipse.ui.popupMenus">
- <objectContribution
- objectClass="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile"
- nameFilter="*.rexpfd"
- id="org.rse.synchronize.runResynchronization">
- <action
- label="ReSynchronize with"
- tooltip="Rerun synchronization which is alreay mapped to remote"
- class="org.eclipse.rse.internal.synchronize.ResynchronizeActionDelegate"
- menubarPath="additions"
- enablesFor="1"
- id="resynchronize">
- </action>
- </objectContribution>
- </extension>
- <extension point="org.eclipse.ui.popupMenus">
- <objectContribution
- objectClass="org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile"
- nameFilter="*.rimpfd"
- id="org.rse.synchronize.runResynchronization">
- <action
- label="ReSynchronize with"
- tooltip="Rerun synchronization which is alreay mapped to remote"
- class="org.eclipse.rse.internal.synchronize.ResynchronizeActionDelegate"
- menubarPath="additions"
- enablesFor="1"
- id="resynchronize">
- </action>
- </objectContribution>
- </extension>-->
-<!-- =================================================================================== -->
-<!-- Repository Providers -->
-<!-- =================================================================================== -->
-
-<extension point="org.eclipse.team.core.repository">
- <repository
- class="org.eclipse.rse.internal.synchronize.filesystem.FileSystemProvider"
- id="org.eclipse.rse.internal.synchronize.filesystem.FileSystemProvider">
- </repository>
-</extension>
-
-<!-- =================================================================================== -->
-<!-- Synchronize Participants -->
-<!-- =================================================================================== -->
-
- <extension
- point="org.eclipse.team.ui.synchronizeParticipants">
- <participant
- persistent="false"
- class="org.eclipse.rse.internal.synchronize.filesystem.ui.FileSystemSynchronizeParticipant"
- icon="icons/full/wizards/fsicon_wiz.gif"
- name="%RSESyncParticipant.name"
- id="org.eclipse.rse.internal.synchronize.filesystem.participant"/>
- </extension>
-
-<!-- =================================================================================== -->
-<!-- Common Navigator viewer for the file systen synchronizations -->
-<!-- =================================================================================== -->
- <extension
- point="org.eclipse.ui.navigator.viewer">
- <viewer
- viewerId="org.eclipse.rse.internal.synchronize.filesystem.syncViewer">
- <popupMenu
- allowsPlatformContributions="false"
- id="org.eclipse.rse.synchronize.filesystem.syncViewer#PopupMenu">
- <insertionPoint name="file"/>
- <insertionPoint name="edit"/>
- <insertionPoint name="synchronize"/>
- <insertionPoint
- name="navigate"
- separator="true"/>
- <insertionPoint
- name="merge"
- separator="true"/>
- <insertionPoint
- name="put"
- separator="false"/>
- <insertionPoint
- name="get"
- separator="false"/>
- <insertionPoint
- name="overwrite"
- separator="true"/>
- <insertionPoint
- name="other"
- separator="true"/>
- <insertionPoint
- name="sort"
- separator="true"/>
- <insertionPoint
- name="additions"
- separator="true"/>
- <insertionPoint
- name="properties"
- separator="true"/>
- </popupMenu>
- </viewer>
- </extension>
-
-</plugin>
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/IRemoteImportExportConstants.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/IRemoteImportExportConstants.java
deleted file mode 100644
index a38c7f90b..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/IRemoteImportExportConstants.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport;
-
-/**
- * Interface containing contstants required for import and export.
- */
-public interface IRemoteImportExportConstants {
- /**
- * Remote file import description file extension, "rimpfd".
- */
- public static final String REMOTE_FILE_IMPORT_DESCRIPTION_FILE_EXTENSION = "rimpfd"; //$NON-NLS-1$
- /**
- * An array of import description file extensions.
- */
- public static final String[] REMOTE_IMPORT_DESCRIPTION_FILE_EXTENSIONS = { REMOTE_FILE_IMPORT_DESCRIPTION_FILE_EXTENSION };
- /**
- * Remote file export description file extension, "rexpfd".
- */
- public static final String REMOTE_FILE_EXPORT_DESCRIPTION_FILE_EXTENSION = "rexpfd"; //$NON-NLS-1$
- /**
- * Remote jar export description file extension, "rmtjardesc".
- */
- public static final String REMOTE_JAR_EXPORT_DESCRIPTION_FILE_EXTENSION = "rmtjardesc"; //$NON-NLS-1$
- /**
- * An array of export description file extensions.
- */
- public static final String[] REMOTE_EXPORT_DESCRIPTION_FILE_EXTENSIONS = { REMOTE_FILE_EXPORT_DESCRIPTION_FILE_EXTENSION, REMOTE_JAR_EXPORT_DESCRIPTION_FILE_EXTENSION };
-
-
- // message ids
- // -------------------------
- // IMPORT/EXPORT MESSAGES...
- // -------------------------
- public static final String FILEMSG_COPY_ROOT = "RSEF8050"; //$NON-NLS-1$
- public static final String FILEMSG_IMPORT_ERROR = "RSEF8052"; //$NON-NLS-1$
- public static final String FILEMSG_IMPORT_PROBLEMS = "RSEF8054"; //$NON-NLS-1$
- public static final String FILEMSG_IMPORT_SELF = "RSEF8056"; //$NON-NLS-1$
- public static final String FILEMSG_EXPORT_ERROR = "RSEF8057"; //$NON-NLS-1$
- public static final String FILEMSG_EXPORT_PROBLEMS = "RSEF8058"; //$NON-NLS-1$
- public static final String FILEMSG_NOT_WRITABLE = "RSEF8059"; //$NON-NLS-1$
-
- public static final String FILEMSG_TARGET_EXISTS = "RSEF8060"; //$NON-NLS-1$
- public static final String FILEMSG_FOLDER_IS_FILE = "RSEF8061"; //$NON-NLS-1$
- public static final String FILEMSG_DESTINATION_CONFLICTING = "RSEF8062"; //$NON-NLS-1$
- public static final String FILEMSG_SOURCE_IS_FILE = "RSEF8063"; //$NON-NLS-1$
- public static final String FILEMSG_SOURCE_EMPTY = "RSEF8066"; //$NON-NLS-1$
- public static final String FILEMSG_EXPORT_FAILED = "RSEF8067"; //$NON-NLS-1$
- public static final String FILEMSG_EXPORT_NONE_SELECTED = "RSEF8068"; //$NON-NLS-1$
- public static final String FILEMSG_DESTINATION_EMPTY = "RSEF8069"; //$NON-NLS-1$
- public static final String FILEMSG_IMPORT_FAILED = "RSEF8070"; //$NON-NLS-1$
- public static final String FILEMSG_IMPORT_NONE_SELECTED = "RSEF8071"; //$NON-NLS-1$
- public static final String FILEMSG_IMPORT_FILTERING = "RSEF8072"; //$NON-NLS-1$
-
- // file import/export messages
- public static final String MSG_IMPORT_EXPORT_UNABLE_TO_USE_CONNECTION = "RSEF5101"; //$NON-NLS-1$
- public static final String MSG_IMPORT_EXPORT_UNEXPECTED_EXCEPTION = "RSEF5102"; //$NON-NLS-1$
-
-
- public static final String FILEMSG_CREATE_FOLDER_FAILED = "RSEF1304"; //$NON-NLS-1$
-
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportDescriptionFilesViewerFilter.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportDescriptionFilesViewerFilter.java
deleted file mode 100644
index 11d9c1974..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportDescriptionFilesViewerFilter.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-
-/**
- * This class defines a viewer filter that can be used with a selection dialog, e.g. <code>ElementTreeSelectionDialog</code>.
- * The viewer filter only allows description files for import/export. Current known extensions are defined
- * in class <code>RemoteFileImportExportConstants</code>.
- */
-public class RemoteImportExportDescriptionFilesViewerFilter extends ViewerFilter {
- /**
- * Constant indicating descriptor files for both import and export should be allowed.
- */
- public static final int IMPORT_EXPORT = 0;
- /**
- * Constant indicating that only descriptor files for imports should be allowed.
- */
- public static final int IMPORT_ONLY = 1;
- /**
- * Constant indicating that only descriptor files for exports should be allowed.
- */
- public static final int EXPORT_ONLY = 2;
- private int mode;
-
- /**
- * Constructor.
- * @param mode the mode. One of <code>IMPORT_EXPORT</code>, <code>IMPORT_ONLY</code>, or <code>EXPORT_ONLY</code>.
- */
- public RemoteImportExportDescriptionFilesViewerFilter(int mode) {
- Assert.isLegal((mode == IMPORT_EXPORT) || (mode == IMPORT_ONLY) || (mode == EXPORT_ONLY));
- this.mode = mode;
- }
-
- /**
- * Allows containers and import/export description files.
- * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (element instanceof IResource) {
- IResource resource = (IResource) element;
- if (resource.getType() == IResource.FILE) {
- String extension = resource.getFileExtension();
- if (extension == null || extension.equals("")) { //$NON-NLS-1$
- return false;
- }
- switch (mode) {
- case IMPORT_EXPORT:
- return (contains(IRemoteImportExportConstants.REMOTE_IMPORT_DESCRIPTION_FILE_EXTENSIONS, extension) || contains(
- IRemoteImportExportConstants.REMOTE_EXPORT_DESCRIPTION_FILE_EXTENSIONS, extension));
- case IMPORT_ONLY:
- return contains(IRemoteImportExportConstants.REMOTE_IMPORT_DESCRIPTION_FILE_EXTENSIONS, extension);
- case EXPORT_ONLY:
- return contains(IRemoteImportExportConstants.REMOTE_EXPORT_DESCRIPTION_FILE_EXTENSIONS, extension);
- // should never be here
- default:
- return false;
- }
- } else {
- return true;
- }
- } else {
- return false;
- }
- }
-
- /**
- * Returns whether an extension exists in an array of extensions.
- * @param extensions an array to extensions.
- * @param extension the extension.
- * @return <code>true</code> if the extension exists in the array of extensions, <code>false</code> otherwise.
- */
- private boolean contains(String[] extensions, String extension) {
- for (int i = 0; i < extensions.length; i++) {
- if (extensions[i].equals(extension)) {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportPlugin.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportPlugin.java
deleted file mode 100644
index ac50f52f7..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportPlugin.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
- * Takuya Miyamoto - [185925] Integrate Platform/Team Synchronization
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport;
-
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class RemoteImportExportPlugin extends SystemBasePlugin {
-
- public static final String PLUGIN_ID ="org.eclipse.rse.importexport"; //$NON-NLS-1$
- public static final String HELPPREFIX = "org.eclipse.rse.importexport."; //$NON-NLS-1$
-
- // Icons
- public static final String PREFIX = PLUGIN_ID + "."; //$NON-NLS-1$
- public static final String ICON_BANNER_SUFFIX = "BannerIcon"; //$NON-NLS-1$
- public static final String ICON_EXT = ".gif"; //$NON-NLS-1$
-
- // WIZARD ICONS...
- public static final String ICON_WIZARD_DIR = "full/wizban/"; //$NON-NLS-1$
- public static final String ICON_EXPORTWIZARD_ROOT = "export_wiz"; //$NON-NLS-1$
- public static final String ICON_EXPORTWIZARD = ICON_WIZARD_DIR + ICON_EXPORTWIZARD_ROOT + ICON_EXT;
- public static final String ICON_EXPORTWIZARD_ID = PREFIX + ICON_EXPORTWIZARD_ROOT + ICON_BANNER_SUFFIX;
- public static final String ICON_IMPORTWIZARD_ROOT = "import_wiz"; //$NON-NLS-1$
- public static final String ICON_IMPORTWIZARD = ICON_WIZARD_DIR + ICON_IMPORTWIZARD_ROOT + ICON_EXT;
- public static final String ICON_IMPORTWIZARD_ID = PREFIX + ICON_IMPORTWIZARD_ROOT + ICON_BANNER_SUFFIX;
-
- //The shared instance.
- private static RemoteImportExportPlugin plugin;
-
- /**
- * The constructor.
- */
- public RemoteImportExportPlugin() {
- super();
- plugin = this;
- }
-
- /**
- * This method is called upon plug-in activation
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- }
-
- /**
- * This method is called when the plug-in is stopped
- */
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- plugin = null;
- }
-
- /**
- * Returns the shared instance.
- */
- public static RemoteImportExportPlugin getDefault() {
- return plugin;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.rse.core.SystemBasePlugin#initializeImageRegistry()
- */
- protected void initializeImageRegistry()
- {
- //SystemElapsedTimer timer = new SystemElapsedTimer();
- //timer.setStartTime();
-
- String path = getIconPath();
- // Wizards...
- putImageInRegistry(ICON_EXPORTWIZARD_ID, path+ICON_EXPORTWIZARD);
- putImageInRegistry(ICON_IMPORTWIZARD_ID, path+ICON_IMPORTWIZARD);
-
- //timer.setEndTime();
- //System.out.println("Time to load images: "+timer);
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportProblemDialog.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportProblemDialog.java
deleted file mode 100644
index 86253852e..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportProblemDialog.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Overrides <code>ErrorDialog</code> to provide a dialog with
- * the image that corresponds to the <code>IStatus</code>.
- *
- * This behavior should be implemented in the ErrorDialog itself,
- * see: 1GJU7TK: ITPUI:WINNT - DCR: ErrorDialog should not always show the error icon
- * The class can be removed when the above PR is fixed
- *
- * @see org.eclipse.core.runtime.IStatus
- */
-public class RemoteImportExportProblemDialog extends ErrorDialog {
- private Image fImage;
-
- /**
- * Creates a problem dialog.
- *
- * @param parent the shell under which to create this dialog
- * @param title the title to use for this dialog,
- * or <code>null</code> to indicate that the default title should be used
- * @param message the message to show in this dialog,
- * or <code>null</code> to indicate that the error's message should be shown
- * as the primary message
- * @param image the image to be used
- * @param status the error to show to the user
- * @param displayMask the mask to use to filter the displaying of child items,
- * as per <code>IStatus.matches</code>
- * @see org.eclipse.core.runtime.IStatus#matches
- */
- protected RemoteImportExportProblemDialog(Shell parent, String title, String message, Image image, IStatus status, int displayMask) {
- super(parent, title, message, status, displayMask);
- fImage = image;
- }
-
- /*
- * Overrides method declared on Dialog.
- */
- protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
- if (fImage == null) {
- return composite;
- }
- // find the label that contains the image
- Control[] kids = composite.getChildren();
- int childCount = kids.length;
- Label label = null;
- int i = 0;
- while (i < childCount) {
- if (kids[i] instanceof Label) {
- label = (Label) kids[i];
- if (label.getImage() != null) {
- break;
- }
- }
- i++;
- }
- if (i < childCount && label != null) {
- label.setImage(fImage);
- }
- applyDialogFont(composite);
- return composite;
- }
-
- /**
- * Opens a warning dialog to display the given warning. Use this method if the
- * warning object being displayed does not contain child items, or if you
- * wish to display all such items without filtering.
- *
- * @param parent the parent shell of the dialog, or <code>null</code> if none
- * @param title the title to use for this dialog,
- * or <code>null</code> to indicate that the default title should be used
- * @param message the message to show in this dialog,
- * or <code>null</code> to indicate that the error's message should be shown
- * as the primary message
- * @param status the error to show to the user
- * @return the code of the button that was pressed that resulted in this dialog
- * closing. This will be <code>Dialog.OK</code> if the OK button was
- * pressed, or <code>Dialog.CANCEL</code> if this dialog's close window
- * decoration or the ESC key was used.
- */
- public static int open(Shell parent, String title, String message, IStatus status) {
- return open(parent, title, message, status, IStatus.OK | IStatus.INFO | IStatus.WARNING | IStatus.ERROR);
- }
-
- /**
- * Opens a dialog to display either an error or warning dialog. Use this method if the
- * status being displayed contains child items <it>and</it> you wish to
- * specify a mask which will be used to filter the displaying of these
- * children. The error dialog will only be displayed if there is at
- * least one child status matching the mask.
- *
- * @param parent the parent shell of the dialog, or <code>null</code> if none
- * @param title the title to use for this dialog,
- * or <code>null</code> to indicate that the default title should be used
- * @param message the message to show in this dialog,
- * or <code>null</code> to indicate that the error's message should be shown
- * as the primary message
- * @param status the error to show to the user
- * @param displayMask the mask to use to filter the displaying of child items,
- * as per <code>IStatus.matches</code>
- * @return the code of the button that was pressed that resulted in this dialog
- * closing. This will be <code>Dialog.OK</code> if the OK button was
- * pressed, or <code>Dialog.CANCEL</code> if this dialog's close window
- * decoration or the ESC key was used.
- * @see org.eclipse.core.runtime.IStatus#matches
- */
- public static int open(Shell parent, String title, String message, IStatus status, int displayMask) {
- Image image;
- Display display = parent.getDisplay();
- if (status == null || status.matches(IStatus.ERROR)) {
- image = display.getSystemImage(SWT.ICON_ERROR);
- } else if (status.matches(IStatus.WARNING)) {
- image = display.getSystemImage(SWT.ICON_WARNING);
- } else {
- image = display.getSystemImage(SWT.ICON_INFORMATION);
- }
- ErrorDialog dialog = new RemoteImportExportProblemDialog(parent, title, message, image, status, displayMask);
- return dialog.open();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportResources.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportResources.java
deleted file mode 100644
index 80b26ad3d..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportResources.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
- * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
- * David McKnight (IBM) - [223204] [cleanup] fix broken nls strings in files.ui and others
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport;
-
-import org.eclipse.osgi.util.NLS;
-
-public class RemoteImportExportResources extends NLS {
- private static String BUNDLE_NAME = "org.eclipse.rse.internal.importexport.RemoteImportExportResources"; //$NON-NLS-1$
- public static String IMPORT_EXPORT_DESCRIPTION_FILE_DIALOG_TITLE;
- public static String IMPORT_EXPORT_DESCRIPTION_FILE_DIALOG_MESSAGE;
- public static String IMPORT_EXPORT_ERROR_DESCRIPTION_ABSOLUTE;
- public static String IMPORT_EXPORT_ERROR_DESCRIPTION_EXISTING_CONTAINER;
- public static String IMPORT_EXPORT_ERROR_DESCRIPTION_NO_CONTAINER;
- public static String IMPORT_EXPORT_ERROR_DESCRIPTION_INVALID_EXTENSION;
- public static String IMPORT_EXPORT_ERROR_CREATE_FILES_FAILED;
- public static String IMPORT_EXPORT_ERROR_CREATE_FILE_FAILED;
- public static String IMPORT_EXPORT_EXPORT_ACTION_DELEGATE_TITLE;
- public static String IMPORT_EXPORT_IMPORT_ACTION_DELEGATE_TITLE;
- public static String IMPORT_EXPORT_ERROR_DESCRIPTION_READ;
- public static String IMPORT_EXPORT_ERROR_DESCRIPTION_CLOSE;
- public static String WizardDataTransfer_existsQuestion;
- public static String WizardDataTransfer_overwriteNameAndPathQuestion;
- public static String Question;
-
-
- public static String FILEMSG_COPY_ROOT;
-
- public static String FILEMSG_IMPORT_ERROR;
- public static String FILEMSG_IMPORT_PROBLEMS;
- public static String FILEMSG_IMPORT_SELF;
- public static String FILEMSG_EXPORT_ERROR;
- public static String FILEMSG_EXPORT_PROBLEMS;
- public static String FILEMSG_NOT_WRITABLE;
-
- public static String FILEMSG_TARGET_EXISTS;
- public static String FILEMSG_TARGET_EXISTS_DETAILS;
- public static String FILEMSG_FOLDER_IS_FILE;
- public static String FILEMSG_FOLDER_IS_FILE_DETAILS;
- public static String FILEMSG_DESTINATION_CONFLICTING;
- public static String FILEMSG_DESTINATION_CONFLICTING_DETAILS;
- public static String FILEMSG_SOURCE_IS_FILE;
- public static String FILEMSG_SOURCE_IS_FILE_DETAILS;
- public static String FILEMSG_SOURCE_EMPTY;
- public static String FILEMSG_SOURCE_EMPTY_DETAILS;
- public static String FILEMSG_EXPORT_FAILED;
- public static String FILEMSG_EXPORT_NONE_SELECTED;
- public static String FILEMSG_EXPORT_NONE_SELECTED_DETAILS;
- public static String FILEMSG_DESTINATION_EMPTY;
- public static String FILEMSG_DESTINATION_EMPTY_DETAILS;
- public static String FILEMSG_IMPORT_FAILED;
- public static String FILEMSG_IMPORT_NONE_SELECTED;
- public static String FILEMSG_IMPORT_NONE_SELECTED_DETAILS;
- public static String FILEMSG_IMPORT_FILTERING;
-
- public static String FILEMSG_CREATE_FOLDER_FAILED;
- public static String FILEMSG_CREATE_FOLDER_FAILED_DETAILS;
-
- // file import/export messages
- public static String MSG_IMPORT_EXPORT_UNABLE_TO_USE_CONNECTION;
- public static String MSG_IMPORT_EXPORT_UNEXPECTED_EXCEPTION;
- public static String MSG_IMPORT_EXPORT_UNABLE_TO_USE_CONNECTION_DETAILS;
- public static String MSG_IMPORT_EXPORT_UNEXPECTED_EXCEPTION_DETAILS;
-
-
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, RemoteImportExportResources.class);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportResources.properties b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportResources.properties
deleted file mode 100644
index dc7760bd8..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportResources.properties
+++ /dev/null
@@ -1,89 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2008 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
-# David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
-###############################################################################
-
-# NLS_MESSAGEFORMAT_VAR
-# NLS_ENCODING=UTF-8
-
-# Description file messages
-IMPORT_EXPORT_DESCRIPTION_FILE_DIALOG_TITLE = Save As
-IMPORT_EXPORT_DESCRIPTION_FILE_DIALOG_MESSAGE = Select location and name for the description
-IMPORT_EXPORT_ERROR_DESCRIPTION_ABSOLUTE = Description file path must be absolute (i.e. begins with /)
-IMPORT_EXPORT_ERROR_DESCRIPTION_EXISTING_CONTAINER = The description file location must not be an existing container
-IMPORT_EXPORT_ERROR_DESCRIPTION_NO_CONTAINER = Container for description file does not exist
-IMPORT_EXPORT_ERROR_DESCRIPTION_INVALID_EXTENSION = Description file extension must be ''.{0}''
-
-# Creation failure messages
-IMPORT_EXPORT_ERROR_CREATE_FILES_FAILED = Creation of some files failed. See details for additional information.
-IMPORT_EXPORT_ERROR_CREATE_FILE_FAILED = File creation failed. See details for additional information.
-
-# Description file error messages
-IMPORT_EXPORT_ERROR_DESCRIPTION_READ = Error reading {0}: {1}
-IMPORT_EXPORT_ERROR_DESCRIPTION_CLOSE = Error closing description reader for {0}
-
-# Action delegate
-IMPORT_EXPORT_EXPORT_ACTION_DELEGATE_TITLE = Remote File Export
-IMPORT_EXPORT_IMPORT_ACTION_DELEGATE_TITLE = Remote File Import
-
-#Generic messages
-WizardDataTransfer_existsQuestion = ''{0}'' already exists. Would you like to overwrite it?
-WizardDataTransfer_overwriteNameAndPathQuestion = Overwrite ''{0}'' in folder ''{1}''?
-Question = Question
-
-
-FILEMSG_COPY_ROOT = Can not copy root file system
-
-FILEMSG_IMPORT_ERROR = Unable to import {0}: {1}
-FILEMSG_IMPORT_PROBLEMS = Problems were encountered during import
-
-FILEMSG_IMPORT_SELF = Unable to import {0}
-FILEMSG_EXPORT_ERROR = Error occurred while exporting {0}: {1}
-FILEMSG_EXPORT_PROBLEMS = Problems were encountered during export
-FILEMSG_NOT_WRITABLE = Cannot overwrite file {0}
-
-FILEMSG_TARGET_EXISTS = Target folder does not exist. Would you like to create it?
-FILEMSG_TARGET_EXISTS_DETAILS =Press Yes to create the folder {0}, No to cancel
-
-FILEMSG_FOLDER_IS_FILE =Target folder already exists, as a file
-FILEMSG_FOLDER_IS_FILE_DETAILS=The remote resource {0} already exists, but as a file, not a folder
-
-FILEMSG_DESTINATION_CONFLICTING = Destination folder conflicts with location of {0}
-FILEMSG_DESTINATION_CONFLICTING_DETAILS =You are attempting to export to the local file system, to a location that overlaps the resources being exported.
-
-FILEMSG_SOURCE_IS_FILE = Source is a file, not a folder
-FILEMSG_SOURCE_IS_FILE_DETAILS=The remote resource {0} is a file, but a folder is required<
-
-FILEMSG_SOURCE_EMPTY = Enter or select a source folder
-FILEMSG_SOURCE_EMPTY_DETAILS =You have left the source folder empty, but it must be set to continue.
-
-FILEMSG_EXPORT_FAILED =Export problems
-FILEMSG_EXPORT_NONE_SELECTED = There are no resources currently selected for export
-FILEMSG_EXPORT_NONE_SELECTED_DETAILS =Select resources to be exported and try again
-
-FILEMSG_DESTINATION_EMPTY = Please enter a destination folder
-FILEMSG_DESTINATION_EMPTY_DETAILS = The destination folder is empty. You must select a destination folder.
-
-FILEMSG_IMPORT_FAILED = Import problems
-FILEMSG_IMPORT_NONE_SELECTED = There are no resources currently selected for import
-FILEMSG_IMPORT_NONE_SELECTED_DETAILS = Select resources to be imported and try again
-
-FILEMSG_IMPORT_FILTERING = Filtering selection...;
-
-FILEMSG_CREATE_FOLDER_FAILED = Creation of the folder failed
-FILEMSG_CREATE_FOLDER_FAILED_DETAILS = The folder {0} could not be created because of one of the following reasons:\n- the user does not have enough authority to create the folder\n- the folder name is not valid
-
-
-MSG_IMPORT_EXPORT_UNABLE_TO_USE_CONNECTION = Unable to use connection.
-MSG_IMPORT_EXPORT_UNABLE_TO_USE_CONNECTION_DETAILS = Please correct, or select alternate connection.
-
-MSG_IMPORT_EXPORT_UNEXPECTED_EXCEPTION =Unexpected exception received: {0}.
-MSG_IMPORT_EXPORT_UNEXPECTED_EXCEPTION_DETAILS =Please see error log for details.
-
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportRunnable.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportRunnable.java
deleted file mode 100644
index cdf5a8460..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportRunnable.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport;
-
-import org.eclipse.core.resources.IFile;
-
-/**
- * A runnable class that exports from an export description file. Use this class
- * to export in a non-UI thread, by using Display.syncExec() or Display.asyncExec().
- */
-public class RemoteImportExportRunnable implements Runnable {
- // description file
- private IFile file;
- private boolean export;
-
- /**
- * Constrcutor.
- * @param descriptionFile the description file.
- * @param export <code>true</code> to export, otherwise <code>false</code>.
- */
- public RemoteImportExportRunnable(IFile descriptionFile, boolean export) {
- this.file = descriptionFile;
- this.export = export;
- }
-
- /**
- * @see java.lang.Runnable#run()
- */
- public void run() {
- if (export) {
- RemoteImportExportUtil.getInstance().exportFromDescriptionFile(file);
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportUtil.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportUtil.java
deleted file mode 100644
index c0f0fa0ea..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/RemoteImportExportUtil.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.rse.internal.importexport.files.RemoteFileExportActionDelegate;
-import org.eclipse.rse.ui.SystemBasePlugin;
-
-/**
- * Utility class for import and export. A singleton class.
- */
-public class RemoteImportExportUtil {
- private static RemoteImportExportUtil instance;
-
- /**
- * Dummy action. Does nothing.
- */
- private class DummyAction extends Action {
- /**
- * Constructor.
- */
- public DummyAction() {
- super();
- }
- }
-
- private RemoteImportExportUtil() {
- }
-
- public static RemoteImportExportUtil getInstance() {
- if (instance == null) {
- instance = new RemoteImportExportUtil();
- }
- return instance;
- }
-
- /**
- * Does an export from a description file. The given description file must exist.
- * @param descriptionFile the export description file.
- */
- public void exportFromDescriptionFile(IFile descriptionFile) {
- Assert.isLegal((descriptionFile != null) && descriptionFile.exists());
- IFile file = descriptionFile;
- String extension = file.getFileExtension();
- if (extension == null || extension.equals("")) { //$NON-NLS-1$
- return;
- }
- if (extension.equals(IRemoteImportExportConstants.REMOTE_FILE_EXPORT_DESCRIPTION_FILE_EXTENSION)) {
- RemoteFileExportActionDelegate action = new RemoteFileExportActionDelegate();
- DummyAction dummy = new DummyAction();
- action.selectionChanged(dummy, new StructuredSelection(file));
- action.run(dummy);
- } else if (extension.equals(IRemoteImportExportConstants.REMOTE_JAR_EXPORT_DESCRIPTION_FILE_EXTENSION)) {
- // TODO
- // CreateRemoteJarActionDelegate action = new CreateRemoteJarActionDelegate();
- // DummyAction dummy = new DummyAction();
- // action.selectionChanged(dummy, new StructuredSelection(file));
- // action.run(dummy);
- }
- }
-
- /**
- * Helper method for case insensitive file systems. Returns
- * an existing resource whose path differs only in case from
- * the given path, or null if no such resource exists.
- */
- public IResource findExistingResourceVariant(IPath target) {
- IWorkspace workspace = SystemBasePlugin.getWorkspace();
- // check if local file system is case sensitive
- boolean isCaseInsensitive = Platform.getOS().equals(Platform.OS_WIN32);
- // if so, we don't need to go any further
- if (!isCaseInsensitive) {
- return null;
- }
- IWorkspaceRoot root = workspace.getRoot();
- IPath result = root.getFullPath();
- IContainer container = root;
- int segmentCount = target.segmentCount();
- for (int i = 0; i < segmentCount; i++) {
- IResource[] children = null;
- if (i != 0) {
- IResource resource = root.findMember(result);
- if ((resource != null) && (resource instanceof IContainer)) {
- container = (IContainer) resource;
- } else {
- return null;
- }
- }
- try {
- children = container.members();
- } catch (CoreException e) {
- SystemBasePlugin.logError("Exception occured trying to get children of " + result, e); //$NON-NLS-1$
- }
- String name = findVariant(target.segment(i), children);
- if (name == null) {
- return null;
- }
- result = result.append(name);
- }
- return root.findMember(result);
- }
-
- /**
- * Searches for a variant of the given target in the list,
- * that differs only in case. Returns the variant from
- * the list if one is found, otherwise returns null.
- * @param target the name.
- * @param list the list of resources that may have the variant
- */
- private String findVariant(String target, IResource[] list) {
- if (list == null) {
- return null;
- }
- // go through list
- for (int i = 0; i < list.length; i++) {
- String name = list[i].getName();
- // see if there is a variant, and if so, return it
- if (target.equalsIgnoreCase(name)) {
- return name;
- }
- }
- return null;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/SystemImportExportResources.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/SystemImportExportResources.java
deleted file mode 100644
index b5216f8c6..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/SystemImportExportResources.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David McKnight (IBM) - [223204] [cleanup] fix broken nls strings in files.ui and others
- * Martin Oberhuber (Wind River) - [185925] Support Platform/Team Synchronization
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport;
-
-import org.eclipse.osgi.util.NLS;
-
-public class SystemImportExportResources extends NLS {
- private static String BUNDLE_NAME = "org.eclipse.rse.internal.importexport.SystemImportExportResources";//$NON-NLS-1$
-
- // REMOTE FILE EXPORT WIZARD...
- public static String RESID_FILEEXPORT_TITLE;
- public static String RESID_FILEEXPORT_PAGE1_TITLE;
- public static String RESID_FILEEXPORT_PAGE1_DESCRIPTION;
- public static String RESID_FILEEXPORT_DESTINATION_LABEL;
- public static String RESID_FILEEXPORT_DESTINATION_TOOLTIP;
- public static String RESID_FILEEXPORT_DESTINATION_BROWSE_LABEL;
- public static String RESID_FILEEXPORT_DESTINATION_BROWSE_TOOLTIP;
- public static String RESID_FILEEXPORT_REVIEW_LABEL;
- public static String RESID_FILEEXPORT_REVIEW_TOOLTIP;
- public static String RESID_FILEEXPORT_OPTION_OVERWRITE_LABEL;
- public static String RESID_FILEEXPORT_OPTION_OVERWRITE_TOOLTIP;
- public static String RESID_FILEEXPORT_OPTION_CREATEALL_LABEL;
- public static String RESID_FILEEXPORT_OPTION_CREATEALL_TOOLTIP;
- public static String RESID_FILEEXPORT_OPTION_CREATESEL_LABEL;
- public static String RESID_FILEEXPORT_OPTION_CREATESEL_TOOLTIP;
- public static String RESID_FILEEXPORT_OPTION_SETTINGS_LABEL;
- public static String RESID_FILEEXPORT_OPTION_SETTINGS_TOOLTIP;
- public static String RESID_FILEEXPORT_OPTION_SETTINGS_DESCFILE_LABEL;
- public static String RESID_FILEEXPORT_OPTION_SETTINGS_DESCFILE_PATH_TOOLTIP;
- public static String RESID_FILEEXPORT_OPTION_SETTINGS_DESCFILE_BROWSE_LABEL;
- public static String RESID_FILEEXPORT_OPTION_SETTINGS_DESCFILE_BROWSE_TOOLTIP;
-
- public static String RESID_FILEEXPORT_EXPORTING;
- // REMOTE FILE IMPORT WIZARD...
- public static String RESID_FILEIMPORT_TITLE;
- public static String RESID_FILEIMPORT_PAGE1_TITLE;
- public static String RESID_FILEIMPORT_PAGE1_DESCRIPTION;
- public static String RESID_FILEIMPORT_REVIEW_LABEL;
- public static String RESID_FILEIMPORT_REVIEW_TOOLTIP;
- public static String RESID_FILEIMPORT_OPTION_OVERWRITE_LABEL;
- public static String RESID_FILEIMPORT_OPTION_OVERWRITE_TOOLTIP;
- public static String RESID_FILEIMPORT_OPTION_CREATEALL_LABEL;
- public static String RESID_FILEIMPORT_OPTION_CREATEALL_TOOLTIP;
- public static String RESID_FILEIMPORT_OPTION_CREATESEL_LABEL;
- public static String RESID_FILEIMPORT_OPTION_CREATESEL_TOOLTIP;
- public static String RESID_FILEIMPORT_OPTION_SETTINGS_LABEL;
- public static String RESID_FILEIMPORT_OPTION_SETTINGS_TOOLTIP;
- public static String RESID_FILEIMPORT_OPTION_SETTINGS_DESCFILE_LABEL;
- public static String RESID_FILEIMPORT_OPTION_SETTINGS_DESCFILE_PATH_TOOLTIP;
- public static String RESID_FILEIMPORT_OPTION_SETTINGS_DESCFILE_BROWSE_LABEL;
- public static String RESID_FILEIMPORT_OPTION_SETTINGS_DESCFILE_BROWSE_TOOLTIP;
- public static String RESID_FILEIMPORT_SOURCE_LABEL;
- public static String RESID_FILEIMPORT_SOURCE_TOOLTIP;
-
- public static String RESID_FILEIMPORT_IMPORTING;
- public static String RESID_FILEIMPEXP_BUTTON_SELECTALL_LABEL;
- public static String RESID_FILEIMPEXP_BUTTON_SELECTALL_TOOLTIP;
- public static String RESID_FILEIMPEXP_BUTTON_DESELECTALL_LABEL;
- public static String RESID_FILEIMPEXP_BUTTON_DESELECTALL_TOOLTIP;
- public static String RESID_FILEIMPEXP_BUTTON_SELECTTYPES_LABEL;
- public static String RESID_FILEIMPEXP_BUTTON_SELECTTYPES_TOOLTIP;
-
- // synchronize actions
- public static String RESID_SYNCHRONIZE_ACTIONS_PUT_LABEL;
- public static String RESID_SYNCHRONIZE_ACTIONS_PUT_ALL_LABEL;
- public static String RESID_SYNCHRONIZE_ACTIONS_GET_LABEL;
- public static String RESID_SYNCHRONIZE_ACTIONS_GET_ALL_LABEL;
- public static String RESID_SYNCHRONIZE_ACTIONS_MERGE_LABEL;
- public static String RESID_SYNCHRONIZE_ACTIONS_MERGE_ALL_LABEL;
-
- public static String RESID_SYNCHRONIZE_DISCONNECT_WARNING;
-
- static {
- // load message values from bundle file
- NLS.initializeMessages(BUNDLE_NAME, SystemImportExportResources.class);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/SystemImportExportResources.properties b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/SystemImportExportResources.properties
deleted file mode 100644
index e7e98a2d3..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/SystemImportExportResources.properties
+++ /dev/null
@@ -1,104 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2009 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# David McKnight (IBM) - [223204] [cleanup] fix broken nls strings in files.ui and others
-# Martin Oberhuber (Wind River) - [185925] Support Platform/Team Synchronization
-###############################################################################
-
-# NLS_MESSAGEFORMAT_NONE
-# NLS_ENCODING=UTF-8
-
-#=============================================================
-# REMOTE FILE EXPORT WIZARD...
-#=============================================================
-RESID_FILEEXPORT_TITLE=Export
-RESID_FILEEXPORT_PAGE1_TITLE=Remote file system
-RESID_FILEEXPORT_PAGE1_DESCRIPTION=Export resources to a remote file system.
-RESID_FILEEXPORT_EXPORTING=Exporting:
-
-RESID_FILEEXPORT_DESTINATION_LABEL=Destination folder, qualified by its remote connection name
-RESID_FILEEXPORT_DESTINATION_TOOLTIP=Select the destination folder by browsing a remote system for it
-
-RESID_FILEEXPORT_DESTINATION_BROWSE_LABEL=Browse...
-RESID_FILEEXPORT_DESTINATION_BROWSE_TOOLTIP=Select the destination folder by browsing a remote system for it
-
-RESID_FILEEXPORT_REVIEW_LABEL=Review/Synchronize
-RESID_FILEEXPORT_REVIEW_TOOLTIP=Review/Synchronize
-
-RESID_FILEEXPORT_OPTION_OVERWRITE_LABEL=Overwrite existing files without warning
-RESID_FILEEXPORT_OPTION_OVERWRITE_TOOLTIP=If a file being exported already exists remotely, replace it without a message
-
-RESID_FILEEXPORT_OPTION_CREATEALL_LABEL=Create directory structure for files
-RESID_FILEEXPORT_OPTION_CREATEALL_TOOLTIP=Create hierarchy (folder) structure in the file system as it exists in the Workbench
-
-RESID_FILEEXPORT_OPTION_CREATESEL_LABEL=Create only selected directories
-RESID_FILEEXPORT_OPTION_CREATESEL_TOOLTIP=Create hierarchy (folder) structure in the file system only for selected folders
-
-RESID_FILEEXPORT_OPTION_SETTINGS_LABEL=Save the settings of this export in the workspace (e.g. /ExportSettings/hello.rexpfd)
-RESID_FILEEXPORT_OPTION_SETTINGS_TOOLTIP=Save the export settings to a description file for quicker export in the future
-
-RESID_FILEEXPORT_OPTION_SETTINGS_DESCFILE_LABEL=Description file:
-
-RESID_FILEEXPORT_OPTION_SETTINGS_DESCFILE_PATH_TOOLTIP=Enter the description file path
-
-RESID_FILEEXPORT_OPTION_SETTINGS_DESCFILE_BROWSE_LABEL=Browse...
-RESID_FILEEXPORT_OPTION_SETTINGS_DESCFILE_BROWSE_TOOLTIP=Specify the description file by browsing the workspace
-
-
-
-#=============================================================
-# REMOTE FILE IMPORT WIZARD...
-#=============================================================
-RESID_FILEIMPORT_TITLE=Import
-RESID_FILEIMPORT_PAGE1_TITLE=Remote file system
-RESID_FILEIMPORT_PAGE1_DESCRIPTION=Import resources from a remote file system.
-RESID_FILEIMPORT_OPTION_SETTINGS_DESCFILE_LABEL=Description file:
-RESID_FILEIMPORT_OPTION_SETTINGS_DESCFILE_PATH_TOOLTIP=Enter the description file path
-RESID_FILEIMPORT_IMPORTING=Importing:
-
-RESID_FILEIMPORT_REVIEW_LABEL=Review/Synchronize
-RESID_FILEIMPORT_REVIEW_TOOLTIP=Review/Synchronize
-
-RESID_FILEIMPORT_OPTION_OVERWRITE_LABEL=Overwrite existing resources without warning
-RESID_FILEIMPORT_OPTION_OVERWRITE_TOOLTIP=If a file being exported already exists remotely, replace it without a message
-
-RESID_FILEIMPORT_OPTION_CREATEALL_LABEL=Create complete folder structure
-RESID_FILEIMPORT_OPTION_CREATEALL_TOOLTIP=Create hierarchy (folder) structure in the Workbench, including parent folders
-
-RESID_FILEIMPORT_OPTION_CREATESEL_LABEL=Create selected folders only
-RESID_FILEIMPORT_OPTION_CREATESEL_TOOLTIP=Create hierarchy (folder) structure in the Workbench
-
-RESID_FILEIMPORT_OPTION_SETTINGS_LABEL=Save the settings of this import in the workspace (e.g. /ImportSettings/hello.rimpfd)
-RESID_FILEIMPORT_OPTION_SETTINGS_TOOLTIP=Save the import settings to a description file for quicker import in the future
-
-RESID_FILEIMPORT_OPTION_SETTINGS_DESCFILE_BROWSE_LABEL=Browse...
-RESID_FILEIMPORT_OPTION_SETTINGS_DESCFILE_BROWSE_TOOLTIP=Specify the description file by browsing the workspace
-
-RESID_FILEIMPORT_SOURCE_LABEL=From directory:
-RESID_FILEIMPORT_SOURCE_TOOLTIP=Source folder, qualified by its remote connection name
-
-RESID_FILEIMPEXP_BUTTON_SELECTALL_LABEL=Select All
-RESID_FILEIMPEXP_BUTTON_SELECTALL_TOOLTIP=Select all resources
-
-RESID_FILEIMPEXP_BUTTON_DESELECTALL_LABEL=Deselect All
-RESID_FILEIMPEXP_BUTTON_DESELECTALL_TOOLTIP=De-select all resources
-
-RESID_FILEIMPEXP_BUTTON_SELECTTYPES_LABEL=Select Types
-RESID_FILEIMPEXP_BUTTON_SELECTTYPES_TOOLTIP=Select resource types to subset the selection list by
-
-# synchronize operations
-RESID_SYNCHRONIZE_ACTIONS_PUT_LABEL=Put
-RESID_SYNCHRONIZE_ACTIONS_PUT_ALL_LABEL=Put All
-RESID_SYNCHRONIZE_ACTIONS_GET_LABEL=Get
-RESID_SYNCHRONIZE_ACTIONS_GET_ALL_LABEL=Get All
-RESID_SYNCHRONIZE_ACTIONS_MERGE_LABEL=Merge
-RESID_SYNCHRONIZE_ACTIONS_MERGE_ALL_LABEL=Merge All
-
-
-RESID_SYNCHRONIZE_DISCONNECT_WARNING=This operation will remove previous team provider settings that were set for project {0}. Are you sure you want to do this?
-
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/Debug.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/Debug.java
deleted file mode 100644
index 6f8af3f6d..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/Debug.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-public class Debug {
- //execution time switches
- public static boolean debug = false;
-
- public static void out(String s) {
- if (debug) System.out.println(s);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/FileSystemElement.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/FileSystemElement.java
deleted file mode 100644
index 716be831b..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/FileSystemElement.java
+++ /dev/null
@@ -1,233 +0,0 @@
-package org.eclipse.rse.internal.importexport.files;
-
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.model.AdaptableList;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.model.WorkbenchAdapter;
-
-// Similar to org.eclipse.ui.dialogs.FileSystemElement
-// Changes: added getName() method
-/**
- * Instances of this class represent files or file-like entities (eg.- zip
- * file entries) on the local file system. They do not represent resources
- * within the workbench. This distinction is made because the representation of
- * a file system resource is significantly different from that of a workbench
- * resource.
- *
- * If self represents a collection (eg.- file system directory, zip directory)
- * then its icon will be the folderIcon static field. Otherwise (ie.- self
- * represents a file system file) self's icon is stored in field "icon", and is
- * determined by the extension of the file that self represents.
- *
- * This class is adaptable, and implements one adapter itself, namely the
- * IWorkbenchAdapter adapter used for navigation and display in the workbench.
- */
-public class FileSystemElement implements IAdaptable {
- private String name;
- private Object fileSystemObject;
- /* Wait until a child is added to initialize the receiver's lists.
- * Doing so minimizes the amount of memory that is allocated when
- * a large directory structure is being processed.
- */
- private AdaptableList folders = null;
- private AdaptableList files = null;
- private boolean isDirectory = false;
- private FileSystemElement parent;
- private final static AdaptableList EMPTY_LIST = new AdaptableList(0);
- private WorkbenchAdapter workbenchAdapter = new WorkbenchAdapter() {
- /**
- * Answer the children property of this element
- */
- public Object[] getChildren(Object o) {
- return getFolders().getChildren(o);
- }
-
- /**
- * Returns the parent of this element
- */
- public Object getParent(Object o) {
- return parent;
- }
-
- /**
- * Returns an appropriate label for this file system element.
- */
- public String getLabel(Object o) {
- return name;
- }
-
- /**
- * Returns an image descriptor for this file system element
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- if (isDirectory()) {
- return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
- } else {
- return PlatformUI.getWorkbench().getEditorRegistry().getImageDescriptor(name);
- }
- }
- };
-
- /**
- * Creates a new <code>FileSystemElement</code> and initializes it
- * and its parent if applicable.
- *
- * @param name java.lang.String
- */
- public FileSystemElement(String name, FileSystemElement parent, boolean isDirectory) {
- this.name = name;
- this.parent = parent;
- this.isDirectory = isDirectory;
- if (parent != null) parent.addChild(this);
- }
-
- /**
- * Adds the passed child to this object's collection of children.
- *
- * @param child FileSystemElement
- */
- public void addChild(FileSystemElement child) {
- if (child.isDirectory()) {
- if (folders == null) folders = new AdaptableList(1);
- folders.add(child);
- } else {
- if (files == null) files = new AdaptableList(1);
- files.add(child);
- }
- }
-
- /**
- * Returns the adapter
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) {
- return workbenchAdapter;
- }
- //defer to the platform
- return Platform.getAdapterManager().getAdapter(this, adapter);
- }
-
- /**
- * Returns the extension of this element's filename. Returns
- * The empty string if there is no extension.
- */
- public String getFileNameExtension() {
- int lastDot = name.lastIndexOf('.');
- return lastDot < 0 ? "" : name.substring(lastDot + 1); //$NON-NLS-1$
- }
-
- /**
- * Answer the files property of this element. Answer an empty list if the
- * files property is null.
- * This method should not be used to add children
- * to the receiver. Use addChild(FileSystemElement) instead.
- */
- public AdaptableList getFiles() {
- if (files == null) return EMPTY_LIST;
- return files;
- }
-
- /**
- * Returns the file system object property of this element
- *
- * @return the file system object
- */
- public Object getFileSystemObject() {
- return fileSystemObject;
- }
-
- /**
- * Returns a list of the folders that are immediate children
- * of this folder. Answer an empty list if the folders property is null.
- * This method should not be used to add children
- * to the receiver. Use addChild(FileSystemElement) instead.
- */
- public AdaptableList getFolders() {
- if (folders == null) return EMPTY_LIST;
- return folders;
- }
-
- /**
- * Returns the name.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Return the parent of this element.
- *
- * @return the parent file system element, or <code>null</code> if this is the root
- */
- public FileSystemElement getParent() {
- return this.parent;
- }
-
- /**
- * Returns true if this element represents a directory, and false
- * otherwise.
- */
- public boolean isDirectory() {
- return isDirectory;
- }
-
- /**
- * Removes a sub-folder from this file system element.
- */
- public void removeFolder(FileSystemElement child) {
- if (folders == null) return;
- folders.remove(child);
- child.setParent(null);
- }
-
- /**
- * Set the file system object property of this element
- *
- * @param value the file system object
- */
- public void setFileSystemObject(Object value) {
- fileSystemObject = value;
- }
-
- /**
- * Sets the parent of this file system element.
- */
- public void setParent(FileSystemElement element) {
- parent = element;
- }
-
- /**
- * For debugging purposes only.
- */
- public String toString() {
- StringBuffer buf = new StringBuffer();
- if (isDirectory()) {
- buf.append("Folder(");//$NON-NLS-1$
- } else {
- buf.append("File(");//$NON-NLS-1$
- }
- buf.append(name).append(")");//$NON-NLS-1$
- if (!isDirectory()) {
- return buf.toString();
- }
- buf.append(" folders: ");//$NON-NLS-1$
- buf.append(folders);
- buf.append(" files: ");//$NON-NLS-1$
- buf.append(files);
- return buf.toString();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/FileSystemStructureProvider.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/FileSystemStructureProvider.java
deleted file mode 100644
index e9c1b14e7..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/FileSystemStructureProvider.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package org.eclipse.rse.internal.importexport.files;
-
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-
-// Similar to org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider
-// Changes marked with "IFS:" comments.
-/**
- * This class provides information regarding the structure and
- * content of specified file system File objects.
- */
-public class FileSystemStructureProvider implements IImportStructureProvider {
- /**
- * Holds a singleton instance of this class.
- */
- public final static FileSystemStructureProvider INSTANCE = new FileSystemStructureProvider();
-
- /**
- * Creates an instance of <code>FileSystemStructureProvider</code>.
- */
- public FileSystemStructureProvider() {
- super();
- }
-
- /* (non-Javadoc)
- * Method declared on IImportStructureProvider
- */
- public List getChildren(Object element) {
- List result = new ArrayList(0);
- try {
- String[] children = ((File) element).list();
- int childrenLength = children == null ? 0 : children.length;
- result = new ArrayList(childrenLength);
- long start = System.currentTimeMillis();
- // String p=((UniFilePlus)element).getAbsolutePath()+"/"; //$NON-NLS-1$
- // IHost sysC=((UniFilePlus) element).remoteFile.getSystemConnection();
- IRemoteFile[] childIRemoteFiles = ((UniFilePlus) element).listIRemoteFiles();
- for (int i = 0; i < childrenLength; i++)
- result.add(new UniFilePlus(childIRemoteFiles[i]));
- Debug.out("Expanding [" + ((File) element).getPath() + "] took in (ms): " + (System.currentTimeMillis() - start)); //$NON-NLS-1$ //$NON-NLS-2$
- } catch (Exception e) {
- // Probably caused by IFS authority problem
- // ignore for now
- }
- return result;
- }
-
- /* (non-Javadoc)
- * Method declared on IImportStructureProvider
- */
- public InputStream getContents(Object element) {
- try {
- return new FileInputStream((File) element);
- } catch (FileNotFoundException e) {
- return null;
- }
- }
-
- /* (non-Javadoc)
- * Method declared on IImportStructureProvider
- */
- public String getFullPath(Object element) {
- return ((File) element).getPath();
- }
-
- /* (non-Javadoc)
- * Method declared on IImportStructureProvider
- */
- public String getLabel(Object element) {
- //Get the name - if it is empty then return the path as it is a file root
- File file = (File) element;
- String name = file.getName();
- if (name == null || name.length() == 0)
- return file.getPath();
- else
- return name;
- }
-
- /* (non-Javadoc)
- * Method declared on IImportStructureProvider
- */
- public boolean isFolder(Object element) {
- return ((File) element).isDirectory();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/IImportStructureProvider.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/IImportStructureProvider.java
deleted file mode 100644
index 0500efe61..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/IImportStructureProvider.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.eclipse.rse.internal.importexport.files;
-
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-import java.io.InputStream;
-import java.util.List;
-
-// Similar to org.eclipse.ui.wizards.datatransfer.IImportStructureProvider
-// Basically unchanged.
-/**
- * Interface which can provide structure and content information
- * for an element (for example, a file system element).
- * Used by the import wizards to abstract the commonalities
- * between importing from the file system and importing from an archive.
- */
-public interface IImportStructureProvider {
- /**
- * Returns a collection with the children of the specified structured element.
- */
- List getChildren(Object element);
-
- /**
- * Returns the contents of the specified structured element, or
- * <code>null</code> if there is a problem determining the element's
- * contents.
- *
- * @param element a structured element
- * @return the contents of the structured element, or <code>null</code>
- */
- InputStream getContents(Object element);
-
- /**
- * Returns the full path of the specified structured element.
- *
- * @param element a structured element
- * @return the display label of the structured element
- */
- String getFullPath(Object element);
-
- /**
- * Returns the display label of the specified structured element.
- *
- * @param element a structured element
- * @return the display label of the structured element
- */
- String getLabel(Object element);
-
- /**
- * Returns a boolean indicating whether the passed structured element represents
- * a container element (as opposed to a leaf element).
- *
- * @return boolean
- * @param element java.lang.Object
- */
- boolean isFolder(Object element);
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/IRemoteFileExportDescriptionReader.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/IRemoteFileExportDescriptionReader.java
deleted file mode 100644
index 64fbc638f..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/IRemoteFileExportDescriptionReader.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * An interface for remote file export description reader.
- */
-public interface IRemoteFileExportDescriptionReader {
- public void read(RemoteFileExportData exportData) throws CoreException;
-
- public void close() throws CoreException;
-
- public IStatus getStatus();
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/IRemoteFileExportDescriptionWriter.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/IRemoteFileExportDescriptionWriter.java
deleted file mode 100644
index 8b5f57f45..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/IRemoteFileExportDescriptionWriter.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * An interface for remote file export description writer.
- */
-public interface IRemoteFileExportDescriptionWriter {
- public void write(RemoteFileExportData exportData) throws CoreException;
-
- public void close() throws CoreException;
-
- public IStatus getStatus();
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/IRemoteFileImportDescriptionReader.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/IRemoteFileImportDescriptionReader.java
deleted file mode 100644
index b377f3c6f..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/IRemoteFileImportDescriptionReader.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * An interface for remote file import description reader.
- */
-public interface IRemoteFileImportDescriptionReader {
- public void read(RemoteFileImportData importData) throws CoreException;
-
- public void close() throws CoreException;
-
- public IStatus getStatus();
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/IRemoteFileImportDescriptionWriter.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/IRemoteFileImportDescriptionWriter.java
deleted file mode 100644
index f6faac314..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/IRemoteFileImportDescriptionWriter.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * An interface for remote file import description writer.
- */
-public interface IRemoteFileImportDescriptionWriter {
- public void write(RemoteFileImportData importData) throws CoreException;
-
- public void close() throws CoreException;
-
- public IStatus getStatus();
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/MinimizedFileSystemElement.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/MinimizedFileSystemElement.java
deleted file mode 100644
index 54b438993..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/MinimizedFileSystemElement.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.eclipse.rse.internal.importexport.files;
-
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * David McKnight (IBM) - [219792] use background query when doing import
- * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
- *******************************************************************************/
-import org.eclipse.ui.model.AdaptableList;
-
-// Similar to org.eclipse.ui.wizards.datatransfer.MinimizedFileSystemElement
-// Changes marked with "IFS:" comments.
-/**
- * The <code>MinimizedFileSystemElement</code> is a <code>FileSystemElement</code> that knows
- * if it has been populated or not.
- */
-// IFS: made class public
-public class MinimizedFileSystemElement extends FileSystemElement {
- private boolean populated = false;
-
- /**
- * Create a <code>MinimizedFileSystemElement</code> with the supplied name and parent.
- * @param name the name of the file element this represents
- * @param parent the containing parent
- * @param isDirectory indicated if this could have children or not
- */
- public MinimizedFileSystemElement(String name, FileSystemElement parent, boolean isDirectory) {
- super(name, parent, isDirectory);
- }
-
- /**
- * Returns a list of the files that are immediate children. Use the supplied provider
- * if it needs to be populated.
- * of this folder.
- */
- public AdaptableList getFiles(IImportStructureProvider provider) {
- return super.getFiles();
- }
-
- /**
- * Returns a list of the folders that are immediate children. Use the supplied provider
- * if it needs to be populated.
- * of this folder.
- */
- public AdaptableList getFolders(IImportStructureProvider provider) {
- return super.getFolders();
- }
-
- public void setPopulated(boolean populated) {
- this.populated = populated;
- }
-
- public boolean isPopulated() {
- return populated;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteExportWizard.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteExportWizard.java
deleted file mode 100644
index 239a5cd08..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteExportWizard.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.rse.internal.importexport.RemoteImportExportPlugin;
-import org.eclipse.rse.internal.importexport.SystemImportExportResources;
-import org.eclipse.rse.ui.wizards.AbstractSystemWizard;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IExportWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * Standard workbench wizard for exporting resources from the workspace to the
- * local file system.
- * <p>
- * This class may be instantiated and used without further configuration.
- * </p>
- * <p>
- * Example:
- *
- * <pre>
- * IWizard wizard = new RemoteExportWizard();
- * wizard.init(workbench, selection);
- * WizardDialog dialog = new WizardDialog(shell, wizard);
- * dialog.open();
- * </pre>
- *
- * During the call to <code>open</code>, the wizard dialog is presented to
- * the user. When the user hits Finish, the user-selected workspace resources
- * are exported to the user-specified location in the local file system, the
- * dialog closes, and the call to <code>open</code> returns.
- * </p>
- *
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class RemoteExportWizard extends AbstractSystemWizard implements IExportWizard {
- private IStructuredSelection selection;
- private RemoteExportWizardPage1 mainPage;
- private RemoteFileExportData exportData;
- private boolean initializeFromExportData;
-
- /**
- * Creates a wizard for exporting workspace resources to the local file system.
- */
- public RemoteExportWizard() {
- IDialogSettings workbenchSettings = RemoteImportExportPlugin.getDefault().getDialogSettings();
- IDialogSettings section = workbenchSettings.getSection("RemoteExportWizard"); //$NON-NLS-1$
- if (section == null) section = workbenchSettings.addNewSection("RemoteExportWizard"); //$NON-NLS-1$
- setDialogSettings(section);
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public void addPages() {
- mainPage = new RemoteExportWizardPage1(selection);
- addPage(mainPage);
- }
-
- /**
- * Returns the image descriptor with the given key.
- */
- private ImageDescriptor getImageDescriptor(String key) {
- return RemoteImportExportPlugin.getDefault().getImageDescriptor(key);
- }
-
- /* (non-Javadoc)
- * Method declared on IWorkbenchWizard.
- */
- public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
- // make it the current selection by default but look it up otherwise
- this.selection = currentSelection;
- if (currentSelection.isEmpty() && workbench.getActiveWorkbenchWindow() != null) {
- IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
- if (page != null) {
- IEditorPart currentEditor = page.getActiveEditor();
- if (currentEditor != null) {
- Object selectedResource = currentEditor.getEditorInput().getAdapter(IResource.class);
- if (selectedResource != null) selection = new StructuredSelection(selectedResource);
- }
- }
- }
- setInitializeFromExportData(false);
- setWindowTitle(SystemImportExportResources.RESID_FILEEXPORT_TITLE);
- setDefaultPageImageDescriptor(getImageDescriptor(RemoteImportExportPlugin.ICON_EXPORTWIZARD_ID));
- setNeedsProgressMonitor(true);
- }
-
- public void init(IWorkbench workbench, RemoteFileExportData exportData) {
- this.selection = new StructuredSelection(exportData.getElements().toArray());
- this.exportData = exportData;
- setInitializeFromExportData(true);
- setWindowTitle(SystemImportExportResources.RESID_FILEEXPORT_TITLE);
- setDefaultPageImageDescriptor(getImageDescriptor(RemoteImportExportPlugin.ICON_EXPORTWIZARD_ID));
- setNeedsProgressMonitor(true);
- }
-
- protected void setInitializeFromExportData(boolean init) {
- this.initializeFromExportData = init;
- }
-
- public boolean getInitializeFromExportData() {
- return initializeFromExportData;
- }
-
- public RemoteFileExportData getExportData() {
- return exportData;
- }
-
- /**
- * Method declared on IWizard.
- */
- public boolean performFinish() {
- return mainPage.finish();
- }
-}
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
deleted file mode 100644
index 4f089452a..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteExportWizardPage1.java
+++ /dev/null
@@ -1,989 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
- * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
- * David McKnight (IBM) - [216252] MessageFormat.format -> NLS.bind
- * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
- * Takuya Miyamoto - [185925] Integrate Platform/Team Synchronization
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- * David McKnight (IBM) - [341630] [import/export] destination prompt not cleared after destination chosen
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.files.ui.actions.SystemSelectRemoteFolderAction;
-import org.eclipse.rse.internal.importexport.IRemoteImportExportConstants;
-import org.eclipse.rse.internal.importexport.RemoteImportExportPlugin;
-import org.eclipse.rse.internal.importexport.RemoteImportExportResources;
-import org.eclipse.rse.internal.importexport.RemoteImportExportUtil;
-import org.eclipse.rse.internal.importexport.SystemImportExportResources;
-import org.eclipse.rse.internal.synchronize.RSESyncUtils;
-import org.eclipse.rse.internal.synchronize.SynchronizeData;
-import org.eclipse.rse.internal.synchronize.provisional.ISynchronizeOperation;
-import org.eclipse.rse.internal.synchronize.provisional.SynchronizeOperation;
-import org.eclipse.rse.internal.synchronize.provisional.Synchronizer;
-import org.eclipse.rse.services.clientserver.messages.CommonMessages;
-import org.eclipse.rse.services.clientserver.messages.ICommonMessageIds;
-import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.messages.SystemMessageLine;
-import org.eclipse.rse.ui.wizards.ISystemWizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.dialogs.SaveAsDialog;
-import org.eclipse.ui.dialogs.WizardExportResourcesPage;
-
-/**
- * Page 1 of the base resource export-to-file-system Wizard
- *
- * 040510 AR Fix "Create folder" question. Previous fix changed the way we were
- * asking user if they wanted target folder created, to use RSE
- * widgets. But introduced error.
- */
-class RemoteExportWizardPage1 extends WizardExportResourcesPage implements Listener, ISystemWizardPage {
- private Object destinationFolder = null;
- private String helpId;
- private Composite parentComposite;
- private SystemMessageLine msgLine;
- private SystemMessage pendingMessage, pendingErrorMessage;
- // widgets
- private Combo destinationNameField;
- private Button destinationBrowseButton;
- protected Button reviewSynchronizeCheckbox;
- protected Button overwriteExistingFilesCheckbox;
- protected Button createDirectoryStructureButton;
- protected Button createSelectionOnlyButton;
- protected Button saveSettingsButton;
- protected Label descFilePathLabel;
- protected Text descFilePathField;
- protected Button descFileBrowseButton;
- // input object
- protected Object inputObject = null;
- // constants
- private static final int MY_SIZING_TEXT_FIELD_WIDTH = 250;
- // dialog store id constants
- private static final String STORE_DESTINATION_NAMES_ID = "RemoteExportWizard.STORE_DESTINATION_NAMES_ID"; //$NON-NLS-1$
- private static final String STORE_REVIEW_SYNCHRONIZE_ID = "RemoteExportWizard.STORE_REVIEW_SYNCHRONIZE_ID"; //$NON-NLS-1$
- private static final String STORE_OVERWRITE_EXISTING_FILES_ID = "RemoteExportWizard.STORE_OVERWRITE_EXISTING_FILES_ID"; //$NON-NLS-1$
- private static final String STORE_CREATE_STRUCTURE_ID = "RemoteExportWizard.STORE_CREATE_STRUCTURE_ID"; //$NON-NLS-1$
- private static final String STORE_CREATE_DESCRIPTION_FILE_ID = "RemoteExportWizard.STORE_CREATE_DESCRIPTION_FILE_ID"; //$NON-NLS-1$
- private static final String STORE_DESCRIPTION_FILE_NAME_ID = "RemoteExportWizard.STORE_DESCRIPTION_FILE_NAME_ID"; //$NON-NLS-1$
- //messages
- private static final SystemMessage DESTINATION_EMPTY_MESSAGE = new SimpleSystemMessage(RemoteImportExportPlugin.PLUGIN_ID,
- IRemoteImportExportConstants.FILEMSG_DESTINATION_EMPTY,
- IStatus.ERROR,
- RemoteImportExportResources.FILEMSG_DESTINATION_EMPTY,
- RemoteImportExportResources.FILEMSG_DESTINATION_EMPTY_DETAILS);
-
-
- /**
- * Create an instance of this class
- */
- protected RemoteExportWizardPage1(String name, IStructuredSelection selection) {
- super(name, selection);
- setInputObject(selection);
- }
-
- /**
- * Create an instance of this class
- */
- public RemoteExportWizardPage1(IStructuredSelection selection) {
- this("fileSystemExportPage1", selection); //$NON-NLS-1$
- setTitle(SystemImportExportResources.RESID_FILEEXPORT_PAGE1_TITLE);
- setDescription(SystemImportExportResources.RESID_FILEEXPORT_PAGE1_DESCRIPTION);
- }
-
- /**
- * Add the passed value to self's destination widget's history
- *
- * @param value java.lang.String
- */
- protected void addDestinationItem(String value) {
- destinationNameField.add(value);
- }
-
- /** (non-Javadoc)
- * Method declared on IDialogPage.
- */
- public void createControl(Composite parent) {
- parentComposite = new Composite(parent, SWT.NONE);
- parentComposite.setLayout(new GridLayout(1, false));
- parentComposite.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
- super.createControl(parentComposite);
- msgLine = new SystemMessageLine(parentComposite);
- msgLine.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
- if (pendingMessage != null) setMessage(pendingMessage);
- if (pendingErrorMessage != null) setErrorMessage(pendingErrorMessage);
- giveFocusToDestination();
- SystemWidgetHelpers.setWizardPageMnemonics(parentComposite);
- if (helpId != null) {
- SystemWidgetHelpers.setHelp(parentComposite, helpId);
- } else {
- SystemWidgetHelpers.setHelp(parentComposite, RemoteImportExportPlugin.HELPPREFIX + "import_context"); //$NON-NLS-1$
- }
- setControl(parentComposite);
- // super.createControl(parent);
- // parentComposite = parent;
- // giveFocusToDestination();
- // SystemWidgetHelpers.setHelp(getControl(), RemoteImportExportPlugin.HELPPREFIX + "export_context");
- // Control c = getControl();
- // if (c instanceof Composite)
- // {
- // SystemWidgetHelpers.setWizardPageMnemonics((Composite)c);
- // parentComposite = (Composite)c;
- // if (helpId != null)
- // SystemWidgetHelpers.setHelp(parentComposite, helpId);
- // }
- // else if (c instanceof Button)
- // {
- // Mnemonics ms = new Mnemonics();
- // ms.setMnemonic((Button)c);
- // }
- // configureMessageLine();
- }
-
- /**
- * Create the export destination specification widgets
- *
- * @param parent org.eclipse.swt.widgets.Composite
- */
- protected void createDestinationGroup(Composite parent) {
- // destination specification group
- Composite destinationSelectionGroup = SystemWidgetHelpers.createComposite(parent, 3);
- ((GridData) destinationSelectionGroup.getLayoutData()).verticalAlignment = GridData.FILL;
- destinationNameField = SystemWidgetHelpers.createLabeledReadonlyCombo(destinationSelectionGroup, null, SystemImportExportResources.RESID_FILEEXPORT_DESTINATION_LABEL,
- SystemImportExportResources.RESID_FILEEXPORT_DESTINATION_TOOLTIP);
- ((GridData) destinationNameField.getLayoutData()).widthHint = MY_SIZING_TEXT_FIELD_WIDTH;
- ((GridData) destinationNameField.getLayoutData()).grabExcessHorizontalSpace = true;
- destinationNameField.addListener(SWT.Modify, this);
- destinationNameField.addListener(SWT.Selection, this);
- // destination browse button
- destinationBrowseButton = SystemWidgetHelpers.createPushButton(destinationSelectionGroup, null, SystemImportExportResources.RESID_FILEEXPORT_DESTINATION_BROWSE_LABEL,
- SystemImportExportResources.RESID_FILEEXPORT_DESTINATION_BROWSE_TOOLTIP);
- ((GridData) destinationBrowseButton.getLayoutData()).grabExcessHorizontalSpace = false;
- destinationBrowseButton.addListener(SWT.Selection, this);
- new Label(parent, SWT.NONE); // vertical spacer
- }
-
- /**
- * Create the export options specification widgets.
- * @param optionsGroup the group into which the option buttons will be placed
- */
- protected void createOptionsGroupButtons(Group optionsGroup) {
- reviewSynchronizeCheckbox = SystemWidgetHelpers.createCheckBox(optionsGroup, 1, null, SystemImportExportResources.RESID_FILEEXPORT_REVIEW_LABEL,
- SystemImportExportResources.RESID_FILEEXPORT_REVIEW_TOOLTIP);
- reviewSynchronizeCheckbox.addListener(SWT.Selection, this);
- overwriteExistingFilesCheckbox = SystemWidgetHelpers.createCheckBox(optionsGroup, 1, null, SystemImportExportResources.RESID_FILEEXPORT_OPTION_OVERWRITE_LABEL,
- SystemImportExportResources.RESID_FILEEXPORT_OPTION_OVERWRITE_TOOLTIP);
- createDirectoryStructureButton = SystemWidgetHelpers.createRadioButton(optionsGroup, null, SystemImportExportResources.RESID_FILEEXPORT_OPTION_CREATEALL_LABEL,
- SystemImportExportResources.RESID_FILEEXPORT_OPTION_CREATEALL_TOOLTIP);
- createSelectionOnlyButton = SystemWidgetHelpers.createRadioButton(optionsGroup, null, SystemImportExportResources.RESID_FILEEXPORT_OPTION_CREATESEL_LABEL,
- SystemImportExportResources.RESID_FILEEXPORT_OPTION_CREATESEL_TOOLTIP);
- createSelectionOnlyButton.setSelection(true);
- Composite comp = SystemWidgetHelpers.createComposite(optionsGroup, 3);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- layout.marginWidth = 0;
- comp.setLayout(layout);
- comp.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
- saveSettingsButton = SystemWidgetHelpers.createCheckBox(comp, 3, null, SystemImportExportResources.RESID_FILEEXPORT_OPTION_SETTINGS_LABEL,
- SystemImportExportResources.RESID_FILEEXPORT_OPTION_SETTINGS_TOOLTIP);
- saveSettingsButton.addListener(SWT.Selection, this);
- descFilePathLabel = new Label(comp, SWT.NONE);
- descFilePathLabel.setText(SystemImportExportResources.RESID_FILEEXPORT_OPTION_SETTINGS_DESCFILE_LABEL);
- GridData data = new GridData();
- descFilePathLabel.setLayoutData(data);
- descFilePathField = new Text(comp, SWT.SINGLE | SWT.BORDER);
- descFilePathField.setToolTipText(SystemImportExportResources.RESID_FILEEXPORT_OPTION_SETTINGS_DESCFILE_PATH_TOOLTIP);
- data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_FILL;
- data.grabExcessHorizontalSpace = true;
- data.widthHint = convertWidthInCharsToPixels(80);
- descFilePathField.setLayoutData(data);
- descFilePathField.addListener(SWT.Modify, this);
- descFileBrowseButton = SystemWidgetHelpers.createPushButton(comp, null, SystemImportExportResources.RESID_FILEEXPORT_OPTION_SETTINGS_DESCFILE_BROWSE_LABEL,
- SystemImportExportResources.RESID_FILEEXPORT_OPTION_SETTINGS_DESCFILE_BROWSE_TOOLTIP);
- descFileBrowseButton.addListener(SWT.Selection, this);
- }
-
- /**
- * @see org.eclipse.ui.dialogs.WizardExportResourcesPage#setupBasedOnInitialSelections()
- */
- protected void setupBasedOnInitialSelections() {
- Object input = getInputObject();
- boolean allResource = true;
- // ensure initial input, i.e. selection, comprises of IResources only
- if ((input != null) && (input instanceof IStructuredSelection)) {
- IStructuredSelection sel = (IStructuredSelection) input;
- if (sel.size() > 0) {
- Iterator z = sel.iterator();
- while (z.hasNext()) {
- Object obj = z.next();
- if (!(obj instanceof IResource)) {
- allResource = false;
- break;
- }
- }
- } else {
- allResource = false;
- }
- } else {
- allResource = false;
- }
- // if selections are all resources, call super method to setup
- if (allResource) {
- super.setupBasedOnInitialSelections();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.dialogs.WizardDataTransferPage#updateWidgetEnablements()
- */
- protected void updateWidgetEnablements() {
- boolean isSaveSettings = isSaveSettings();
- descFilePathLabel.setEnabled(isSaveSettings);
- descFilePathField.setEnabled(isSaveSettings);
- descFileBrowseButton.setEnabled(isSaveSettings);
-
- // if review is selected, the other options are grayed out without save settings
- if (reviewSynchronizeCheckbox != null) { // event handling could come before the widgets are created
- boolean isReview = reviewSynchronizeCheckbox.getSelection();
- overwriteExistingFilesCheckbox.setEnabled(!isReview);
- createDirectoryStructureButton.setEnabled(!isReview);
- createSelectionOnlyButton.setEnabled(!isReview);
- }
- }
-
- /**
- * Attempts to ensure that the specified directory exists on the local file system.
- * Answers a boolean indicating success.
- *
- * @return boolean
- * @param directory java.io.File
- */
- protected boolean ensureDirectoryExists(File directory) {
- if (!directory.exists()) {
-
- String msgTxt = RemoteImportExportResources.FILEMSG_TARGET_EXISTS;
- String msgDetails = NLS.bind(RemoteImportExportResources.FILEMSG_TARGET_EXISTS_DETAILS, directory.getAbsolutePath());
-
- SystemMessage msg = new SimpleSystemMessage(RemoteImportExportPlugin.PLUGIN_ID,
- IRemoteImportExportConstants.FILEMSG_TARGET_EXISTS,
- IStatus.ERROR, msgTxt, msgDetails);
- SystemMessageDialog dlg = new SystemMessageDialog(getContainer().getShell(), msg);
- if (!dlg.openQuestionNoException()) return false;
- if (!directory.mkdirs()) {
- msgTxt = RemoteImportExportResources.FILEMSG_CREATE_FOLDER_FAILED;
- msgDetails = NLS.bind(RemoteImportExportResources.FILEMSG_CREATE_FOLDER_FAILED_DETAILS, directory.getAbsolutePath());
-
- msg = new SimpleSystemMessage(RemoteImportExportPlugin.PLUGIN_ID,
- IRemoteImportExportConstants.FILEMSG_CREATE_FOLDER_FAILED,
- IStatus.ERROR, msgTxt, msgDetails);
- msg.makeSubstitution(directory.getAbsolutePath());
- setErrorMessage(msg);
- giveFocusToDestination();
- return false;
- }
- }
- return true;
- }
-
- /**
- * If the target for export does not exist then attempt to create it.
- * Answer a boolean indicating whether the target exists (ie.- if it
- * either pre-existed or this method was able to create it)
- *
- * @return boolean
- */
- protected boolean ensureTargetIsValid(File targetDirectory) {
- if (targetDirectory.exists() && !targetDirectory.isDirectory()) {
- String msgTxt = RemoteImportExportResources.FILEMSG_SOURCE_IS_FILE;
- String msgDetails = NLS.bind(RemoteImportExportResources.FILEMSG_SOURCE_IS_FILE_DETAILS, targetDirectory.getAbsolutePath());
-
- SystemMessage msg = new SimpleSystemMessage(RemoteImportExportPlugin.PLUGIN_ID,
- IRemoteImportExportConstants.FILEMSG_SOURCE_IS_FILE,
- IStatus.ERROR, msgTxt, msgDetails);
-
- setErrorMessage(msg);
- giveFocusToDestination();
- return false;
- }
- return ensureDirectoryExists(targetDirectory);
- }
-
- /**
- * Set up and execute the passed Operation. Answer a boolean indicating success.
- *
- * @return boolean
- */
- protected boolean executeExportOperation(RemoteFileExportOperation op) {
- try {
- getContainer().run(true, true, op);
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) { // Display error dialog if exception is NullPointer, assume this means
- // communication failure. See RemoteFileExportOperation.exportFile()
- if (!NullPointerException.class.isInstance(e.getTargetException())) {
- displayErrorDialog(e.getTargetException());
- return false;
- }
- } catch (Exception e) {
- displayErrorDialog(e.getMessage());
- return false;
- }
- IStatus status = op.getStatus();
- if (!status.isOK()) {
- String msgTxt = NLS.bind(RemoteImportExportResources.FILEMSG_EXPORT_FAILED, status);
- SystemMessage msg = new SimpleSystemMessage(RemoteImportExportPlugin.PLUGIN_ID,
- IRemoteImportExportConstants.FILEMSG_EXPORT_FAILED,
- IStatus.ERROR, msgTxt);
- SystemMessageDialog dlg = new SystemMessageDialog(getContainer().getShell(), msg);
- dlg.openWithDetails();
- return false;
- }
- return true;
- }
-
- /**
- * The Finish button was pressed. Try to do the required work now and answer
- * a boolean indicating success. If false is returned then the wizard will
- * not close.
- *
- * @return boolean
- */
- public boolean finish() {
- clearMessage();
- clearErrorMessage();
- boolean ret = false;
- setDestinationValue(destinationNameField.getText().trim());
- if (Utilities.isConnectionValid(destinationNameField.getText().trim(), getShell()) && isDestinationFolder()) {
- if (!ensureTargetIsValid((File) destinationFolder)) return false;
- List resourcesToExport = getWhiteCheckedResources();
- //Save dirty editors if possible but do not stop if not all are saved
- saveDirtyEditors();
- // about to invoke the operation so save our state
- saveWidgetValues();
- if (resourcesToExport.size() > 0) {
- // export data
- RemoteFileExportData data = new RemoteFileExportData();
-
- data.setContainerPath( null);
- data.setElements(resourcesToExport);
- data.setReviewSynchronize(reviewSynchronizeCheckbox.getSelection());
- data.setCreateDirectoryStructure(createDirectoryStructureButton.getSelection());
- data.setCreateSelectionOnly(createSelectionOnlyButton.getSelection());
- data.setOverWriteExistingFiles(overwriteExistingFilesCheckbox.getSelection());
- data.setSaveSettings(saveSettingsButton.getSelection());
- data.setDescriptionFilePath(getDescriptionLocation());
- data.setDestination(getDestinationValue());
-
- if (!reviewSynchronizeCheckbox.getSelection()) {
- // execute export
- ret = executeExportOperation(new RemoteFileExportOperation(data, this));
- } else {
- // run synchronization
- SynchronizeData data2 = new SynchronizeData(data);
- if (reviewSynchronizeCheckbox.getSelection()) {
- data2.setSynchronizeType(ISynchronizeOperation.SYNC_MODE_UI_REVIEW_INITIAL);
- }
- try {
- ret = new Synchronizer(data2).run(new SynchronizeOperation());
- } catch (Exception e) {
- // TODO Auto-generated catch block
- ret = false;
- e.printStackTrace();
- }
-
- // save description after synchronize operation
- try {
- if (data.isSaveSettings()) {
- RSESyncUtils.saveDescription(data);
- }
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- return ret;
- }
-
- String msgTxt = RemoteImportExportResources.FILEMSG_EXPORT_NONE_SELECTED;
- String msgDetails = RemoteImportExportResources.FILEMSG_EXPORT_NONE_SELECTED_DETAILS;
-
- SystemMessage msg = new SimpleSystemMessage(RemoteImportExportPlugin.PLUGIN_ID,
- IRemoteImportExportConstants.FILEMSG_EXPORT_NONE_SELECTED,
- IStatus.ERROR, msgTxt, msgDetails);
- setErrorMessage(msg);
- return false;
- }
- return false;
- }
-
- /**
- * Gets the destination.
- * @return the desstionation.
- */
- protected String getDestinationValue() {
- return destinationNameField.getText().trim();
- }
-
- /**
- * Gets the description.
- * @return the description.
- */
- protected String getDescriptionLocation() {
- return descFilePathField.getText().trim();
- }
-
- /**
- * Returns whether the settings should be saved.
- * @return whether settings should be saved.
- */
- protected boolean isSaveSettings() {
- return saveSettingsButton.getSelection();
- }
-
- /**
- * Set the current input focus to self's destination entry field
- */
- protected void giveFocusToDestination() {
- destinationNameField.setFocus();
- }
-
- /**
- * Open an appropriate destination browser so that the user can specify a source
- * to import from
- */
- protected void handleDestinationBrowseButtonPressed() {
- SystemSelectRemoteFolderAction action = new SystemSelectRemoteFolderAction(this.getShell());
- action.setShowNewConnectionPrompt(true);
- action.setFoldersOnly(true);
- action.setShowPropertySheet(true, false);
- String destValue = getDestinationValue();
- if (destValue != null)
- {
- IHost host = Utilities.parseForSystemConnection(destValue);
- IRemoteFile path = Utilities.parseForIRemoteFile(destValue);
- action.setDefaultConnection(host);
- action.setPreSelection(path);
- }
-
- action.run();
- IRemoteFile folder = action.getSelectedFolder();
-
- if (folder != null) {
- destinationFolder = new UniFilePlus(folder);
- destValue = Utilities.getAsString((UniFilePlus)destinationFolder);
- setDestinationValue(destValue);
- }
- }
-
- /**
- * Open an appropriate destination browser so that the user can specify a source
- * to import from.
- */
- protected void handleDescriptionFileBrowseButtonPressed() {
- SaveAsDialog dialog = new SaveAsDialog(getContainer().getShell());
- dialog.create();
- dialog.getShell().setText(RemoteImportExportResources.IMPORT_EXPORT_DESCRIPTION_FILE_DIALOG_TITLE);
- dialog.setMessage(RemoteImportExportResources.IMPORT_EXPORT_DESCRIPTION_FILE_DIALOG_MESSAGE);
- dialog.setOriginalFile(createFileHandle(new Path(getDescriptionLocation())));
- if (dialog.open() == Window.OK) {
- IPath path = dialog.getResult();
- path = path.removeFileExtension().addFileExtension(Utilities.EXPORT_DESCRIPTION_EXTENSION);
- descFilePathField.setText(path.toString());
- }
- }
-
- /**
- * Creates a file resource handle for the file with the given workspace path.
- * This method does not create the file resource; this is the responsibility
- * of <code>createFile</code>.
- *
- * @param filePath the path of the file resource to create a handle for
- * @return the new file resource handle
- */
- protected IFile createFileHandle(IPath filePath) {
- if (filePath.isValidPath(filePath.toString()) && filePath.segmentCount() >= 2)
- return SystemBasePlugin.getWorkspace().getRoot().getFile(filePath);
- else
- return null;
- }
-
- /**
- * Handle all events and enablements for widgets in this page
- * @param e Event
- */
- public void handleEvent(Event e) {
- Widget source = e.widget;
- if (source == destinationBrowseButton) {
- handleDestinationBrowseButtonPressed();
- } else if (source == descFileBrowseButton) {
- handleDescriptionFileBrowseButtonPressed();
- }
- updateWidgetEnablements();
- updatePageCompletion();
- }
-
- /**
- * Hook method for saving widget values for restoration by the next instance
- * of this class.
- */
- protected void internalSaveWidgetValues() {
- // update directory names history
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
- if (directoryNames == null) directoryNames = new String[0];
- directoryNames = addToHistory(directoryNames, getDestinationValue());
- settings.put(STORE_DESTINATION_NAMES_ID, directoryNames);
- // options
- settings.put(STORE_REVIEW_SYNCHRONIZE_ID, reviewSynchronizeCheckbox.getSelection());
- settings.put(STORE_OVERWRITE_EXISTING_FILES_ID, overwriteExistingFilesCheckbox.getSelection());
- settings.put(STORE_CREATE_STRUCTURE_ID, createDirectoryStructureButton.getSelection());
- settings.put(STORE_CREATE_DESCRIPTION_FILE_ID, isSaveSettings());
- settings.put(STORE_DESCRIPTION_FILE_NAME_ID, getDescriptionLocation());
- }
- }
-
- /**
- * Method will return boolean value, will issue error if destination is
- * null
- */
- protected boolean isDestinationFolder() {
- boolean ret = destinationFolder != null;
- if (!ret) {
- String msgTxt = RemoteImportExportResources.MSG_IMPORT_EXPORT_UNABLE_TO_USE_CONNECTION;
- String msgDetails = RemoteImportExportResources.MSG_IMPORT_EXPORT_UNABLE_TO_USE_CONNECTION_DETAILS;
- SystemMessage msg = new SimpleSystemMessage(RemoteImportExportPlugin.PLUGIN_ID,
- IRemoteImportExportConstants.MSG_IMPORT_EXPORT_UNABLE_TO_USE_CONNECTION,
- IStatus.ERROR, msgTxt, msgDetails);
- SystemMessageDialog.show(getShell(), msg);
- }
- return ret;
- }
-
- /**
- * Hook method for restoring widget values to the values that they held
- * last time this wizard was used to completion.
- */
- protected void restoreWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- // destination chosen on previous export
- String lastDestination = null;
- String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
- if (directoryNames != null) {
- for (int i = 0; i < directoryNames.length; i++) {
- // because of the way we add destination items to history, the
- // destination for the previous export would be first
- if (i == 0) {
- lastDestination = directoryNames[i];
- }
- addDestinationItem(directoryNames[i]);
- }
- }
- RemoteExportWizard parentWizard = (RemoteExportWizard) getWizard();
- boolean isInitializingFromExportData = parentWizard.getInitializeFromExportData();
- // options
- // no export data to initialize from, so prefill from previous export
- if (!isInitializingFromExportData) {
- reviewSynchronizeCheckbox.setSelection(settings.getBoolean(STORE_REVIEW_SYNCHRONIZE_ID));
- overwriteExistingFilesCheckbox.setSelection(settings.getBoolean(STORE_OVERWRITE_EXISTING_FILES_ID));
- boolean createDirectories = settings.getBoolean(STORE_CREATE_STRUCTURE_ID);
- createDirectoryStructureButton.setSelection(createDirectories);
- createSelectionOnlyButton.setSelection(!createDirectories);
- boolean saveSettings = settings.getBoolean(STORE_CREATE_DESCRIPTION_FILE_ID);
- saveSettingsButton.setSelection(saveSettings);
- String descFilePathStr = settings.get(STORE_DESCRIPTION_FILE_NAME_ID);
- if (descFilePathStr == null) {
- descFilePathStr = ""; //$NON-NLS-1$
- }
- descFilePathField.setText(descFilePathStr);
- // select previous export destination
- if (lastDestination != null) {
- setDestinationValue(lastDestination);
- }
- }
- // initialize from export data
- else {
- RemoteFileExportData data = parentWizard.getExportData();
- reviewSynchronizeCheckbox.setSelection(data.isReviewSynchronize());
- overwriteExistingFilesCheckbox.setSelection(data.isOverWriteExistingFiles());
- createDirectoryStructureButton.setSelection(data.isCreateDirectoryStructure());
- createSelectionOnlyButton.setSelection(data.isCreateSelectionOnly());
- saveSettingsButton.setSelection(data.isSaveSettings());
- String descFilePathStr = data.getDescriptionFilePath();
- if (descFilePathStr == null) {
- descFilePathStr = ""; //$NON-NLS-1$
- }
- descFilePathField.setText(descFilePathStr);
- String destinationPath = data.getDestination();
- if (destinationPath != null) {
- setDestinationValue(destinationPath);
- }
- }
- }
- // check if there was an initial selection
- // if it is a remote directory, then set the absolute path in the source name field
- Object initSelection = getInputObject();
- if ((initSelection != null) && (initSelection instanceof IStructuredSelection)) {
- IStructuredSelection sel = (IStructuredSelection) initSelection;
- if (sel.size() == 1) {
- Object theSel = sel.getFirstElement();
- if (theSel instanceof IRemoteFile) {
- IRemoteFile file = (IRemoteFile) theSel;
- // set source name if the input is a folder
- if (file.isDirectory()) {
- destinationFolder = new UniFilePlus(file);
- setDestinationValue(Utilities.getAsString((UniFilePlus) destinationFolder));
- }
- }
- }
- }
- }
-
- /**
- * Set the contents of the receivers destination specification widget to
- * the passed value
- *
- */
- protected void setDestinationValue(String path) {
- if (path.length() > 0) {
- String[] currentItems = destinationNameField.getItems();
- int selectionIndex = -1;
- for (int i = 0; i < currentItems.length && selectionIndex < 0; i++) {
- if (currentItems[i].equals(path)) selectionIndex = i;
- }
- if (selectionIndex < 0) {
- // need to add a new one.
- int oldLength = currentItems.length;
- String[] newItems = new String[oldLength + 1];
- System.arraycopy(currentItems, 0, newItems, 0, oldLength);
- newItems[oldLength] = path;
- destinationNameField.setText(path);
- destinationNameField.setItems(newItems);
- selectionIndex = oldLength;
- } else {
- }
- destinationNameField.select(selectionIndex);
- }
- destinationFolder = null; // clear destination
- IHost conn = Utilities.parseForSystemConnection(path);
- if (conn != null) {
- IRemoteFile rf = Utilities.parseForIRemoteFile(path);
- if (rf != null) destinationFolder = new UniFilePlus(rf);
- }
- }
-
- /**
- * Answer a boolean indicating whether the receivers destination specification
- * widgets currently all contain valid values.
- */
- protected boolean validateDestinationGroup() {
- String destinationValue = getDestinationValue();
- if (destinationValue.length() == 0) {
- setMessage(DESTINATION_EMPTY_MESSAGE);
- return false;
- }
- else {
- setMessage((String)null); // clear the message when a destination has been chosen
- }
- String conflictingContainer = getConflictingContainerNameFor(destinationValue);
- if (conflictingContainer != null) {
- String msgTxt = NLS.bind(RemoteImportExportResources.FILEMSG_DESTINATION_CONFLICTING, conflictingContainer);
- String msgDetails = RemoteImportExportResources.FILEMSG_DESTINATION_CONFLICTING_DETAILS;
-
- SystemMessage msg = new SimpleSystemMessage(RemoteImportExportPlugin.PLUGIN_ID,
- IRemoteImportExportConstants.FILEMSG_DESTINATION_CONFLICTING,
- IStatus.ERROR, msgTxt, msgDetails);
- setErrorMessage(msg);
- giveFocusToDestination();
- return false;
- }
- return true;
- }
-
- /**
- * @see org.eclipse.ui.dialogs.WizardDataTransferPage#validateOptionsGroup()
- */
- protected boolean validateOptionsGroup() {
- if (isSaveSettings()) {
- IPath location = new Path(getDescriptionLocation());
- // if location is empty, no error message, but it's not valid
- if (location.toString().length() == 0) {
- setErrorMessage((String) null);
- return false;
- }
- // location must start with '/'
- if (!location.toString().startsWith("/")) { //$NON-NLS-1$
- setErrorMessage(RemoteImportExportResources.IMPORT_EXPORT_ERROR_DESCRIPTION_ABSOLUTE);
- return false;
- }
- // find the resource, including a variant if any
- IResource resource = findResource(location);
- // if resource is not a file, it must be a container. So location is pointing to a container, which is an error
- if (resource != null && resource.getType() != IResource.FILE) {
- setErrorMessage(RemoteImportExportResources.IMPORT_EXPORT_ERROR_DESCRIPTION_EXISTING_CONTAINER);
- return false;
- }
- // get the resource (or any variant of it) after removing the last segment
- // this gets the parent resource
- resource = findResource(location.removeLastSegments(1));
- // if parent resource does not exist, or if it is a file, then it is not valid
- if (resource == null || resource.getType() == IResource.FILE) {
- setErrorMessage(RemoteImportExportResources.IMPORT_EXPORT_ERROR_DESCRIPTION_NO_CONTAINER);
- return false;
- }
- // get the file extension
- String fileExtension = location.getFileExtension();
- // ensure that file extension is valid
- if (fileExtension == null || !fileExtension.equals(Utilities.EXPORT_DESCRIPTION_EXTENSION)) {
- setErrorMessage(NLS.bind(RemoteImportExportResources.IMPORT_EXPORT_ERROR_DESCRIPTION_INVALID_EXTENSION, Utilities.EXPORT_DESCRIPTION_EXTENSION ));
- return false;
- }
- }
- return true;
- }
-
- /**
- * Returns the resource for the specified path.
- *
- * @param path the path for which the resource should be returned
- * @return the resource specified by the path or <code>null</code>
- */
- protected IResource findResource(IPath path) {
- IWorkspace workspace = SystemBasePlugin.getWorkspace();
- // validate path
- IStatus result = workspace.validatePath(path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE);
- // if path valid
- if (result.isOK()) {
- // get the workspace root
- IWorkspaceRoot root = workspace.getRoot();
- // see if path exists. If it does, return the resource at the path
- if (root.exists(path)) {
- return root.findMember(path);
- }
- // see if a variant of the path exists
- else {
- // look for variant
- IResource variant = RemoteImportExportUtil.getInstance().findExistingResourceVariant(path);
- // if a variant does exist, return it
- if (variant != null) {
- return variant;
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the name of a container with a location that encompasses targetDirectory.
- * Returns null if there is no conflict.
- *
- * @param targetDirectory the path of the directory to check.
- * @return the conflicting container name or <code>null</code>
- */
- protected String getConflictingContainerNameFor(String targetDirectory) {
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IPath testPath = new Path(targetDirectory);
- if (root.getLocation().isPrefixOf(testPath)) return "workspace root"; //UniversalSystemPlugin.getString("IFSexport.rootName"); //$NON-NLS-1$
- IProject[] projects = root.getProjects();
- for (int i = 0; i < projects.length; i++) {
- IPath loc = projects[i].getLocation();
- if (loc != null && loc.isPrefixOf(testPath))
- return projects[i].getName();
- }
- return null;
- }
-
- /* (non-Javadoc)
- * @see com.ibm.etools.systems.core.ui.wizards.ISystemWizardPage#setInputObject(java.lang.Object)
- */
- public void setInputObject(Object inputObject) {
- this.inputObject = inputObject;
- }
-
- /* (non-Javadoc)
- * @see com.ibm.etools.systems.core.ui.wizards.ISystemWizardPage#getInputObject()
- */
- public Object getInputObject() {
- return inputObject;
- }
-
- /* (non-Javadoc)
- * @see com.ibm.etools.systems.core.ui.wizards.ISystemWizardPage#performFinish()
- */
- public boolean performFinish() {
- return finish();
- }
-
- /* (non-Javadoc)
- * @see com.ibm.etools.systems.core.ui.wizards.ISystemWizardPage#setHelp(java.lang.String)
- */
- public void setHelp(String id) {
- if (parentComposite != null) SystemWidgetHelpers.setHelp(parentComposite, helpId);
- this.helpId = id;
- }
-
- /* (non-Javadoc)
- * @see com.ibm.etools.systems.core.ui.wizards.ISystemWizardPage#getHelpContextId()
- */
- public String getHelpContextId() {
- return helpId;
- }
-
- /**
- * ISystemMessageLine method. <br>
- * Clears the currently displayed error message and redisplayes
- * the message which was active before the error message was set.
- */
- public void clearErrorMessage() {
- if (msgLine != null)
- msgLine.clearErrorMessage();
- else
- super.setErrorMessage(null);
- }
-
- /**
- * ISystemMessageLine method. <br>
- * Clears the currently displayed message.
- */
- public void clearMessage() {
- if (msgLine != null)
- msgLine.clearMessage();
- else
- super.setMessage(null);
- }
-
- /**
- * ISystemMessageLine method. <br>
- * Get the currently displayed error text.
- * @return The error message. If no error message is displayed <code>null</code> is returned.
- */
- public SystemMessage getSystemErrorMessage() {
- if (msgLine != null)
- return msgLine.getSystemErrorMessage();
- else
- return null;
- }
-
- /**
- * ISystemMessageLine method. <br>
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(SystemMessage message) {
- if (msgLine != null) {
- if (message != null)
- msgLine.setErrorMessage(message);
- else
- msgLine.clearErrorMessage();
- } else // not configured yet
- {
- pendingErrorMessage = message;
- super.setErrorMessage(message.getLevelOneText());
- }
- }
-
- /**
- * ISystemMessageLine method. <br>
- * Convenience method to set an error message from an exception
- */
- public void setErrorMessage(Throwable exc) {
- if (msgLine != null)
- msgLine.setErrorMessage(exc);
- else {
- String msgTxt = CommonMessages.MSG_ERROR_UNEXPECTED;
- SystemMessage msg = new SimpleSystemMessage(RemoteImportExportPlugin.PLUGIN_ID,
- ICommonMessageIds.MSG_ERROR_UNEXPECTED,
- IStatus.ERROR, msgTxt, exc);
-
- pendingErrorMessage = msg;
- super.setErrorMessage(msg.getLevelOneText());
- }
- }
-
- /**
- * ISystemMessageLine method. <br>
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(String message) {
- if (msgLine != null) msgLine.setErrorMessage(message);
- // super.setErrorMessage(message);
- // if (msgLine != null)
- // ((SystemDialogPageMessageLine)msgLine).internalSetErrorMessage(message);
- }
-
- /**
- * ISystemMessageLine method. <br>
- * If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage
- */
- public void setMessage(SystemMessage message) {
- if (msgLine != null)
- msgLine.setMessage(message);
- else // not configured yet
- {
- pendingMessage = message;
- super.setMessage(message.getLevelOneText());
- }
- }
-
- /**
- * ISystemMessageLine method. <br>
- * Set the non-error message text. If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage
- */
- public void setMessage(String message) {
- if (msgLine != null) msgLine.setMessage(message);
- // super.setMessage(message);
- // if (msgLine!=null)
- // ((SystemDialogPageMessageLine)msgLine).internalSetMessage(message);
- }
-}
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
deleted file mode 100644
index 64beabf11..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteExporter.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
- * David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding
- * David McKnight (IBM) - [191482] [importexport][efs] Export from Project on a remote EFS project Errors
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.services.files.IFileService;
-import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-
-// Similar to org.eclipse.ui.wizards.datatransfer.FileSystemExporter
-/**
- * Helper class for exporting resources to the file system.
- */
-class RemoteExporter {
- private IHost _host = null;
-
- /**
- * Create an instance of this class. Use this constructor if you wish to
- * use an host object */
- public RemoteExporter(IHost s) {
- super();
- _host = s;
- }
-
- /**
- * Create an instance of this class.
- */
- public RemoteExporter() {
- super();
- }
-
- /**
- * Creates the specified file system directory at <code>destinationPath</code>.
- * This creates a new file system directory.
- */
- public void createFolder(IPath destinationPath) {
- // IFS: use IFSJaveFile object if necessary
- if (_host != null)
- new UniFilePlus(Utilities.getIRemoteFile(_host, destinationPath.toString())).mkdir();
- else
- new File(destinationPath.toOSString()).mkdir();
- }
-
- /**
- * Writes the passed resource to the specified location recursively
- * @throws SystemMessageException TODO
- */
- public void write(IResource resource, IPath destinationPath) throws IOException, CoreException, SystemMessageException {
- if (resource.getType() == IResource.FILE)
- writeFile((IFile) resource, destinationPath);
- else
- writeChildren((IContainer) resource, destinationPath);
- }
-
- /**
- * Exports the passed container's children
- * @throws SystemMessageException TODO
- */
- protected void writeChildren(IContainer folder, IPath destinationPath) throws IOException, CoreException, SystemMessageException {
- if (folder.isAccessible()) {
- IResource[] children = folder.members();
- for (int i = 0; i < children.length; i++) {
- IResource child = children[i];
- writeResource(child, destinationPath.append(child.getName()));
- }
- }
- }
-
- /**
- * Writes the passed file resource to the specified destination on the remote
- * file system
- * @throws SystemMessageException TODO
- */
- protected void writeFile(IFile file, IPath destinationPath) throws IOException, CoreException, SystemMessageException {
- IRemoteFileSubSystem rfss = RemoteFileUtility.getFileSubSystem(_host);
- String dest = destinationPath.toString();
- char sep = rfss.getSeparatorChar();
- if (sep != '/')
- {
- // for windows
- dest = dest.replace('/', sep);
- }
- String localEncoding = file.getCharset();
- String hostEncoding = Utilities.getIRemoteFile(_host, dest).getEncoding();
- IPath location = file.getLocation();
- if (location != null){
- rfss.upload(location.makeAbsolute().toOSString(), localEncoding, dest, hostEncoding, new NullProgressMonitor()); //$NON-NLS-1$
- }
- else {
- // an EFS file
- int lastSep = dest.lastIndexOf(sep);
- String remoteParent = dest.substring(0, lastSep);
- String remoteFile = dest.substring(lastSep +1);
-
- OutputStream outstream = rfss.getOutputStream(remoteParent, remoteFile, IFileService.NONE, new NullProgressMonitor());
-
- InputStream instream = file.getContents();
- try {
- int length = 1000;
- byte[] buffer = new byte[length];
-
- int bytesRead = 0;
- boolean done = false;
- while (!done){
- bytesRead = instream.read(buffer, 0, length);
- if (bytesRead > 0){
- outstream.write(buffer, 0, bytesRead);
- }
- if (bytesRead == -1){
- done = true;
- }
- }
- }
- finally {
- instream.close();
- outstream.close();
- }
- }
- }
-
- /**
- * Writes the passed resource to the specified location recursively
- * @throws SystemMessageException TODO
- */
- protected void writeResource(IResource resource, IPath destinationPath) throws IOException, CoreException, SystemMessageException {
- if (resource.getType() == IResource.FILE)
- writeFile((IFile) resource, destinationPath);
- else {
- createFolder(destinationPath);
- writeChildren((IContainer) resource, destinationPath);
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportActionDelegate.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportActionDelegate.java
deleted file mode 100644
index f04d95353..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportActionDelegate.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
- * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
- * David McKnight (IBM) - [216252] MessageFormat.format -> NLS.bind
- * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
- * Takuya Miyamoto - [185925] Integrate Platform/Team Synchronization
- * David McKnight (IBM) - [287946] Export, save in rexpfd does not work any more
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.internal.importexport.IRemoteImportExportConstants;
-import org.eclipse.rse.internal.importexport.RemoteImportExportPlugin;
-import org.eclipse.rse.internal.importexport.RemoteImportExportProblemDialog;
-import org.eclipse.rse.internal.importexport.RemoteImportExportResources;
-import org.eclipse.rse.internal.synchronize.SynchronizeData;
-import org.eclipse.rse.internal.synchronize.provisional.ISynchronizeOperation;
-import org.eclipse.rse.internal.synchronize.provisional.SynchronizeOperation;
-import org.eclipse.rse.internal.synchronize.provisional.Synchronizer;
-import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * This class is a remote file export action.
- */
-public class RemoteFileExportActionDelegate extends RemoteFileImportExportActionDelegate {
- /**
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action) {
- IFile[] descriptions = getDescriptionFiles(getSelection());
- MultiStatus mergedStatus;
- int length = descriptions.length;
- if (length < 1) {
- return;
- }
- // create read multi status
- String message;
- if (length > 1) {
- message = RemoteImportExportResources.IMPORT_EXPORT_ERROR_CREATE_FILES_FAILED;
- } else {
- message = RemoteImportExportResources.IMPORT_EXPORT_ERROR_CREATE_FILE_FAILED;
- }
- MultiStatus readStatus = new MultiStatus(RemoteImportExportPlugin.getDefault().getSymbolicName(), 0, message, null);
- RemoteFileExportData[] exportDatas = readExportDatas(descriptions, readStatus);
- if (exportDatas.length > 0) {
- IStatus status = export(exportDatas);
- if (status == null) {
- return;
- }
- if (readStatus.getSeverity() == IStatus.ERROR) {
- message = readStatus.getMessage();
- } else {
- message = status.getMessage();
- }
- // create new status because we want another message - no API to set message
- mergedStatus = new MultiStatus(RemoteImportExportPlugin.getDefault().getSymbolicName(), status.getCode(), readStatus.getChildren(), message, null);
- mergedStatus.merge(status);
- } else {
- mergedStatus = readStatus;
- }
- if (!mergedStatus.isOK()) {
- RemoteImportExportProblemDialog.open(getShell(), RemoteImportExportResources.IMPORT_EXPORT_EXPORT_ACTION_DELEGATE_TITLE, null, mergedStatus);
- }
- }
-
- private RemoteFileExportData[] readExportDatas(IFile[] descriptions, MultiStatus readStatus) {
- List exportDataList = new ArrayList(descriptions.length);
- for (int i = 0; i < descriptions.length; i++) {
- RemoteFileExportData exportData = readExportData(descriptions[i], readStatus);
- if (exportData != null) {
- exportDataList.add(exportData);
- }
- }
- return (RemoteFileExportData[]) exportDataList.toArray(new RemoteFileExportData[exportDataList.size()]);
- }
-
- /**
- * Reads the file export data from a file.
- */
- protected RemoteFileExportData readExportData(IFile description, MultiStatus readStatus) {
- Assert.isLegal(description.isAccessible());
- Assert.isNotNull(description.getFileExtension());
- Assert.isLegal(description.getFileExtension().equals(Utilities.EXPORT_DESCRIPTION_EXTENSION));
- RemoteFileExportData exportData = new RemoteFileExportData();
- IRemoteFileExportDescriptionReader reader = null;
- try {
- reader = exportData.createExportDescriptionReader(description.getContents());
- // read export data
- reader.read(exportData);
- // do not save settings again
- exportData.setSaveSettings(false);
- } catch (CoreException ex) {
- String message = NLS.bind(RemoteImportExportResources.IMPORT_EXPORT_ERROR_DESCRIPTION_READ, description.getFullPath(), ex.getStatus().getMessage());
- addToStatus(readStatus, message, ex);
- return null;
- } finally {
- if (reader != null) {
- readStatus.addAll(reader.getStatus());
- }
- try {
- if (reader != null) {
- reader.close();
- }
- } catch (CoreException ex) {
- String message = NLS.bind(RemoteImportExportResources.IMPORT_EXPORT_ERROR_DESCRIPTION_CLOSE, description.getFullPath());
- addToStatus(readStatus, message, ex);
- }
- }
- return exportData;
- }
-
- private IStatus export(RemoteFileExportData[] exportDatas) {
- // Add re-running synchronize operation
- for (int i = 0; i < exportDatas.length; i++) {
- RemoteFileExportData exportData = exportDatas[i];
- if (exportData.isReviewSynchronize()){
-
- SynchronizeData data = new SynchronizeData(exportData);
- data.setSynchronizeType(ISynchronizeOperation.SYNC_MODE_UI_REVIEW);
- new Synchronizer(data).run(new SynchronizeOperation());
- }
- else {
- IStatus status = null;
- RemoteFileExportOperation op = new RemoteFileExportOperation(exportDatas[i], new RemoteFileOverwriteQuery());
- try {
- PlatformUI.getWorkbench().getProgressService().run(true, true, op);
- status = op.getStatus();
- } catch (InvocationTargetException e) {
- SystemBasePlugin.logError("Error occured trying to export", e); //$NON-NLS-1$
- status = new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getBundle().getSymbolicName(), 0, "", e); //$NON-NLS-1$
- } catch (InterruptedException e) {
- SystemBasePlugin.logError("Error occured trying to export", e); //$NON-NLS-1$
- status = new Status(IStatus.OK, RemoteImportExportPlugin.getDefault().getBundle().getSymbolicName(), 0, "", e); //$NON-NLS-1$
- }
- if (!status.isOK()) {
- String msgTxt = NLS.bind(RemoteImportExportResources.FILEMSG_EXPORT_FAILED, status);
-
- SystemMessage msg = new SimpleSystemMessage(RemoteImportExportPlugin.PLUGIN_ID,
- IRemoteImportExportConstants.FILEMSG_EXPORT_FAILED,
- IStatus.ERROR, msgTxt);
-
- SystemMessageDialog dlg = new SystemMessageDialog(getShell(), msg);
- dlg.openWithDetails();
- return null;
- }
- }
- }
- return null;
- }
-
- protected void addToStatus(MultiStatus multiStatus, String defaultMessage, CoreException ex) {
- IStatus status = ex.getStatus();
- String message = ex.getLocalizedMessage();
- if (message == null || message.length() < 1) {
- status = new Status(status.getSeverity(), status.getPlugin(), status.getCode(), defaultMessage, ex);
- }
- multiStatus.add(status);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportData.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportData.java
deleted file mode 100644
index 520077cf0..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportData.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.rse.ui.SystemBasePlugin;
-
-/**
- * Holds data of what to export.
- */
-public class RemoteFileExportData {
- private String destination;
-
- private IPath containerPath;
- private boolean reviewSynchronize;
- private boolean overWriteExistingFiles;
- private boolean createDirectoryStructure;
- private boolean createSelectionOnly;
- private boolean saveSettings;
- private String descriptionFilePath;
-
- // export elements
- private List elements;
-
- /**
- * Constructor.
- */
- public RemoteFileExportData() {
- setContainerPath(null);
- setDestination(null);
- setOverWriteExistingFiles(false);
- setCreateDirectoryStructure(false);
- setCreateSelectionOnly(true);
- setSaveSettings(false);
- setDescriptionFilePath(null);
- }
-
- /**
- * @return Returns the descriptionFilePath.
- */
- public String getDescriptionFilePath() {
- return descriptionFilePath;
- }
-
- /**
- * Gets the description file as a workspace resource.
- * @return a file representing the description file.
- */
- public IFile getDescriptionFile() {
- IPath path = new Path(getDescriptionFilePath());
- if (path.isValidPath(path.toString()) && path.segmentCount() >= 2) {
- return SystemBasePlugin.getWorkspace().getRoot().getFile(path);
- } else {
- return null;
- }
- }
-
- /**
- * @param descriptionFilePath The descriptionFilePath to set.
- */
- public void setDescriptionFilePath(String descriptionFilePath) {
- this.descriptionFilePath = descriptionFilePath;
- }
-
- public void setContainerPath(IPath location){
- this.containerPath = location;
- }
-
- public IPath getContainerPath(){
- return containerPath;
- }
-
- /**
- * @return Returns the destination.
- */
- public String getDestination() {
- return destination;
- }
-
- /**
- * @param destination The destination to set.
- */
- public void setDestination(String destination) {
- this.destination = destination;
- }
-
- /**
- * Returns the elements to be exported.
- * @return the elements.
- */
- public List getElements() {
- return elements;
- }
-
- /**
- * Sets the elements to export.
- * @param elements the elements.
- */
- public void setElements(List elements) {
- this.elements = elements;
- }
-
- /**
- * @return Returns the overWriteExistingFiles.
- */
- public boolean isOverWriteExistingFiles() {
- return overWriteExistingFiles;
- }
-
- /**
- * @param overWriteExistingFiles The overWriteExistingFiles to set.
- */
- public void setOverWriteExistingFiles(boolean overWriteExistingFiles) {
- this.overWriteExistingFiles = overWriteExistingFiles;
- }
-
-
- public boolean isReviewSynchronize(){
- return reviewSynchronize;
- }
-
- public void setReviewSynchronize(boolean reviewSynchronize){
- this.reviewSynchronize = reviewSynchronize;
- }
-
- /**
- * @return Returns the saveSettings.
- */
- public boolean isSaveSettings() {
- return saveSettings;
- }
-
- /**
- * @param saveSettings The saveSettings to set.
- */
- public void setSaveSettings(boolean saveSettings) {
- this.saveSettings = saveSettings;
- }
-
- /**
- * @return Returns the createDirectoryStructure.
- */
- public boolean isCreateDirectoryStructure() {
- return createDirectoryStructure;
- }
-
- /**
- * @param createDirectoryStructure The createDirectoryStructure to set.
- */
- public void setCreateDirectoryStructure(boolean createDirectoryStructure) {
- this.createDirectoryStructure = createDirectoryStructure;
- }
-
- /**
- * @return Returns the createSelectionOnly.
- */
- public boolean isCreateSelectionOnly() {
- return createSelectionOnly;
- }
-
- /**
- * @param createSelectionOnly The createSelectionOnly to set.
- */
- public void setCreateSelectionOnly(boolean createSelectionOnly) {
- this.createSelectionOnly = createSelectionOnly;
- }
-
- /**
- * Creates and returns an export description writer.
- */
- public IRemoteFileExportDescriptionWriter createExportDescriptionWriter(OutputStream outputStream) {
- return new RemoteFileExportDescriptionWriter(outputStream);
- }
-
- /**
- * Creates and returns an export description writer.
- */
- public IRemoteFileExportDescriptionReader createExportDescriptionReader(InputStream inputStream) {
- return new RemoteFileExportDescriptionReader(inputStream);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportDescriptionReader.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportDescriptionReader.java
deleted file mode 100644
index 71d19e5be..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportDescriptionReader.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.rse.internal.importexport.RemoteImportExportPlugin;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * Remote file export description reader.
- */
-public class RemoteFileExportDescriptionReader implements IRemoteFileExportDescriptionReader {
- protected InputStream fInputStream;
-
- /**
- * Constructor.
- */
- public RemoteFileExportDescriptionReader(InputStream inputStream) {
- Assert.isNotNull(inputStream);
- fInputStream = new BufferedInputStream(inputStream);
- }
-
- /**
- * @see org.eclipse.rse.internal.importexport.files.IRemoteFileExportDescriptionReader#read(org.eclipse.rse.internal.importexport.files.RemoteFileExportData)
- */
- public void read(RemoteFileExportData exportData) throws CoreException {
- try {
- readXML(exportData);
- } catch (IOException ex) {
- String message = (ex.getLocalizedMessage() != null ? ex.getLocalizedMessage() : ""); //$NON-NLS-1$
- throw new CoreException(new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getSymbolicName(), 0, message, ex));
- } catch (SAXException ex) {
- String message = (ex.getLocalizedMessage() != null ? ex.getLocalizedMessage() : ""); //$NON-NLS-1$
- throw new CoreException(new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getSymbolicName(), 0, message, ex));
- }
- }
-
- public RemoteFileExportData readXML(RemoteFileExportData exportData) throws IOException, SAXException {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setValidating(false);
- DocumentBuilder parser = null;
- try {
- parser = factory.newDocumentBuilder();
- } catch (ParserConfigurationException ex) {
- throw new IOException(ex.getLocalizedMessage());
- }
- Element xmlFileDesc = parser.parse(new InputSource(fInputStream)).getDocumentElement();
- if (!xmlFileDesc.getNodeName().equals(Utilities.EXPORT_DESCRIPTION_EXTENSION)) {
- throw new IOException();
- }
- NodeList topLevelElements = xmlFileDesc.getChildNodes();
- for (int i = 0; i < topLevelElements.getLength(); i++) {
- Node node = topLevelElements.item(i);
- if (node.getNodeType() != Node.ELEMENT_NODE) continue;
- Element element = (Element) node;
- xmlReadDestinationLocation(exportData, element);
- xmlReadOptions(exportData, element);
- xmlReadSelectedElements(exportData, element);
- }
- return exportData;
- }
-
- private void xmlReadDestinationLocation(RemoteFileExportData exportData, Element element) {
- if (element.getNodeName().equals("destination")) { //$NON-NLS-1$
- exportData.setDestination(element.getAttribute("path")); //$NON-NLS-1$
- }
- }
-
- private void xmlReadOptions(RemoteFileExportData exportData, Element element) throws IOException {
- if (element.getNodeName().equals("options")) { //$NON-NLS-1$
- try {
- exportData.setReviewSynchronize(getBooleanAttribute(element, "reviewSynchronize")); //$NON-NLS-1$
- }
- catch (IOException e){
- // this is a new option so if we're reading an older config file, this attribute doesn't exist
- exportData.setReviewSynchronize(false);
- }
- exportData.setOverWriteExistingFiles(getBooleanAttribute(element, "overWriteExistingFiles")); //$NON-NLS-1$
- exportData.setCreateDirectoryStructure(getBooleanAttribute(element, "createDirectoryStructure")); //$NON-NLS-1$
- exportData.setCreateSelectionOnly(getBooleanAttribute(element, "createSelectedOnly")); //$NON-NLS-1$
- exportData.setSaveSettings(getBooleanAttribute(element, "saveSettings")); //$NON-NLS-1$
- exportData.setDescriptionFilePath(element.getAttribute("descriptionFilePath")); //$NON-NLS-1$
- }
- }
-
- private void xmlReadSelectedElements(RemoteFileExportData exportData, Element element) throws IOException {
- if (element.getNodeName().equals("selectedElements")) { //$NON-NLS-1$
- NodeList selectedElements = element.getChildNodes();
- List elementsToExport = new ArrayList(selectedElements.getLength());
- for (int j = 0; j < selectedElements.getLength(); j++) {
- Node selectedNode = selectedElements.item(j);
- if (selectedNode.getNodeType() != Node.ELEMENT_NODE) {
- continue;
- }
- Element selectedElement = (Element) selectedNode;
- if (selectedElement.getNodeName().equals("file")) { //$NON-NLS-1$
- addFile(elementsToExport, selectedElement);
- } else if (selectedElement.getNodeName().equals("folder")) { //$NON-NLS-1$
- addFolder(elementsToExport, selectedElement);
- } else if (selectedElement.getNodeName().equals("project")) { //$NON-NLS-1$
- addProject(elementsToExport, selectedElement);
- }
- }
- exportData.setElements(elementsToExport);
- }
- }
-
- private void addFile(List selectedElements, Element element) throws IOException {
- IPath path = getPath(element);
- if (path != null) {
- IFile file = SystemBasePlugin.getWorkspace().getRoot().getFile(path);
- if (file != null) {
- selectedElements.add(file);
- }
- }
- }
-
- private void addFolder(List selectedElements, Element element) throws IOException {
- IPath path = getPath(element);
- if (path != null) {
- IFolder folder = SystemBasePlugin.getWorkspace().getRoot().getFolder(path);
- if (folder != null) {
- selectedElements.add(folder);
- }
- }
- }
-
- private void addProject(List selectedElements, Element element) throws IOException {
- String name = element.getAttribute("name"); //$NON-NLS-1$
- if (name.equals("")) { //$NON-NLS-1$
- throw new IOException();
- }
- IProject project = SystemBasePlugin.getWorkspace().getRoot().getProject(name);
- if (project != null) {
- selectedElements.add(project);
- }
- }
-
- private IPath getPath(Element element) throws IOException {
- String pathString = element.getAttribute("path"); //$NON-NLS-1$
- if (pathString.equals("")) { //$NON-NLS-1$
- throw new IOException();
- }
- return new Path(element.getAttribute("path")); //$NON-NLS-1$
- }
-
- protected boolean getBooleanAttribute(Element element, String name) throws IOException {
- String value = element.getAttribute(name);
- if (value != null && value.equalsIgnoreCase("true")) { //$NON-NLS-1$
- return true;
- }
- if (value != null && value.equalsIgnoreCase("false")) { //$NON-NLS-1$
- return false;
- }
- throw new IOException();
- }
-
- /**
- * @see org.eclipse.rse.internal.importexport.files.IRemoteFileExportDescriptionReader#close()
- */
- public void close() throws CoreException {
- if (fInputStream != null) {
- try {
- fInputStream.close();
- } catch (IOException ex) {
- String message = (ex.getLocalizedMessage() != null ? ex.getLocalizedMessage() : ""); //$NON-NLS-1$
- throw new CoreException(new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getSymbolicName(), 0, message, ex));
- }
- }
- }
-
- /**
- * @see org.eclipse.rse.internal.importexport.files.IRemoteFileExportDescriptionReader#getStatus()
- */
- public IStatus getStatus() {
- return new Status(IStatus.OK, RemoteImportExportPlugin.getDefault().getSymbolicName(), 0, "", null); //$NON-NLS-1$
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportDescriptionWriter.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportDescriptionWriter.java
deleted file mode 100644
index 860958f5b..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportDescriptionWriter.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import java.io.BufferedOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.rse.internal.importexport.RemoteImportExportPlugin;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * Remote file export description writer.
- */
-public class RemoteFileExportDescriptionWriter implements IRemoteFileExportDescriptionWriter {
- protected OutputStream fOutputStream;
-
- /**
- * Constructor.
- */
- public RemoteFileExportDescriptionWriter(OutputStream outputStream) {
- Assert.isNotNull(outputStream);
- fOutputStream = new BufferedOutputStream(outputStream);
- }
-
- /**
- * @see org.eclipse.rse.internal.importexport.files.IRemoteFileExportDescriptionWriter#write(org.eclipse.rse.internal.importexport.files.RemoteFileExportData)
- */
- public void write(RemoteFileExportData exportData) throws CoreException {
- try {
- writeXML(exportData);
- } catch (IOException ex) {
- String message = (ex.getLocalizedMessage() != null ? ex.getLocalizedMessage() : ""); //$NON-NLS-1$
- throw new CoreException(new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getSymbolicName(), 0, message, ex));
- }
- }
-
- /**
- * Writes a XML representation of file export data.
- * @exception IOException if writing to the underlying stream fails.
- */
- public void writeXML(RemoteFileExportData exportData) throws IOException {
- Assert.isNotNull(exportData);
- DocumentBuilder docBuilder = null;
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setValidating(false);
- try {
- docBuilder = factory.newDocumentBuilder();
- } catch (ParserConfigurationException ex) {
- throw new IOException(ex.getLocalizedMessage());
- }
- Document document = docBuilder.newDocument();
- // create the document
- Element xmlFileDesc = document.createElement(Utilities.EXPORT_DESCRIPTION_EXTENSION);
- document.appendChild(xmlFileDesc);
- xmlWriteDestinationLocation(exportData, document, xmlFileDesc);
- xmlWriteOptions(exportData, document, xmlFileDesc);
- xmlWriteSelectedElements(exportData, document, xmlFileDesc);
- try {
- // write the document to the stream
- Transformer transformer = TransformerFactory.newInstance().newTransformer();
- transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
- transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$
- transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
- transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); //$NON-NLS-1$ //$NON-NLS-2$
- DOMSource source = new DOMSource(document);
- StreamResult result = new StreamResult(fOutputStream);
- transformer.transform(source, result);
- } catch (TransformerException e) {
- throw new IOException(e.getLocalizedMessage());
- }
- }
-
- private void xmlWriteDestinationLocation(RemoteFileExportData exportData, Document document, Element xmlFileDesc) throws DOMException {
- Element destination = document.createElement("destination"); //$NON-NLS-1$
- xmlFileDesc.appendChild(destination);
- destination.setAttribute("path", exportData.getDestination()); //$NON-NLS-1$
- }
-
- private void xmlWriteOptions(RemoteFileExportData exportData, Document document, Element xmlFileDesc) throws DOMException {
- Element options = document.createElement("options"); //$NON-NLS-1$
- xmlFileDesc.appendChild(options);
- options.setAttribute("reviewSynchronize", "" + exportData.isReviewSynchronize()); //$NON-NLS-1$//$NON-NLS-2$
- options.setAttribute("overWriteExistingFiles", "" + exportData.isOverWriteExistingFiles()); //$NON-NLS-1$ //$NON-NLS-2$
- options.setAttribute("createDirectoryStructure", "" + exportData.isCreateDirectoryStructure()); //$NON-NLS-1$ //$NON-NLS-2$
- options.setAttribute("createSelectedOnly", "" + exportData.isCreateSelectionOnly()); //$NON-NLS-1$ //$NON-NLS-2$
- options.setAttribute("saveSettings", "" + exportData.isSaveSettings()); //$NON-NLS-1$ //$NON-NLS-2$
- options.setAttribute("descriptionFilePath", "" + exportData.getDescriptionFilePath()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- private void xmlWriteSelectedElements(RemoteFileExportData exportData, Document document, Element xmlFileDesc) throws DOMException {
- Element selectedElements = document.createElement("selectedElements"); //$NON-NLS-1$
- xmlFileDesc.appendChild(selectedElements);
- List elements = exportData.getElements();
- Iterator iter = elements.iterator();
- while (iter.hasNext()) {
- Object element = iter.next();
- if (element instanceof IResource) {
- add((IResource) element, selectedElements, document);
- }
- }
- }
-
- private void add(IResource resource, Element parent, Document document) {
- Element element = null;
- if (resource.getType() == IResource.PROJECT) {
- element = document.createElement("project"); //$NON-NLS-1$
- parent.appendChild(element);
- element.setAttribute("name", resource.getName()); //$NON-NLS-1$
- return;
- }
- if (resource.getType() == IResource.FILE) {
- element = document.createElement("file"); //$NON-NLS-1$
- } else if (resource.getType() == IResource.FOLDER) {
- element = document.createElement("folder"); //$NON-NLS-1$
- }
- if (element != null) {
- parent.appendChild(element);
- element.setAttribute("path", resource.getFullPath().toString()); //$NON-NLS-1$
- }
- }
-
- /**
- * @see org.eclipse.rse.internal.importexport.files.IRemoteFileExportDescriptionWriter#close()
- */
- public void close() throws CoreException {
- if (fOutputStream != null) {
- try {
- fOutputStream.close();
- } catch (IOException ex) {
- String message = (ex.getLocalizedMessage() != null ? ex.getLocalizedMessage() : ""); //$NON-NLS-1$
- throw new CoreException(new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getSymbolicName(), 0, message, ex));
- }
- }
- }
-
- /**
- * @see org.eclipse.rse.internal.importexport.files.IRemoteFileExportDescriptionWriter#getStatus()
- */
- public IStatus getStatus() {
- return new Status(IStatus.OK, RemoteImportExportPlugin.getDefault().getSymbolicName(), 0, "", null); //$NON-NLS-1$
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportFromProjectActionDelegate.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportFromProjectActionDelegate.java
deleted file mode 100644
index dae741cad..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportFromProjectActionDelegate.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.wizard.WizardDialog;
-
-/**
- * This class represents the action to bring up the remote file system export wizard
- * and export the contents of a project or projects to a remote folder.
- */
-public class RemoteFileExportFromProjectActionDelegate extends RemoteFileImportExportActionDelegate {
- /**
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action) {
- RemoteExportWizard wizard = new RemoteExportWizard();
- wizard.init(getWorkbench(), getSelection());
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.open();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportOperation.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportOperation.java
deleted file mode 100644
index 062fd99b3..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileExportOperation.java
+++ /dev/null
@@ -1,573 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
- * Martin Oberhuber (Wind River) - [189130] Move SystemIFileProperties from UI to Core
- * David McKnight (IBM) - [191479] refreshing destination directory after export
- * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.operation.ModalContext;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.SystemResourceChangeEvent;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.internal.importexport.RemoteImportExportPlugin;
-import org.eclipse.rse.internal.importexport.RemoteImportExportResources;
-import org.eclipse.rse.internal.importexport.RemoteImportExportUtil;
-import org.eclipse.rse.internal.importexport.SystemImportExportResources;
-import org.eclipse.rse.services.files.RemoteFileIOException;
-import org.eclipse.rse.services.files.RemoteFileSecurityException;
-import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.IOverwriteQuery;
-
-/**
- * Operation for exporting the contents of a resource to the local file system.
- */
-class RemoteFileExportOperation implements IRunnableWithProgress {
- private IHost conn;
- private IPath path;
- private IProgressMonitor monitor;
- private RemoteExporter exporter;
- private List resourcesToExport;
- private IOverwriteQuery overwriteCallback;
- private IResource resource;
- private List errorTable = new ArrayList(1);
- private RemoteFileExportData exportData;
- private boolean saveSettings;
- private String descriptionFilePath;
-
- private boolean reviewSynchronize = true;
-
- // the constants for the overwrite 3 state
- private static final int OVERWRITE_NOT_SET = 0;
- private static final int OVERWRITE_NONE = 1;
- private static final int OVERWRITE_ALL = 2;
- private int overwriteState = OVERWRITE_NOT_SET;
- private boolean createLeadupStructure = true;
- private boolean createContainerDirectories = true;
-
- /**
- * Create an instance of this class. Use this constructor if you wish to
- * export specific resources with a common parent resource (affects container
- * directory creation).
- */
- private RemoteFileExportOperation(IHost conn, IResource resource, List resources, String destinationPath, IOverwriteQuery overwriteImplementor) {
- this.conn = conn;
- this.resource = resource;
- this.resourcesToExport = resources;
- this.path = new Path(destinationPath);
- this.overwriteCallback = overwriteImplementor;
- this.exporter = new RemoteExporter(conn);
- }
-
- public RemoteFileExportOperation(RemoteFileExportData data, IOverwriteQuery overwriteImplementor) {
- this(Utilities.parseForSystemConnection(data.getDestination()), null, data.getElements(), Utilities.parseForPath(data.getDestination()), overwriteImplementor);
- this.exportData = data;
- this.saveSettings = data.isSaveSettings();
- this.descriptionFilePath = data.getDescriptionFilePath();
- setCreateLeadupStructure(data.isCreateDirectoryStructure());
- setReviewSynchronize(data.isReviewSynchronize());
- setOverwriteFiles(data.isOverWriteExistingFiles());
- }
-
- /**
- * Add a new entry to the error table with the passed information
- */
- protected void addError(String message, Throwable e) {
- errorTable.add(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, message, e));
- }
-
- /**
- * Answer the total number of file resources that exist at or below self in the
- * resources hierarchy.
- *
- * @return int
- * @param resource org.eclipse.core.resources.IResource
- */
- protected int countChildrenOf(IResource resource) throws CoreException {
- if (resource.getType() == IResource.FILE) return 1;
- int count = 0;
- if (resource.isAccessible()) {
- IResource[] children = ((IContainer) resource).members();
- for (int i = 0; i < children.length; i++)
- count += countChildrenOf(children[i]);
- }
- return count;
- }
-
- /**
- * Answer a boolean indicating the number of file resources that were
- * specified for export
- *
- * @return int
- */
- protected int countSelectedResources() throws CoreException {
- int result = 0;
- Iterator resources = resourcesToExport.iterator();
- while (resources.hasNext())
- result += countChildrenOf((IResource) resources.next());
- return result;
- }
-
- /**
- * Create the directories required for exporting the passed resource,
- * based upon its container hierarchy
- *
- * @param resource org.eclipse.core.resources.IResource
- */
- protected void createLeadupDirectoriesFor(IResource resource) {
- IPath resourcePath = resource.getFullPath().removeLastSegments(1);
- for (int i = 0; i < resourcePath.segmentCount(); i++) {
- path = path.append(resourcePath.segment(i));
- exporter.createFolder(path);
- }
- }
-
- /**
- * Recursively export the previously-specified resource
- */
- protected void exportAllResources() throws InterruptedException {
- if (resource.getType() == IResource.FILE)
- exportFile((IFile) resource, path);
- else {
- try {
- exportChildren(((IContainer) resource).members(), path);
- } catch (CoreException e) {
- // not safe to show a dialog
- // should never happen because the file system export wizard ensures that the
- // single resource chosen for export is both existent and accessible
- errorTable.add(e);
- }
- }
- }
-
- /**
- * Export all of the resources contained in the passed collection
- *
- * @param children java.util.Enumeration
- * @param currentPath IPath
- */
- protected void exportChildren(IResource[] children, IPath currentPath) throws InterruptedException {
- for (int i = 0; i < children.length; i++) {
- IResource child = children[i];
- if (!child.isAccessible()) continue;
- if (child.getType() == IResource.FILE)
- exportFile((IFile) child, currentPath);
- else {
- IPath destination = currentPath.append(child.getName());
- try {
- exporter.createFolder(destination);
- } catch (Exception e) {
- String msg = NLS.bind(RemoteImportExportResources.FILEMSG_EXPORT_ERROR, destination, e.getLocalizedMessage() == null ? e.toString() : e.getMessage());
- errorTable.add(new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getBundle().getSymbolicName(), 0, msg, e));
- }
- try {
- exportChildren(((IContainer) child).members(), destination);
- } catch (CoreException e) {
- // not safe to show a dialog
- // should never happen because:
- // i. this method is called recursively iterating over the result of #members,
- // which only answers existing children
- // ii. there is an #isAccessible check done before #members is invoked
- errorTable.add(new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getBundle().getSymbolicName(), 0, e.getMessage(), e));
- //errorTable.add(e.getStatus());
- }
- }
- }
- }
-
- /**
- * Export the passed file to the specified location
- *
- * @param file org.eclipse.core.resources.IFile
- * @param location org.eclipse.core.runtime.IPath
- */
- protected void exportFile(IFile file, IPath location) throws InterruptedException {
- IPath fullPath = location.append(file.getName());
- String destination = fullPath.toString();
- // flag to indicate whether export is required
- boolean exportRequired = false;
- monitor.subTask(file.getFullPath().toString());
- String properPathString = fullPath.toOSString();
- File targetFile = null;
- if (conn == null) {
- targetFile = new File(properPathString);
- } else {
- try {
- targetFile = new UniFilePlus(Utilities.getIRemoteFile(conn, fullPath.toString()));
- } catch (NullPointerException e) {
- String msg = NLS.bind(RemoteImportExportResources.FILEMSG_EXPORT_ERROR, fullPath, RemoteImportExportResources.MSG_IMPORT_EXPORT_UNABLE_TO_USE_CONNECTION);
-
- // Assume that communication has failed.
- errorTable.add(new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getBundle().getSymbolicName(), 0, msg, e));
- throw e;
- }
- }
- if (targetFile.exists()) {
- exportRequired = isExportRequired(file, destination);
- // if export is not required, no need to do anything
- if (!exportRequired) {
- return;
- }
- if (!targetFile.canWrite()) {
- String msg = NLS.bind(RemoteImportExportResources.FILEMSG_NOT_WRITABLE, targetFile.getAbsolutePath());
- errorTable.add(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, msg, null));
- monitor.worked(1);
- return;
- }
- if (overwriteState == OVERWRITE_NONE) {
- return;
- } else if (overwriteState != OVERWRITE_ALL) {
- String overwriteAnswer = overwriteCallback.queryOverwrite(properPathString);
- if (overwriteAnswer.equals(IOverwriteQuery.CANCEL)) {
- throw new InterruptedException();
- } else if (overwriteAnswer.equals(IOverwriteQuery.NO)) {
- monitor.worked(1);
- return;
- } else if (overwriteAnswer.equals(IOverwriteQuery.NO_ALL)) {
- monitor.worked(1);
- overwriteState = OVERWRITE_NONE;
- return;
- } else if (overwriteAnswer.equals(IOverwriteQuery.ALL)) {
- overwriteState = OVERWRITE_ALL;
- }
- }
- } else if (!targetFile.exists()) {
- // need to do an export if target file does not exist, even if the local
- // file has not changed. This is for the scenario where a file may have been
- // exported, and the server copy was later deleted. The next export should put
- // the local copy back on the server, even if the local file was not changed.
- exportRequired = true;
- }
- try {
- exporter.write(file, fullPath);
- // if there are no exceptions, we should be here and the export should have completed fine
- // so we update the modification time at the time of export
- SystemIFileProperties props = new SystemIFileProperties(file);
- long modTime = file.getModificationStamp();
- props.setModificationStampAtExport(conn.getHostName(), destination, modTime);
- } catch (IOException e) {
- String msg = NLS.bind(RemoteImportExportResources.FILEMSG_EXPORT_ERROR, fullPath, e.getLocalizedMessage());
- errorTable.add(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, msg, e));
- } catch (CoreException e) {
- String msg = NLS.bind(RemoteImportExportResources.FILEMSG_EXPORT_ERROR, fullPath, e.getLocalizedMessage());
- errorTable.add(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, msg, e));
- } catch (RemoteFileIOException e) {
- String msg = NLS.bind(RemoteImportExportResources.FILEMSG_EXPORT_ERROR, fullPath, e.getLocalizedMessage());
- errorTable.add(new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getBundle().getSymbolicName(), 0, msg, e));
- } catch (RemoteFileSecurityException e) {
- String msg = NLS.bind(RemoteImportExportResources.FILEMSG_EXPORT_ERROR, fullPath, e.getLocalizedMessage());
- errorTable.add(new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getBundle().getSymbolicName(), 0, msg, e));
- } catch (Exception e) {
- String msg = NLS.bind(RemoteImportExportResources.FILEMSG_EXPORT_ERROR, fullPath, e.getLocalizedMessage());
- errorTable.add(new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, msg, e));
- }
- monitor.worked(1);
- ModalContext.checkCanceled(monitor);
- }
-
- protected boolean isExportRequired(IFile file, String destinationPath) {
- if (conn != null) {
- // get the host name of the connection
- String hostName = conn.getHostName();
- SystemIFileProperties props = new SystemIFileProperties(file);
- // check if we have a modification time stored for the hostname/destination path combination
- boolean hasModTime = props.hasModificationStampAtExport(hostName, destinationPath);
- // if not, that means we are exporting for the first time
- if (!hasModTime) {
- return true;
- }
- // otherwise, check if the modification time stored is different to the modification time
- // of the file
- else {
- long modTime = props.getModificationStampAtExport(hostName, destinationPath);
- long currentModTime = file.getModificationStamp();
- // if the modification timestamps are different, then the file has changed
- // since the last export to the destination, so we need export it again
- if (modTime != currentModTime) {
- return true;
- }
- // otherwise, do not export
- else {
- return false;
- }
- }
- }
- return true;
- }
-
- /**
- * Export the resources contained in the previously-defined
- * resourcesToExport collection
- */
- protected void exportSpecifiedResources() throws InterruptedException {
- Iterator resources = resourcesToExport.iterator();
- IPath initPath = (IPath) path.clone();
- while (resources.hasNext()) {
- IResource currentResource = (IResource) resources.next();
- if (!currentResource.isAccessible()) continue;
- path = initPath;
- if (resource == null) {
- // No root resource specified and creation of containment directories
- // is required. Create containers from depth 2 onwards (ie.- project's
- // child inclusive) for each resource being exported.
- if (createLeadupStructure) createLeadupDirectoriesFor(currentResource);
- } else {
- // Root resource specified. Must create containment directories
- // from this point onwards for each resource being exported
- IPath containersToCreate = currentResource.getFullPath().removeFirstSegments(resource.getFullPath().segmentCount()).removeLastSegments(1);
- for (int i = 0; i < containersToCreate.segmentCount(); i++) {
- path = path.append(containersToCreate.segment(i));
- exporter.createFolder(path);
- }
- }
- if (currentResource.getType() == IResource.FILE)
- exportFile((IFile) currentResource, path);
- else {
- if (createContainerDirectories) {
- path = path.append(currentResource.getName());
- exporter.createFolder(path);
- }
- try {
- exportChildren(((IContainer) currentResource).members(), path);
- } catch (CoreException e) {
- // should never happen because #isAccessible is called before #members is invoked,
- // which implicitly does an existence check
- errorTable.add(e.getStatus());
- }
- }
- }
- }
-
- /**
- * Returns the status of the export operation.
- * If there were any errors, the result is a status object containing
- * individual status objects for each error.
- * If there were no errors, the result is a status object with error code <code>OK</code>.
- *
- * @return the status
- */
- public IStatus getStatus() {
- IStatus[] errors = new IStatus[errorTable.size()];
- errorTable.toArray(errors);
- String msg = RemoteImportExportResources.FILEMSG_EXPORT_PROBLEMS;
- return new MultiStatus(PlatformUI.PLUGIN_ID, IStatus.OK, errors, msg, null);
- }
-
- /**
- * Answer a boolean indicating whether the passed child is a descendent
- * of one or more members of the passed resources collection
- *
- * @return boolean
- * @param resources java.util.List
- * @param child org.eclipse.core.resources.IResource
- */
- protected boolean isDescendent(List resources, IResource child) {
- if (child.getType() == IResource.PROJECT) return false;
- IResource parent = child.getParent();
- if (resources.contains(parent)) return true;
- return isDescendent(resources, parent);
- }
-
- /**
- * Export the resources that were previously specified for export
- * (or if a single resource was specified then export it recursively)
- */
- public void run(IProgressMonitor monitor) throws InterruptedException {
- this.monitor = monitor;
- IPath parentPath = (IPath)path.clone();
- if (resource != null) {
- if (createLeadupStructure) createLeadupDirectoriesFor(resource);
- if (createContainerDirectories && resource.getType() != IResource.FILE) { // ensure it's a container
- path = path.append(resource.getName());
- exporter.createFolder(path);
- }
- }
- try {
- int totalWork = IProgressMonitor.UNKNOWN;
- try {
- if (resourcesToExport == null)
- totalWork = countChildrenOf(resource);
- else
- totalWork = countSelectedResources();
- } catch (CoreException e) {
- // Should not happen
- errorTable.add(e.getStatus());
- }
- String taskMsg = SystemImportExportResources.RESID_FILEEXPORT_EXPORTING;
- monitor.beginTask(taskMsg, totalWork);
- if (resourcesToExport == null) {
- exportAllResources();
- } else {
- exportSpecifiedResources();
- }
-
- // fire event to update RSE
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
- IRemoteFile destination = getRemoteFile(conn, parentPath);
-
- sr.fireEvent(new SystemResourceChangeEvent(destination, ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE, null));
-
- if (saveSettings) {
- try {
- saveDescription();
- } catch (CoreException e) {
- SystemBasePlugin.logError("Error occured trying to save description " + descriptionFilePath, e); //$NON-NLS-1$
- errorTable.add(e.getStatus());
- } catch (IOException e) {
- SystemBasePlugin.logError("Error occured trying to save description " + descriptionFilePath, e); //$NON-NLS-1$
- errorTable.add(new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getSymbolicName(), 0, e.getLocalizedMessage(), e));
- }
- }
- } finally {
- monitor.done();
- }
- }
-
- private IRemoteFile getRemoteFile(IHost conn, IPath path)
- {
- return Utilities.getIRemoteFile(conn, path.toString());
- }
-
- /**
- * Saves a description file for the export.
- * @throws CoreException if an unexpected exception occurs.
- * @throws IOException if an I/O error occurs.
- */
- protected void saveDescription() throws CoreException, IOException {
- ByteArrayOutputStream objectStreamOutput = new ByteArrayOutputStream();
- IRemoteFileExportDescriptionWriter writer = exportData.createExportDescriptionWriter(objectStreamOutput);
- ByteArrayInputStream fileInput = null;
- try {
- writer.write(exportData);
- fileInput = new ByteArrayInputStream(objectStreamOutput.toByteArray());
- IFile descriptionFile = exportData.getDescriptionFile();
- // check if resource exists
- if (descriptionFile.isAccessible()) {
- descriptionFile.setContents(fileInput, true, true, null);
- }
- // if resource does not exist
- else {
- // now have to check if a variant of this file exists (i.e. whether a file exists
- // that has the same path with a different case. For case insensitive file systems
- // such as Windows, this is needed since we can't simply create a file with a different
- // case. Note that isAccessible() above does not check for file paths with different case,
- // so we have to check it explicitly).
- IResource variant = RemoteImportExportUtil.getInstance().findExistingResourceVariant(descriptionFile.getFullPath());
- // if a variant was not found, create the new file
- if (variant == null) {
- // check if a variant of the parent exists
- // we need to do this because at this point we know that the file path does not
- // exist, and neither does its variant. However, it is possible that the parent path
- // has a variant, in which case calling create on the description file with
- // the path as it is given will fail. We need to get the variant path of the parent,
- // append the name of the file to the variant path, and create a file with that path.
- // get parent
- IResource parent = descriptionFile.getParent();
- if (parent != null) {
- // get parent path
- IResource parentVariant = RemoteImportExportUtil.getInstance().findExistingResourceVariant(parent.getFullPath());
- // no parent variant (i.e. in a case sensitive file system)
- if (parentVariant == null) {
- descriptionFile.create(fileInput, true, null);
- }
- // parent variant found (might be same as original parent path)
- else {
- IPath newPath = parentVariant.getFullPath().append(descriptionFile.getName());
- IFile newDescriptionFile = SystemBasePlugin.getWorkspace().getRoot().getFile(newPath);
- newDescriptionFile.create(fileInput, true, null);
- }
- }
- }
- // otherwise, simply set the contents of the variant file
- else {
- if (variant instanceof IFile) {
- ((IFile) variant).setContents(fileInput, true, true, null);
- }
- }
- }
- } finally {
- if (fileInput != null) {
- fileInput.close();
- }
- if (writer != null) {
- writer.close();
- }
- }
- }
-
- /**
- * Set this boolean indicating whether a directory should be created for
- * Folder resources that are explicitly passed for export
- *
- * @param value boolean
- */
- public void setCreateContainerDirectories(boolean value) {
- createContainerDirectories = value;
- }
-
- /**
- * Set this boolean indicating whether each exported resource's complete path should
- * include containment hierarchies as dictated by its parents
- *
- * @param value boolean
- */
- public void setCreateLeadupStructure(boolean value) {
- createLeadupStructure = value;
- }
-
- /**
- * Set this boolean indicating whether exported resources should automatically
- * overwrite existing files when a conflict occurs
- *
- * @param value boolean
- */
- public void setOverwriteFiles(boolean value) {
- if (value) {
- overwriteState = OVERWRITE_ALL;
- }
- }
-
- /**
- * Set this boolean indicating whether exported resources should automatically
- * be reviewed/synchronized
- *
- * @param value boolean
- */
- public void setReviewSynchronize(boolean value) {
- reviewSynchronize = value;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportActionDelegate.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportActionDelegate.java
deleted file mode 100644
index 1abb83c4b..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportActionDelegate.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
- * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
- * David McKnight (IBM) - [216252] MessageFormat.format -> NLS.bind
- * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
- * Takuya Miyamoto - [185925] Integrate Platform/Team Synchronization
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.internal.importexport.RemoteImportExportPlugin;
-import org.eclipse.rse.internal.importexport.RemoteImportExportProblemDialog;
-import org.eclipse.rse.internal.importexport.RemoteImportExportResources;
-import org.eclipse.rse.internal.synchronize.SynchronizeData;
-import org.eclipse.rse.internal.synchronize.provisional.ISynchronizeOperation;
-import org.eclipse.rse.internal.synchronize.provisional.SynchronizeOperation;
-import org.eclipse.rse.internal.synchronize.provisional.Synchronizer;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-
-/**
- * This class is a remote file import action.
- */
-public class RemoteFileImportActionDelegate extends RemoteFileImportExportActionDelegate {
- /**
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action) {
- IFile[] descriptions = getDescriptionFiles(getSelection());
- MultiStatus mergedStatus;
- int length = descriptions.length;
- if (length < 1) {
- return;
- }
- // create read multi status
- String message;
- if (length > 1) {
- message = RemoteImportExportResources.IMPORT_EXPORT_ERROR_CREATE_FILES_FAILED;
- } else {
- message = RemoteImportExportResources.IMPORT_EXPORT_ERROR_CREATE_FILE_FAILED;
- }
- MultiStatus readStatus = new MultiStatus(RemoteImportExportPlugin.getDefault().getSymbolicName(), 0, message, null);
- RemoteFileImportData[] importDatas = readImportDatas(descriptions, readStatus);
- if (importDatas.length > 0) {
- IStatus status = importFiles(importDatas);
- if (status == null) {
- return;
- }
- if (readStatus.getSeverity() == IStatus.ERROR) {
- message = readStatus.getMessage();
- } else {
- message = status.getMessage();
- }
- // create new status because we want another message - no API to set message
- mergedStatus = new MultiStatus(RemoteImportExportPlugin.getDefault().getSymbolicName(), status.getCode(), readStatus.getChildren(), message, null);
- mergedStatus.merge(status);
- } else {
- mergedStatus = readStatus;
- }
- if (!mergedStatus.isOK()) {
- RemoteImportExportProblemDialog.open(getShell(), RemoteImportExportResources.IMPORT_EXPORT_IMPORT_ACTION_DELEGATE_TITLE, null, mergedStatus);
- }
- }
-
- private RemoteFileImportData[] readImportDatas(IFile[] descriptions, MultiStatus readStatus) {
- List importDataList = new ArrayList(descriptions.length);
- for (int i = 0; i < descriptions.length; i++) {
- RemoteFileImportData importData = readImportData(descriptions[i], readStatus);
- if (importData != null) {
- importDataList.add(importData);
- }
- }
- return (RemoteFileImportData[]) importDataList.toArray(new RemoteFileImportData[importDataList.size()]);
- }
-
- /**
- * Reads the file import data from a file.
- */
- protected RemoteFileImportData readImportData(IFile description, MultiStatus readStatus) {
- Assert.isLegal(description.isAccessible());
- Assert.isNotNull(description.getFileExtension());
- Assert.isLegal(description.getFileExtension().equals(Utilities.IMPORT_DESCRIPTION_EXTENSION));
- RemoteFileImportData importData = new RemoteFileImportData();
- IRemoteFileImportDescriptionReader reader = null;
- try {
- reader = importData.createImportDescriptionReader(description.getContents());
- // read export data
- reader.read(importData);
- // do not save settings again
- importData.setSaveSettings(false);
- } catch (CoreException ex) {
- String message = NLS.bind(RemoteImportExportResources.IMPORT_EXPORT_ERROR_DESCRIPTION_READ, description.getFullPath(), ex.getStatus().getMessage());
- addToStatus(readStatus, message, ex);
- return null;
- } finally {
- if (reader != null) {
- readStatus.addAll(reader.getStatus());
- }
- try {
- if (reader != null) {
- reader.close();
- }
- } catch (CoreException ex) {
- String message = NLS.bind(RemoteImportExportResources.IMPORT_EXPORT_ERROR_DESCRIPTION_CLOSE, description.getFullPath());
- addToStatus(readStatus, message, ex);
- }
- }
- return importData;
- }
-
- private IStatus importFiles(RemoteFileImportData[] importDatas) {
-// IStatus status = null;
-// for (int i = 0; i < importDatas.length; i++) {
-// RemoteFileImportOperation op = new RemoteFileImportOperation(importDatas[i], FileSystemStructureProvider.INSTANCE, new RemoteFileOverwriteQuery());
-// try {
-// PlatformUI.getWorkbench().getProgressService().run(true, true, op);
-// status = op.getStatus();
-// } catch (InvocationTargetException e) {
-// SystemBasePlugin.logError("Error occured trying to import", e); //$NON-NLS-1$
-// status = new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getBundle().getSymbolicName(), 0, "", e); //$NON-NLS-1$
-// } catch (InterruptedException e) {
-// SystemBasePlugin.logError("Error occured trying to import", e); //$NON-NLS-1$
-// status = new Status(IStatus.OK, RemoteImportExportPlugin.getDefault().getBundle().getSymbolicName(), 0, "", e); //$NON-NLS-1$
-// }
-// if (!status.isOK()) {
-// String msgTxt = NLS.bind(RemoteImportExportResources.FILEMSG_IMPORT_FAILED, status);
-// Throwable e = status.getException();
-// SystemMessage msg = null;
-// if (e != null){
-// msg = new SimpleSystemMessage(RemoteImportExportPlugin.PLUGIN_ID,
-// IRemoteImportExportConstants.FILEMSG_IMPORT_FAILED,
-// IStatus.ERROR, msgTxt, e);
-// } else {
-// msg = new SimpleSystemMessage(RemoteImportExportPlugin.PLUGIN_ID,
-// IRemoteImportExportConstants.FILEMSG_IMPORT_FAILED,
-// IStatus.ERROR, msgTxt);
-// }
-//
-// SystemMessageDialog dlg = new SystemMessageDialog(getShell(), msg);
-// dlg.openWithDetails();
-// return null;
-// }
-// }
-// return null;
-
- for (int i = 0; i < importDatas.length; i++) {
- try {
- SynchronizeData data = new SynchronizeData(importDatas[i]);
- data.setSynchronizeType(ISynchronizeOperation.SYNC_MODE_UI_REVIEW);
- new Synchronizer(data).run(new SynchronizeOperation());
- } catch (SystemMessageException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- return null;
- }
-
- protected void addToStatus(MultiStatus multiStatus, String defaultMessage, CoreException ex) {
- IStatus status = ex.getStatus();
- String message = ex.getLocalizedMessage();
- if (message == null || message.length() < 1) {
- status = new Status(status.getSeverity(), status.getPlugin(), status.getCode(), defaultMessage, ex);
- }
- multiStatus.add(status);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportData.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportData.java
deleted file mode 100644
index f5698fac1..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportData.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.rse.ui.SystemBasePlugin;
-
-/**
- * Holds data of what to import.
- */
-public class RemoteFileImportData {
- private IPath containerPath;
- private Object source;
- private boolean overWriteExistingFiles;
- private boolean createDirectoryStructure;
- private boolean createSelectionOnly;
- private boolean saveSettings;
- private String descriptionFilePath;
- // import elements
- private HashMap map;
- private List elements;
-
- private boolean reviewSynchronize;
-
- /**
- * Constructor.
- */
- public RemoteFileImportData() {
- setContainerPath(null);
- setSource(null);
- setOverWriteExistingFiles(false);
- setCreateDirectoryStructure(false);
- setCreateSelectionOnly(true);
- setSaveSettings(false);
- setDescriptionFilePath(null);
- }
-
- /**
- * @return Returns the descriptionFilePath.
- */
- public String getDescriptionFilePath() {
- return descriptionFilePath;
- }
-
- /**
- * Gets the description file as a workspace resource.
- * @return a file representing the description file.
- */
- public IFile getDescriptionFile() {
- IPath path = new Path(getDescriptionFilePath());
- if (path.isValidPath(path.toString()) && path.segmentCount() >= 2) {
- return SystemBasePlugin.getWorkspace().getRoot().getFile(path);
- } else {
- return null;
- }
- }
-
- /**
- * @param descriptionFilePath The descriptionFilePath to set.
- */
- public void setDescriptionFilePath(String descriptionFilePath) {
- this.descriptionFilePath = descriptionFilePath;
- }
-
- /**
- * @return returns container path.
- */
- public IPath getContainerPath() {
- return containerPath;
- }
-
- /**
- * @param containerPath the container path.
- */
- public void setContainerPath(IPath containerPath) {
- this.containerPath = containerPath;
- }
-
- /**
- * Gets the source.
- * @return the source from which to import.
- */
- public Object getSource() {
- return source;
- }
-
- /**
- * Sets the source.
- * @param source the source from which to import.
- */
- public void setSource(Object source) {
- this.source = source;
- }
-
- /**
- * Returns the elements to be imported.
- * @return the elements.
- */
- public List getElements() {
- return elements;
- }
-
- /**
- * Sets the elements to imported.
- * @param elements the elements.
- */
- public void setElements(List elements) {
- this.elements = elements;
- }
-
- /**
- * Add to the list of files to import.
- * @param object the file object.
- */
- public void addToList(UniFilePlus object) {
- if (map == null) {
- map = new HashMap();
- }
- // add to map
- map.put(object.getAbsolutePath(), object);
- }
-
- /**
- * Does the file exist.
- * @param object the file object.
- * @return <code>true</code> of the
- */
- public boolean doesExist(UniFilePlus object) {
- if (map.get(object.getAbsolutePath()) == null) {
- return false;
- } else {
- return true;
- }
- }
-
- /**
- * @return Returns the overWriteExistingFiles.
- */
- public boolean isOverWriteExistingFiles() {
- return overWriteExistingFiles;
- }
-
- /**
- * @param overWriteExistingFiles The overWriteExistingFiles to set.
- */
- public void setOverWriteExistingFiles(boolean overWriteExistingFiles) {
- this.overWriteExistingFiles = overWriteExistingFiles;
- }
-
- public boolean isReviewSynchronize(){
- return reviewSynchronize;
- }
-
- public void setReviewSynchronize(boolean reviewSynchronize){
- this.reviewSynchronize = reviewSynchronize;
- }
-
- /**
- * @return Returns the saveSettings.
- */
- public boolean isSaveSettings() {
- return saveSettings;
- }
-
- /**
- * @param saveSettings The saveSettings to set.
- */
- public void setSaveSettings(boolean saveSettings) {
- this.saveSettings = saveSettings;
- }
-
- /**
- * @return Returns the createDirectoryStructure.
- */
- public boolean isCreateDirectoryStructure() {
- return createDirectoryStructure;
- }
-
- /**
- * @param createDirectoryStructure The createDirectoryStructure to set.
- */
- public void setCreateDirectoryStructure(boolean createDirectoryStructure) {
- this.createDirectoryStructure = createDirectoryStructure;
- }
-
- /**
- * @return Returns the createSelectionOnly.
- */
- public boolean isCreateSelectionOnly() {
- return createSelectionOnly;
- }
-
- /**
- * @param createSelectionOnly The createSelectionOnly to set.
- */
- public void setCreateSelectionOnly(boolean createSelectionOnly) {
- this.createSelectionOnly = createSelectionOnly;
- }
-
- /**
- * Creates and returns an import description writer.
- */
- public IRemoteFileImportDescriptionWriter createImportDescriptionWriter(OutputStream outputStream) {
- return new RemoteFileImportDescriptionWriter(outputStream);
- }
-
- /**
- * Creates and returns an import description writer.
- */
- public IRemoteFileImportDescriptionReader createImportDescriptionReader(InputStream inputStream) {
- return new RemoteFileImportDescriptionReader(inputStream);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportDescriptionReader.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportDescriptionReader.java
deleted file mode 100644
index 9a806aec3..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportDescriptionReader.java
+++ /dev/null
@@ -1,202 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.rse.internal.importexport.RemoteImportExportPlugin;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * Remote file import description reader.
- */
-public class RemoteFileImportDescriptionReader implements IRemoteFileImportDescriptionReader {
- protected InputStream fInputStream;
- protected IRemoteFileSubSystem subsystem;
-
- /**
- * Constructor.
- */
- public RemoteFileImportDescriptionReader(InputStream inputStream) {
- Assert.isNotNull(inputStream);
- fInputStream = new BufferedInputStream(inputStream);
- }
-
- /**
- * @see org.eclipse.rse.internal.importexport.files.IRemoteFileImportDescriptionReader#read(org.eclipse.rse.internal.importexport.files.RemoteFileImportData)
- */
- public void read(RemoteFileImportData importData) throws CoreException {
- try {
- readXML(importData);
- } catch (IOException ex) {
- String message = (ex.getLocalizedMessage() != null ? ex.getLocalizedMessage() : ""); //$NON-NLS-1$
- throw new CoreException(new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getSymbolicName(), 0, message, ex));
- } catch (SAXException ex) {
- String message = (ex.getLocalizedMessage() != null ? ex.getLocalizedMessage() : ""); //$NON-NLS-1$
- throw new CoreException(new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getSymbolicName(), 0, message, ex));
- }
- }
-
- public RemoteFileImportData readXML(RemoteFileImportData importData) throws IOException, SAXException {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setValidating(false);
- DocumentBuilder parser = null;
- try {
- parser = factory.newDocumentBuilder();
- } catch (ParserConfigurationException ex) {
- throw new IOException(ex.getLocalizedMessage());
- }
- Element xmlFileDesc = parser.parse(new InputSource(fInputStream)).getDocumentElement();
- if (!xmlFileDesc.getNodeName().equals(Utilities.IMPORT_DESCRIPTION_EXTENSION)) {
- throw new IOException();
- }
- NodeList topLevelElements = xmlFileDesc.getChildNodes();
- for (int i = 0; i < topLevelElements.getLength(); i++) {
- Node node = topLevelElements.item(i);
- if (node.getNodeType() != Node.ELEMENT_NODE) continue;
- Element element = (Element) node;
- xmlReadDestinationLocation(importData, element);
- xmlReadOptions(importData, element);
- xmlReadSourceLocation(importData, element);
- xmlReadSelectedElements(importData, element);
- }
- return importData;
- }
-
- private void xmlReadDestinationLocation(RemoteFileImportData importData, Element element) {
- if (element.getNodeName().equals("destination")) { //$NON-NLS-1$
- String destinationPath = element.getAttribute("path"); //$NON-NLS-1$
- importData.setContainerPath(new Path(destinationPath));
- }
- }
-
- private void xmlReadOptions(RemoteFileImportData importData, Element element) throws IOException {
- if (element.getNodeName().equals("options")) { //$NON-NLS-1$
- try {
- importData.setReviewSynchronize(getBooleanAttribute(element, "reviewSynchronize")); //$NON-NLS-1$
- }
- catch (IOException e){
- // this is a new option so if we're reading an older config file, this attribute doesn't exist
- importData.setReviewSynchronize(false);
- }
- importData.setOverWriteExistingFiles(getBooleanAttribute(element, "overWriteExistingFiles")); //$NON-NLS-1$
- importData.setCreateDirectoryStructure(getBooleanAttribute(element, "createDirectoryStructure")); //$NON-NLS-1$
- importData.setCreateSelectionOnly(getBooleanAttribute(element, "createSelectedOnly")); //$NON-NLS-1$
- importData.setSaveSettings(getBooleanAttribute(element, "saveSettings")); //$NON-NLS-1$
- importData.setDescriptionFilePath(element.getAttribute("descriptionFilePath")); //$NON-NLS-1$
- }
- }
-
- private void xmlReadSourceLocation(RemoteFileImportData importData, Element element) {
- if (element.getNodeName().equals("source")) { //$NON-NLS-1$
- String sourceCanonicalPath = element.getAttribute("path"); //$NON-NLS-1$
- IRemoteFile remoteFile = Utilities.parseForIRemoteFile(sourceCanonicalPath);
- UniFilePlus file = new UniFilePlus(remoteFile);
- importData.setSource(file);
- subsystem = remoteFile.getParentRemoteFileSubSystem();
- }
- }
-
- private void xmlReadSelectedElements(RemoteFileImportData importData, Element element) throws IOException {
- if (element.getNodeName().equals("selectedElements")) { //$NON-NLS-1$
- NodeList selectedElements = element.getChildNodes();
- List elementsToImport = new ArrayList(selectedElements.getLength());
- for (int j = 0; j < selectedElements.getLength(); j++) {
- Node selectedNode = selectedElements.item(j);
- if (selectedNode.getNodeType() != Node.ELEMENT_NODE) {
- continue;
- }
- Element selectedElement = (Element) selectedNode;
- if (selectedElement.getNodeName().equals("file")) { //$NON-NLS-1$
- addResource(importData, elementsToImport, selectedElement);
- } else if (selectedElement.getNodeName().equals("folder")) { //$NON-NLS-1$
- addResource(importData, elementsToImport, selectedElement);
- }
- }
- importData.setElements(elementsToImport);
- }
- }
-
- private void addResource(RemoteFileImportData importData, List selectedElements, Element element) throws IOException {
- String path = element.getAttribute("path"); //$NON-NLS-1$
- if (path != null && subsystem != null) {
- IRemoteFile remoteFile = null;
- try {
- remoteFile = subsystem.getRemoteFileObject(path, new NullProgressMonitor());
- if (remoteFile != null && remoteFile.exists()) {
- UniFilePlus file = new UniFilePlus(remoteFile);
- selectedElements.add(file);
- // add to list of import data
- importData.addToList(file);
- }
- } catch (SystemMessageException e) {
- SystemBasePlugin.logError("Error occured trying to retrieve file " + path, e); //$NON-NLS-1$
- }
- }
- }
-
- protected boolean getBooleanAttribute(Element element, String name) throws IOException {
- String value = element.getAttribute(name);
- if (value != null && value.equalsIgnoreCase("true")) { //$NON-NLS-1$
- return true;
- }
- if (value != null && value.equalsIgnoreCase("false")) { //$NON-NLS-1$
- return false;
- }
- throw new IOException();
- }
-
- /**
- * @see org.eclipse.rse.internal.importexport.files.IRemoteFileImportDescriptionReader#close()
- */
- public void close() throws CoreException {
- if (fInputStream != null) {
- try {
- fInputStream.close();
- subsystem = null;
- } catch (IOException ex) {
- String message = (ex.getLocalizedMessage() != null ? ex.getLocalizedMessage() : ""); //$NON-NLS-1$
- throw new CoreException(new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getSymbolicName(), 0, message, ex));
- }
- }
- }
-
- /**
- * @see org.eclipse.rse.internal.importexport.files.IRemoteFileImportDescriptionReader#getStatus()
- */
- public IStatus getStatus() {
- return new Status(IStatus.OK, RemoteImportExportPlugin.getDefault().getSymbolicName(), 0, "", null); //$NON-NLS-1$
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportDescriptionWriter.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportDescriptionWriter.java
deleted file mode 100644
index f799c8eb3..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportDescriptionWriter.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import java.io.BufferedOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.rse.internal.importexport.RemoteImportExportPlugin;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * Remote file import description writer.
- */
-public class RemoteFileImportDescriptionWriter implements IRemoteFileImportDescriptionWriter {
- protected OutputStream fOutputStream;
-
- /**
- * Constructor.
- */
- public RemoteFileImportDescriptionWriter(OutputStream outputStream) {
- Assert.isNotNull(outputStream);
- fOutputStream = new BufferedOutputStream(outputStream);
- }
-
- /**
- * @see org.eclipse.rse.internal.importexport.files.IRemoteFileImportDescriptionWriter#write(org.eclipse.rse.internal.importexport.files.RemoteFileImportData)
- */
- public void write(RemoteFileImportData importData) throws CoreException {
- try {
- writeXML(importData);
- } catch (IOException ex) {
- String message = (ex.getLocalizedMessage() != null ? ex.getLocalizedMessage() : ""); //$NON-NLS-1$
- throw new CoreException(new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getSymbolicName(), 0, message, ex));
- }
- }
-
- /**
- * Writes a XML representation of file import data.
- * @exception IOException if writing to the underlying stream fails.
- */
- public void writeXML(RemoteFileImportData importData) throws IOException {
- Assert.isNotNull(importData);
- DocumentBuilder docBuilder = null;
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setValidating(false);
- try {
- docBuilder = factory.newDocumentBuilder();
- } catch (ParserConfigurationException ex) {
- throw new IOException(ex.getLocalizedMessage());
- }
- Document document = docBuilder.newDocument();
- // create the document
- Element xmlFileDesc = document.createElement(Utilities.IMPORT_DESCRIPTION_EXTENSION);
- document.appendChild(xmlFileDesc);
- xmlWriteDestinationLocation(importData, document, xmlFileDesc);
- xmlWriteOptions(importData, document, xmlFileDesc);
- xmlWriteSourceLocation(importData, document, xmlFileDesc);
- xmlWriteSelectedElements(importData, document, xmlFileDesc);
- try {
- // write the document to the stream
- Transformer transformer = TransformerFactory.newInstance().newTransformer();
- transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
- transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$
- transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
- transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); //$NON-NLS-1$ //$NON-NLS-2$
- DOMSource source = new DOMSource(document);
- StreamResult result = new StreamResult(fOutputStream);
- transformer.transform(source, result);
- } catch (TransformerException e) {
- throw new IOException(e.getLocalizedMessage());
- }
- }
-
- private void xmlWriteDestinationLocation(RemoteFileImportData importData, Document document, Element xmlFileDesc) throws DOMException {
- Element destination = document.createElement("destination"); //$NON-NLS-1$
- xmlFileDesc.appendChild(destination);
- destination.setAttribute("path", importData.getContainerPath().toString()); //$NON-NLS-1$
- }
-
- private void xmlWriteOptions(RemoteFileImportData importData, Document document, Element xmlFileDesc) throws DOMException {
- Element options = document.createElement("options"); //$NON-NLS-1$
- xmlFileDesc.appendChild(options);
- options.setAttribute("reviewSynchronize", "" + importData.isReviewSynchronize()); //$NON-NLS-1$ //$NON-NLS-2$
- options.setAttribute("overWriteExistingFiles", "" + importData.isOverWriteExistingFiles()); //$NON-NLS-1$ //$NON-NLS-2$
- options.setAttribute("createDirectoryStructure", "" + importData.isCreateDirectoryStructure()); //$NON-NLS-1$ //$NON-NLS-2$
- options.setAttribute("createSelectedOnly", "" + importData.isCreateSelectionOnly()); //$NON-NLS-1$ //$NON-NLS-2$
- options.setAttribute("saveSettings", "" + importData.isSaveSettings()); //$NON-NLS-1$ //$NON-NLS-2$
- options.setAttribute("descriptionFilePath", "" + importData.getDescriptionFilePath()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- private void xmlWriteSourceLocation(RemoteFileImportData importData, Document document, Element xmlFileDesc) throws DOMException {
- Element source = document.createElement("source"); //$NON-NLS-1$
- xmlFileDesc.appendChild(source);
- UniFilePlus sourceResource = (UniFilePlus) (importData.getSource());
- // save path along with profile and connection name
- source.setAttribute("path", sourceResource.getCanonicalPath()); //$NON-NLS-1$
- }
-
- private void xmlWriteSelectedElements(RemoteFileImportData exportData, Document document, Element xmlFileDesc) throws DOMException {
- Element selectedElements = document.createElement("selectedElements"); //$NON-NLS-1$
- xmlFileDesc.appendChild(selectedElements);
- List elements = exportData.getElements();
- Iterator iter = elements.iterator();
- while (iter.hasNext()) {
- Object element = iter.next();
- if (element instanceof UniFilePlus) {
- add((UniFilePlus) element, selectedElements, document);
- }
- }
- }
-
- private void add(UniFilePlus resource, Element parent, Document document) {
- Element element = null;
- if (resource.isFile()) {
- element = document.createElement("file"); //$NON-NLS-1$
- } else if (resource.isDirectory()) {
- element = document.createElement("folder"); //$NON-NLS-1$
- }
- if (element != null) {
- parent.appendChild(element);
- element.setAttribute("path", resource.getAbsolutePath()); //$NON-NLS-1$
- }
- }
-
- /**
- * @see org.eclipse.rse.internal.importexport.files.IRemoteFileImportDescriptionWriter#close()
- */
- public void close() throws CoreException {
- if (fOutputStream != null) {
- try {
- fOutputStream.close();
- } catch (IOException ex) {
- String message = (ex.getLocalizedMessage() != null ? ex.getLocalizedMessage() : ""); //$NON-NLS-1$
- throw new CoreException(new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getSymbolicName(), 0, message, ex));
- }
- }
- }
-
- /**
- * @see org.eclipse.rse.internal.importexport.files.IRemoteFileImportDescriptionWriter#getStatus()
- */
- public IStatus getStatus() {
- return new Status(IStatus.OK, RemoteImportExportPlugin.getDefault().getSymbolicName(), 0, "", null); //$NON-NLS-1$
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportExportActionDelegate.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportExportActionDelegate.java
deleted file mode 100644
index e9fe24e6a..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportExportActionDelegate.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IActionDelegate;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * This class is the super class of file import/export action delegate.
- */
-public abstract class RemoteFileImportExportActionDelegate implements IActionDelegate {
- protected IStructuredSelection fSelection;
-
- /**
- * Sets the selection. The selection is only set if given a structured selection, otherwise it is set to an
- * empty structured selection.
- * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- fSelection = (IStructuredSelection) selection;
- } else {
- fSelection = StructuredSelection.EMPTY;
- }
- }
-
- /**
- * Returns the remote file in the selection.
- * Use this method if this action allows only a single remote file selection.
- * @return the single remote file.
- */
- protected IRemoteFile getRemoteFile(IStructuredSelection selection) {
- return (IRemoteFile) selection.getFirstElement();
- }
-
- /**
- * Returns the remote files in the selection.
- * Use this method if this action allows multiple remote file selection.
- * @return an array of remote files.
- */
- protected IRemoteFile[] getRemoteFiles(IStructuredSelection selection) {
- IRemoteFile[] files = new IRemoteFile[selection.size()];
- Iterator iter = selection.iterator();
- int i = 0;
- while (iter.hasNext()) {
- files[i++] = (IRemoteFile) iter.next();
- }
- return files;
- }
-
- /**
- * Returns the description file for the first description file in
- * the selection. Use this method if this action allows only
- * a single file selection.
- * @return the single description file.
- */
- protected IFile getDescriptionFile(IStructuredSelection selection) {
- return (IFile) selection.getFirstElement();
- }
-
- /**
- * Returns a description file for each description file in
- * the selection. Use this method if this action allows multiple
- * selection.
- * @return an array of description files.
- */
- protected IFile[] getDescriptionFiles(IStructuredSelection selection) {
- IFile[] files = new IFile[selection.size()];
- Iterator iter = selection.iterator();
- int i = 0;
- while (iter.hasNext()) {
- files[i++] = (IFile) iter.next();
- }
- return files;
- }
-
- /**
- * Returns the workbench.
- * @return the workbench.
- */
- protected IWorkbench getWorkbench() {
- return PlatformUI.getWorkbench();
- }
-
- /**
- * Returns the active shell.
- * @return the active shell.
- */
- protected Shell getShell() {
- return Display.getDefault().getActiveShell();
- }
-
- /**
- * Returns the selection.
- * @return the selection.
- */
- protected IStructuredSelection getSelection() {
- return fSelection;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportOperation.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportOperation.java
deleted file mode 100644
index 31303f2f2..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportOperation.java
+++ /dev/null
@@ -1,707 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
- * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
- * David McKnight (IBM) - [223204] [cleanup] fix broken nls strings in files.ui and others
- * David McKnight (IBM) - [229610] [api] File transfers should use workspace text file encoding
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- * David McKnight (IBM) - [276535] File Conflict when Importing Remote Folder with Case-Differentiated-Only Filenames into Project
- * David McKnight (IBM) - [191558] [importexport][efs] Import to Project doesn't work with remote EFS projects
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.internal.files.ui.FileResources;
-import org.eclipse.rse.internal.importexport.RemoteImportExportPlugin;
-import org.eclipse.rse.internal.importexport.RemoteImportExportResources;
-import org.eclipse.rse.internal.importexport.RemoteImportExportUtil;
-import org.eclipse.rse.internal.importexport.SystemImportExportResources;
-import org.eclipse.rse.services.files.RemoteFileIOException;
-import org.eclipse.rse.services.files.RemoteFileSecurityException;
-import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.dialogs.ContainerGenerator;
-import org.eclipse.ui.dialogs.IOverwriteQuery;
-// Similar to org.eclipse.ui.wizards.datatransfer.ImportOperation
-/**
- * An operation which does the actual work of copying objects from the local
- * file system into the workspace.
- *
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class RemoteFileImportOperation extends WorkspaceModifyOperation {
- private static final int POLICY_DEFAULT = 0;
- private static final int POLICY_SKIP_CHILDREN = 1;
- private static final int POLICY_FORCE_OVERWRITE = 2;
- private Object source;
- private IPath destinationPath;
- private IContainer destinationContainer;
- private List selectedFiles;
- private IImportStructureProvider provider;
- private IProgressMonitor monitor;
- protected IOverwriteQuery overwriteCallback;
- private List errorTable = new ArrayList();
- private boolean createContainerStructure = true;
- private RemoteFileImportData importData;
- private boolean saveSettings;
- private String descriptionFilePath;
- //The constants for the overwrite 3 state
- private static final int OVERWRITE_NOT_SET = 0;
- private static final int OVERWRITE_NONE = 1;
- private static final int OVERWRITE_ALL = 2;
- private int overwriteState = OVERWRITE_NOT_SET;
-
- private boolean reviewSynchronize = true;
-
- /**
- * Creates a new operation that recursively imports the entire contents of the
- * specified root file system object.
- * <p>
- * The <code>source</code> parameter represents the root file system object to
- * import. All contents of this object are imported. Valid types for this parameter
- * are determined by the supplied <code>IImportStructureProvider</code>.
- * </p>
- * <p>
- * The <code>provider</code> parameter allows this operation to deal with the
- * source object in an abstract way. This operation calls methods on the provider
- * and the provider in turn calls specific methods on the source object.
- * </p>
- * <p>
- * The default import behavior is to recreate the complete container structure
- * for the contents of the root file system object in their destination.
- * If <code>setCreateContainerStructure</code> is set to false then the container
- * structure created is relative to the root file system object.
- * </p>
- *
- * @param containerPath the full path of the destination container within the
- * workspace
- * @param source the root file system object to import
- * @param provider the file system structure provider to use
- * @param overwriteImplementor the overwrite strategy to use
- */
- public RemoteFileImportOperation(IPath containerPath, Object source, IImportStructureProvider provider, IOverwriteQuery overwriteImplementor) {
- super();
- this.destinationPath = containerPath;
- this.source = source;
- this.provider = provider;
- overwriteCallback = overwriteImplementor;
- }
-
- /**
- * Creates a new operation that imports specific file system objects.
- * In this usage context, the specified source file system object is used by the
- * operation solely to determine the destination container structure of the file system
- * objects being imported.
- * <p>
- * The <code>source</code> parameter represents the root file system object to
- * import. Valid types for this parameter are determined by the supplied
- * <code>IImportStructureProvider</code>. The contents of the source which
- * are to be imported are specified in the <code>filesToImport</code>
- * parameter.
- * </p>
- * <p>
- * The <code>provider</code> parameter allows this operation to deal with the
- * source object in an abstract way. This operation calls methods on the provider
- * and the provider in turn calls specific methods on the source object.
- * </p>
- * <p>
- * The <code>filesToImport</code> parameter specifies what contents of the root
- * file system object are to be imported.
- * </p>
- * <p>
- * The default import behavior is to recreate the complete container structure
- * for the file system objects in their destination. If <code>setCreateContainerStructure</code>
- * is set to <code>false</code>, then the container structure created for each of
- * the file system objects is relative to the supplied root file system object.
- * </p>
- *
- * @param containerPath the full path of the destination container within the
- * workspace
- * @param source the root file system object to import from
- * @param provider the file system structure provider to use
- * @param overwriteImplementor the overwrite strategy to use
- * @param filesToImport the list of file system objects to be imported
- * (element type: <code>Object</code>)
- */
- public RemoteFileImportOperation(IPath containerPath, Object source, IImportStructureProvider provider, IOverwriteQuery overwriteImplementor, List filesToImport) {
- this(containerPath, source, provider, overwriteImplementor);
- setFilesToImport(filesToImport);
- }
-
- public RemoteFileImportOperation(RemoteFileImportData data, IImportStructureProvider provider, IOverwriteQuery overwriteImplementor) {
- this(data.getContainerPath(), data.getSource(), provider, overwriteImplementor);
- setFilesToImport(data.getElements());
- setOverwriteResources(data.isOverWriteExistingFiles());
- setReviewSynchronize(data.isReviewSynchronize());
- setCreateContainerStructure(data.isCreateDirectoryStructure());
- this.importData = data;
- this.saveSettings = data.isSaveSettings();
- this.descriptionFilePath = data.getDescriptionFilePath();
- }
-
- /**
- * Creates a new operation that imports specific file system objects.
- * <p>
- * The <code>provider</code> parameter allows this operation to deal with the
- * source object in an abstract way. This operation calls methods on the provider
- * and the provider in turn calls specific methods on the source object.
- * </p>
- * <p>
- * The <code>filesToImport</code> parameter specifies what file system objects
- * are to be imported.
- * </p>
- * <p>
- * The default import behavior is to recreate the complete container structure
- * for the file system objects in their destination. If <code>setCreateContainerStructure</code>
- * is set to <code>false</code>, then no container structure is created for each of
- * the file system objects.
- * </p>
- *
- * @param containerPath the full path of the destination container within the
- * workspace
- * @param provider the file system structure provider to use
- * @param overwriteImplementor the overwrite strategy to use
- * @param filesToImport the list of file system objects to be imported
- * (element type: <code>Object</code>)
- */
- public RemoteFileImportOperation(IPath containerPath, IImportStructureProvider provider, IOverwriteQuery overwriteImplementor, List filesToImport) {
- this(containerPath, null, provider, overwriteImplementor);
- setFilesToImport(filesToImport);
- }
-
- /**
- * Creates the folders that appear in the specified resource path.
- * These folders are created relative to the destination container.
- *
- * @param path the relative path of the resource
- * @return the container resource coresponding to the given path
- * @exception CoreException if this method failed
- */
- IContainer createContainersFor(IPath path) throws CoreException {
- IContainer currentFolder = destinationContainer;
- int segmentCount = path.segmentCount();
- //No containers to create
- if (segmentCount == 0) return currentFolder;
- //Needs to be handles differently at the root
- if (currentFolder.getType() == IResource.ROOT) return createFromRoot(path);
- for (int i = 0; i < segmentCount; i++) {
- currentFolder = currentFolder.getFolder(new Path(path.segment(i)));
- if (!currentFolder.exists()) ((IFolder) currentFolder).create(false, true, null);
- }
- return currentFolder;
- }
-
- /**
- * Creates the folders that appear in the specified resource path
- * assuming that the destinationContainer begins at the root. Do not create projects.
- *
- * @param path the relative path of the resource
- * @return the container resource coresponding to the given path
- * @exception CoreException if this method failed
- */
- private IContainer createFromRoot(IPath path) throws CoreException {
- int segmentCount = path.segmentCount();
- //Assume the project exists
- IContainer currentFolder = ((IWorkspaceRoot) destinationContainer).getProject(path.segment(0));
- for (int i = 1; i < segmentCount; i++) {
- currentFolder = currentFolder.getFolder(new Path(path.segment(i)));
- if (!currentFolder.exists()) ((IFolder) currentFolder).create(false, true, null);
- }
- return currentFolder;
- }
-
- /**
- * Deletes the given resource. If the resource fails to be deleted, adds a
- * status object to the list to be returned by <code>getResult</code>.
- *
- * @param resource the resource
- */
- void deleteResource(IResource resource) {
- try {
- resource.delete(IResource.KEEP_HISTORY, null);
- } catch (CoreException e) {
- errorTable.add(e.getStatus());
- }
- }
-
- /**
- * Attempts to ensure that the given resource does not already exist in the
- * workspace. The resource will be deleted if required, perhaps after asking
- * the user's permission.
- *
- * @param targetResource the resource that should not exist
- * @param policy determines how the resource is imported
- * @return <code>true</code> if the resource does not exist, and
- * <code>false</code> if it does exist
- */
- boolean ensureTargetDoesNotExist(IResource targetResource, int policy) {
- if (targetResource.exists()) {
- //If force overwrite is on don't bother
- if (policy != POLICY_FORCE_OVERWRITE) {
- if (this.overwriteState == OVERWRITE_NOT_SET && !queryOverwrite(targetResource.getFullPath())) return false;
- if (this.overwriteState == OVERWRITE_NONE) return false;
- }
- deleteResource(targetResource);
- }
- return true;
- }
-
- /* (non-Javadoc)
- * Method declared on WorkbenchModifyOperation.
- * Imports the specified file system objects from the file system.
- */
- protected void execute(IProgressMonitor progressMonitor) {
- monitor = progressMonitor;
- try {
- if (selectedFiles == null) {
- //Set the amount to 1000 as we have no idea of how long this will take
- String taskMsg = SystemImportExportResources.RESID_FILEIMPORT_IMPORTING;
- monitor.beginTask(taskMsg, 1000);
- ContainerGenerator generator = new ContainerGenerator(destinationPath);
- monitor.worked(50);
- destinationContainer = generator.generateContainer(new SubProgressMonitor(monitor, 50));
- importRecursivelyFrom(source, POLICY_DEFAULT);
- //Be sure it finishes
- monitor.worked(90);
- } else {
- // Choose twice the selected files size to take folders into account
- int creationCount = selectedFiles.size();
- String taskMsg = SystemImportExportResources.RESID_FILEIMPORT_IMPORTING;
- monitor.beginTask(taskMsg, creationCount + 100);
- ContainerGenerator generator = new ContainerGenerator(destinationPath);
- monitor.worked(50);
- destinationContainer = generator.generateContainer(new SubProgressMonitor(monitor, 50));
- importFileSystemObjects(selectedFiles);
- }
- if (saveSettings) {
- try {
- saveDescription();
- } catch (CoreException e) {
- SystemBasePlugin.logError("Error occured trying to save description " + descriptionFilePath, e); //$NON-NLS-1$
- errorTable.add(e.getStatus());
- } catch (IOException e) {
- SystemBasePlugin.logError("Error occured trying to save description " + descriptionFilePath, e); //$NON-NLS-1$
- errorTable.add(new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getSymbolicName(), 0, e.getLocalizedMessage(), e));
- }
- }
- } catch (CoreException e) {
- errorTable.add(e.getStatus());
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Saves a description file for the export.
- * @throws CoreException if an unexpected exception occurs.
- * @throws IOException if an I/O error occurs.
- */
- protected void saveDescription() throws CoreException, IOException {
- ByteArrayOutputStream objectStreamOutput = new ByteArrayOutputStream();
- IRemoteFileImportDescriptionWriter writer = importData.createImportDescriptionWriter(objectStreamOutput);
- ByteArrayInputStream fileInput = null;
- try {
- writer.write(importData);
- fileInput = new ByteArrayInputStream(objectStreamOutput.toByteArray());
- IFile descriptionFile = importData.getDescriptionFile();
- // check if resource exists
- if (descriptionFile.isAccessible()) {
- descriptionFile.setContents(fileInput, true, true, null);
- }
- // if resource does not exist
- else {
- // now have to check if a variant of this file exists (i.e. whether a file exists
- // that has the same path with a different case. For case insensitive file systems
- // such as Windows, this is needed since we can't simply create a file with a different
- // case. Note that isAccessible() above does not check for file paths with different case,
- // so we have to check it explicitly).
- IResource variant = RemoteImportExportUtil.getInstance().findExistingResourceVariant(descriptionFile.getFullPath());
- // if a variant was not found, create the new file
- if (variant == null) {
- // check if a variant of the parent exists
- // we need to do this because at this point we know that the file path does not
- // exist, and neither does its variant. However, it is possible that the parent path
- // has a variant, in which case calling create on the description file with
- // the path as it is given will fail. We need to get the variant path of the parent,
- // append the name of the file to the variant path, and create a file with that path.
- // get parent
- IResource parent = descriptionFile.getParent();
- if (parent != null) {
- // get parent path
- IResource parentVariant = RemoteImportExportUtil.getInstance().findExistingResourceVariant(parent.getFullPath());
- // no parent variant (i.e. in a case sensitive file system)
- if (parentVariant == null) {
- descriptionFile.create(fileInput, true, null);
- }
- // parent variant found (might be same as original parent path)
- else {
- IPath newPath = parentVariant.getFullPath().append(descriptionFile.getName());
- IFile newDescriptionFile = SystemBasePlugin.getWorkspace().getRoot().getFile(newPath);
- newDescriptionFile.create(fileInput, true, null);
- }
- }
- }
- // otherwise, simply set the contents of the variant file
- else {
- if (variant instanceof IFile) {
- ((IFile) variant).setContents(fileInput, true, true, null);
- }
- }
- }
- } finally {
- if (fileInput != null) {
- fileInput.close();
- }
- if (writer != null) {
- writer.close();
- }
- }
- }
-
- /**
- * Returns the container resource that the passed file system object should be
- * imported into.
- *
- * @param fileSystemObject the file system object being imported
- * @return the container resource that the passed file system object should be
- * imported into
- * @exception CoreException if this method failed
- */
- IContainer getDestinationContainerFor(Object fileSystemObject) throws CoreException {
- IPath pathname = new Path(provider.getFullPath(fileSystemObject));
- if (createContainerStructure)
- return createContainersFor(pathname.removeLastSegments(1));
- else {
- if (source == fileSystemObject) return null;
- IPath sourcePath = new Path(provider.getFullPath(source));
- IPath destContainerPath = pathname.removeLastSegments(1);
- IPath relativePath = destContainerPath.removeFirstSegments(sourcePath.segmentCount()).setDevice(null);
- return createContainersFor(relativePath);
- }
- }
-
- /**
- * Returns the status of the import operation.
- * If there were any errors, the result is a status object containing
- * individual status objects for each error.
- * If there were no errors, the result is a status object with error code <code>OK</code>.
- *
- * @return the status
- */
- public IStatus getStatus() {
- IStatus[] errors = new IStatus[errorTable.size()];
- errorTable.toArray(errors);
- // IFS:
- String msg = RemoteImportExportResources.FILEMSG_IMPORT_PROBLEMS;
- return new MultiStatus(RemoteImportExportPlugin.getDefault().getBundle().getSymbolicName(), IStatus.OK, errors, msg, null);
- }
-
- private IFile existingFileInDifferentCase(IFile file) throws CoreException {
-
- boolean isWindows = System.getProperty("os.name").toLowerCase().startsWith("win"); //$NON-NLS-1$//$NON-NLS-2$
- if (!isWindows) // if the system is case sensitive then we're good
- return null;
-
- String newName = file.getName();
-
- //now look for a matching case variant in the tree
- IContainer parent = file.getParent();
- IResource[] members = parent.members();
- for (int i = 0; i < members.length; i++){
- IResource member = members[i];
- if (member instanceof IFile){
- String memberName = member.getName();
- if (newName.equalsIgnoreCase(memberName)){
- return (IFile)member;
- }
- }
- }
- return null;
- }
-
- /**
- * Imports the specified file system object into the workspace.
- * If the import fails, adds a status object to the list to be returned by
- * <code>getResult</code>.
- *
- * @param fileObject the file system object to be imported
- * @param policy determines how the file object is imported
- */
- void importFile(Object fileObject, int policy) {
- IContainer containerResource;
- try {
- containerResource = getDestinationContainerFor(fileObject);
- } catch (CoreException e) {
- IStatus coreStatus = e.getStatus();
- String newMessage = NLS.bind(RemoteImportExportResources.FILEMSG_IMPORT_ERROR, fileObject, coreStatus.getMessage());
- IStatus status = new Status(coreStatus.getSeverity(), coreStatus.getPlugin(), coreStatus.getCode(), newMessage, null);
- errorTable.add(status);
- return;
- }
- String fileObjectPath = provider.getFullPath(fileObject);
- monitor.subTask(fileObjectPath);
- IFile targetResource = containerResource.getFile(new Path(provider.getLabel(fileObject)));
- monitor.worked(1);
- // ensure that the source and target are not the same
- IPath targetPath = targetResource.getLocation();
- // Use Files for comparison to avoid platform specific case issues
- if (targetPath != null && (targetPath.toFile().equals(new File(fileObjectPath)))) {
- String msg = NLS.bind(RemoteImportExportResources.FILEMSG_IMPORT_SELF, fileObjectPath);
- errorTable.add(new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getBundle().getSymbolicName(), 0, msg, null));
- return;
- }
- if (!ensureTargetDoesNotExist(targetResource, policy)) {
- // Do not add an error status because the user
- // has explicitely said no overwrite. Do not
- // update the monitor as it was done in queryOverwrite.
- return;
- }
- try {
- IRemoteFileSubSystem rfss = RemoteFileUtility.getFileSubSystem(((UniFilePlus) fileObject).remoteFile.getHost());
- // 030820: added the following kludge to circumvent problem in
- // artemis. (artemis 3 will fix this)
- // TODO remove for 6.0
- String encoding = ((UniFilePlus) fileObject).remoteFile.getEncoding();
- if (encoding.startsWith("CP")) //$NON-NLS-1$
- {
- encoding = "Cp" + encoding.substring(2); //$NON-NLS-1$
- }
-
- // check for existing resource
- IFile existingFile = existingFileInDifferentCase(targetResource);
- if (existingFile != null){
- String msgDetails = NLS.bind(FileResources.FILEMSG_CREATE_FILE_FAILED_EXIST_DETAILS, existingFile.getFullPath());
- errorTable.add(new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getBundle().getSymbolicName(),msgDetails));
- return;
- }
-
- if (targetResource.getLocation() == null){
- // an EFS file destination
- String remoteFileName = ((UniFilePlus) fileObject).remoteFile.getName();
- String remoteParentPath = ((UniFilePlus) fileObject).remoteFile.getParentPath();
-
- InputStream instream = rfss.getInputStream(remoteParentPath, remoteFileName, true, monitor);
- if (!targetResource.exists()){
- targetResource.create(instream, IResource.FORCE, monitor);
- }
- else {
- targetResource.setContents(instream, IResource.FORCE, monitor);
- }
- }
- else {
- rfss.download(((UniFilePlus) fileObject).remoteFile, targetResource.getLocation().makeAbsolute().toOSString(), encoding, null);
- }
- try {
- // refresh workspace with just added resource
- targetResource.refreshLocal(IResource.DEPTH_ZERO, new SubProgressMonitor(monitor, 1, SubProgressMonitor.SUPPRESS_SUBTASK_LABEL));
- } catch (CoreException e) {
- errorTable.add(e.getStatus());
- }
- } catch (RemoteFileIOException e) {
- String msg = NLS.bind(RemoteImportExportResources.FILEMSG_IMPORT_ERROR, fileObjectPath, e.getRemoteException().getLocalizedMessage());
- errorTable.add(new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getBundle().getSymbolicName(), 0, msg, e));
- return;
- } catch (RemoteFileSecurityException e) {
- String msg = NLS.bind(RemoteImportExportResources.FILEMSG_IMPORT_ERROR, fileObjectPath, e.getRemoteException().getLocalizedMessage());
- errorTable.add(new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getBundle().getSymbolicName(), 0, msg, e));
- return;
- } catch (Exception e) {
- String msg = NLS.bind(RemoteImportExportResources.FILEMSG_IMPORT_ERROR, fileObjectPath, e.getMessage() == null ? e.toString() : e.getMessage());
- errorTable.add(new Status(IStatus.ERROR, RemoteImportExportPlugin.getDefault().getBundle().getSymbolicName(), 0, msg, e));
- return;
- }
- }
-
- /**
- * Imports the specified file system objects into the workspace.
- * If the import fails, adds a status object to the list to be returned by
- * <code>getStatus</code>.
- *
- * @param filesToImport the list of file system objects to import
- * (element type: <code>Object</code>)
- * @exception OperationCanceledException if cancelled
- */
- void importFileSystemObjects(List filesToImport) {
- Iterator filesEnum = filesToImport.iterator();
- while (filesEnum.hasNext()) {
- Object fileSystemObject = filesEnum.next();
- if (source == null) {
- // We just import what we are given into the destination
- IPath sourcePath = new Path(provider.getFullPath(fileSystemObject)).removeLastSegments(1);
- if (provider.isFolder(fileSystemObject) && sourcePath.isEmpty()) {
- // If we don't have a parent then we have selected the
- // file systems root. Roots can't copied (at least not
- // under windows).
- String msg = RemoteImportExportResources.FILEMSG_COPY_ROOT;
- errorTable.add(new Status(IStatus.INFO, RemoteImportExportPlugin.getDefault().getBundle().getSymbolicName(), 0, msg, null));
- continue;
- }
- source = sourcePath.toFile();
- }
- importRecursivelyFrom(fileSystemObject, POLICY_DEFAULT);
- }
- }
-
- /**
- * Imports the specified file system container object into the workspace.
- * If the import fails, adds a status object to the list to be returned by
- * <code>getResult</code>.
- *
- * @param fileObject the file system container object to be imported
- * @param policy determines how the folder object and children are imported
- * @return the policy to use to import the folder's children
- */
- int importFolder(Object folderObject, int policy) {
- IContainer containerResource;
- try {
- containerResource = getDestinationContainerFor(folderObject);
- } catch (CoreException e) {
- errorTable.add(e.getStatus());
- return policy;
- }
- if (containerResource == null) return policy;
- monitor.subTask(provider.getFullPath(folderObject));
- IWorkspace workspace = destinationContainer.getWorkspace();
- IPath containerPath = containerResource.getFullPath();
- IPath resourcePath = containerPath.append(provider.getLabel(folderObject));
- // Do not attempt the import if the resource path is unchanged. This may happen
- // when importing from a zip file.
- if (resourcePath.equals(containerPath)) return policy;
- if (workspace.getRoot().exists(resourcePath)) {
- if (policy != POLICY_FORCE_OVERWRITE) {
- if (this.overwriteState == OVERWRITE_NONE || !queryOverwrite(resourcePath)) // Do not add an error status because the user
- // has explicitely said no overwrite. Do not
- // update the monitor as it was done in queryOverwrite.
- return POLICY_SKIP_CHILDREN;
- }
- return POLICY_FORCE_OVERWRITE;
- }
- try {
- workspace.getRoot().getFolder(resourcePath).create(false, true, null);
- } catch (CoreException e) {
- errorTable.add(e.getStatus());
- }
- return policy;
- }
-
- /**
- * Imports the specified file system object recursively into the workspace.
- * If the import fails, adds a status object to the list to be returned by
- * <code>getStatus</code>.
- *
- * @param fileSystemObject the file system object to be imported
- * @param policy determines how the file system object and children are imported
- * @exception OperationCanceledException if cancelled
- */
- void importRecursivelyFrom(Object fileSystemObject, int policy) {
- if (monitor.isCanceled()) throw new OperationCanceledException();
- if (!provider.isFolder(fileSystemObject)) {
- importFile(fileSystemObject, policy);
- return;
- }
- int childPolicy = importFolder(fileSystemObject, policy);
- if (childPolicy != POLICY_SKIP_CHILDREN) {
- Iterator children = provider.getChildren(fileSystemObject).iterator();
- while (children.hasNext())
- importRecursivelyFrom(children.next(), childPolicy);
- }
- }
-
- /**
- * Queries the user whether the resource with the specified path should be
- * overwritten by a file system object that is being imported.
- *
- * @param path the workspace path of the resource that needs to be overwritten
- * @return <code>true</code> to overwrite, <code>false</code> to not overwrite
- * @exception OperationCanceledException if cancelled
- */
- boolean queryOverwrite(IPath resourcePath) throws OperationCanceledException {
- String overwriteAnswer = overwriteCallback.queryOverwrite(resourcePath.makeRelative().toString());
- if (overwriteAnswer.equals(IOverwriteQuery.CANCEL)) //throw new OperationCanceledException(UniversalSystemPlugin.getString("customs.emptyString"));
- throw new OperationCanceledException(""); //$NON-NLS-1$
- if (overwriteAnswer.equals(IOverwriteQuery.NO)) {
- return false;
- }
- if (overwriteAnswer.equals(IOverwriteQuery.NO_ALL)) {
- this.overwriteState = OVERWRITE_NONE;
- return false;
- }
- if (overwriteAnswer.equals(IOverwriteQuery.ALL)) this.overwriteState = OVERWRITE_ALL;
- return true;
- }
-
- /**
- * Sets whether the containment structures that are implied from the full paths
- * of file system objects being imported should be duplicated in the workbench.
- *
- * @param value <code>true</code> if containers should be created, and
- * <code>false</code> otherwise
- */
- public void setCreateContainerStructure(boolean value) {
- createContainerStructure = value;
- }
-
- /**
- * Sets the file system objects to import.
- *
- * @param filesToImport the list of file system objects to be imported
- * (element type: <code>Object</code>)
- */
- public void setFilesToImport(List filesToImport) {
- this.selectedFiles = filesToImport;
- }
-
- /**
- * Sets whether imported file system objects should automatically overwrite
- * existing workbench resources when a conflict occurs.
- *
- * @param value <code>true</code> to automatically overwrite, and
- * <code>false</code> otherwise
- */
- public void setOverwriteResources(boolean value) {
- if (value) this.overwriteState = OVERWRITE_ALL;
- }
-
- /**
- * Set this boolean indicating whether exported resources should automatically
- * be reviewed/synchronized
- *
- * @param value boolean
- */
- public void setReviewSynchronize(boolean value) {
- reviewSynchronize = value;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportToProjectActionDelegate.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportToProjectActionDelegate.java
deleted file mode 100644
index a2a11c574..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileImportToProjectActionDelegate.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.wizard.WizardDialog;
-
-/**
- * This class represents the action to bring up the remote file system import wizard
- * and import the contents of a remote folder to a project.
- */
-public class RemoteFileImportToProjectActionDelegate extends RemoteFileImportExportActionDelegate {
- /**
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action) {
- RemoteImportWizard wizard = new RemoteImportWizard();
- wizard.init(getWorkbench(), getSelection());
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.open();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileOpenExportWizardActionDelegate.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileOpenExportWizardActionDelegate.java
deleted file mode 100644
index eab8a3e40..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileOpenExportWizardActionDelegate.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import java.io.IOException;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.widgets.Shell;
-import org.xml.sax.SAXException;
-
-/**
- * Opens the remote file system export wizard.
- */
-public class RemoteFileOpenExportWizardActionDelegate extends RemoteFileImportExportActionDelegate {
- /**
- * Opens the remote file system export wizard.
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action) {
- Shell parent = getShell();
- RemoteFileExportData exportData = null;
- IFile file = getDescriptionFile(getSelection());
- if (file == null) {
- SystemBasePlugin.logError("No description file found"); //$NON-NLS-1$
- return;
- }
- try {
- exportData = readRemoteFileExportData(file);
- } catch (CoreException e) {
- SystemBasePlugin.logError("Error occured trying to read description file" + file.getFullPath(), e); //$NON-NLS-1$
- return;
- } catch (IOException e) {
- SystemBasePlugin.logError("Error occured trying to read description file" + file.getFullPath(), e); //$NON-NLS-1$
- return;
- } catch (SAXException e) {
- SystemBasePlugin.logError("Error occured trying to read description file" + file.getFullPath(), e); //$NON-NLS-1$
- return;
- }
- if (exportData == null) {
- SystemBasePlugin.logError("No export data"); //$NON-NLS-1$
- return;
- }
- RemoteExportWizard wizard = new RemoteExportWizard();
- wizard.init(getWorkbench(), exportData);
- WizardDialog dialog = new WizardDialog(parent, wizard);
- dialog.create();
- dialog.open();
- }
-
- /**
- * Reads the remote file export data from a file.
- */
- private RemoteFileExportData readRemoteFileExportData(IFile description) throws CoreException, IOException, SAXException {
- Assert.isLegal(description.isAccessible());
- Assert.isNotNull(description.getFileExtension());
- Assert.isLegal(description.getFileExtension().equals(Utilities.EXPORT_DESCRIPTION_EXTENSION));
- RemoteFileExportData exportData = new RemoteFileExportData();
- IRemoteFileExportDescriptionReader reader = null;
- try {
- reader = exportData.createExportDescriptionReader(description.getContents());
- reader.read(exportData);
- } finally {
- if (reader != null) {
- reader.close();
- }
- }
- return exportData;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileOpenImportWizardActionDelegate.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileOpenImportWizardActionDelegate.java
deleted file mode 100644
index 0a9c4710b..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileOpenImportWizardActionDelegate.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import java.io.IOException;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.widgets.Shell;
-import org.xml.sax.SAXException;
-
-/**
- * Opens the remote file system export wizard.
- */
-public class RemoteFileOpenImportWizardActionDelegate extends RemoteFileImportExportActionDelegate {
- /**
- * Opens the remote file system export wizard.
- * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
- */
- public void run(IAction action) {
- Shell parent = getShell();
- RemoteFileImportData importData = null;
- IFile file = getDescriptionFile(getSelection());
- if (file == null) {
- SystemBasePlugin.logError("No description file found"); //$NON-NLS-1$
- return;
- }
- try {
- importData = readRemoteFileImportData(file);
- } catch (CoreException e) {
- SystemBasePlugin.logError("Error occured trying to read description file" + file.getFullPath(), e); //$NON-NLS-1$
- return;
- } catch (IOException e) {
- SystemBasePlugin.logError("Error occured trying to read description file" + file.getFullPath(), e); //$NON-NLS-1$
- return;
- } catch (SAXException e) {
- SystemBasePlugin.logError("Error occured trying to read description file" + file.getFullPath(), e); //$NON-NLS-1$
- return;
- }
- if (importData == null) {
- SystemBasePlugin.logError("No export data"); //$NON-NLS-1$
- return;
- }
- RemoteImportWizard wizard = new RemoteImportWizard();
- wizard.init(getWorkbench(), importData);
- WizardDialog dialog = new WizardDialog(parent, wizard);
- dialog.create();
- dialog.open();
- }
-
- /**
- * Reads the remote file export data from a file.
- */
- private RemoteFileImportData readRemoteFileImportData(IFile description) throws CoreException, IOException, SAXException {
- Assert.isLegal(description.isAccessible());
- Assert.isNotNull(description.getFileExtension());
- Assert.isLegal(description.getFileExtension().equals(Utilities.IMPORT_DESCRIPTION_EXTENSION));
- RemoteFileImportData importData = new RemoteFileImportData();
- IRemoteFileImportDescriptionReader reader = null;
- try {
- reader = importData.createImportDescriptionReader(description.getContents());
- reader.read(importData);
- } finally {
- if (reader != null) {
- reader.close();
- }
- }
- return importData;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileOverwriteQuery.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileOverwriteQuery.java
deleted file mode 100644
index 6099ab94c..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteFileOverwriteQuery.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- * David McKnight (IBM) - [216252] MessageFormat.format -> NLS.bind
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.internal.importexport.RemoteImportExportResources;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.IOverwriteQuery;
-
-/**
- * This class is used to query whether the user wants to overwrite a file, overwrite all files, not overwrite a file,
- * not overwrite any files, or cancel.
- */
-public class RemoteFileOverwriteQuery implements IOverwriteQuery {
- /**
- * This runnable shows the overwrite query dialog and stores the result.
- */
- private class RemoteFileOverwriteQueryRunnable implements Runnable {
- private String pathString;
- private String queryResponse;
-
- /**
- * Constructor.
- * @param pathString the path.
- */
- private RemoteFileOverwriteQueryRunnable(String pathString) {
- this.pathString = pathString;
- }
-
- /**
- * @see java.lang.Runnable#run()
- */
- public void run() {
- Path path = new Path(pathString);
- String messageString;
- //Break the message up if there is a file name and a directory
- //and there are at least 2 segments.
- if (path.getFileExtension() == null || path.segmentCount() < 2) {
- //TODO internal class used
- messageString = NLS.bind(RemoteImportExportResources.WizardDataTransfer_existsQuestion, pathString );
- } else {
- // TODO internal class used
- messageString = NLS.bind(RemoteImportExportResources.WizardDataTransfer_overwriteNameAndPathQuestion, path.lastSegment(),
- path.removeLastSegments(1).toOSString() );
- }
- Shell shell = SystemBasePlugin.getActiveWorkbenchShell();
- // TODO internal class used
- MessageDialog dialog = new MessageDialog(shell, RemoteImportExportResources.Question, null, messageString, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL,
- IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
- String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL };
- // open the dialog
- dialog.open();
- if (dialog.getReturnCode() < 0) {
- queryResponse = IOverwriteQuery.CANCEL;
- } else {
- queryResponse = response[dialog.getReturnCode()];
- }
- }
-
- private String getQueryRresponse() {
- return queryResponse;
- }
- }
-
- /**
- * Constructor.
- */
- public RemoteFileOverwriteQuery() {
- super();
- }
-
- /**
- * @see org.eclipse.ui.dialogs.IOverwriteQuery#queryOverwrite(java.lang.String)
- */
- public String queryOverwrite(String pathString) {
- RemoteFileOverwriteQueryRunnable runnable = new RemoteFileOverwriteQueryRunnable(pathString);
- Display.getDefault().syncExec(runnable);
- return runnable.getQueryRresponse();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteImportWizard.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteImportWizard.java
deleted file mode 100644
index e493d17be..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteImportWizard.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
- * David McKnight (IBM) - [219792][importexport][ftp] RSE hangs on FTP import
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.rse.internal.importexport.RemoteImportExportPlugin;
-import org.eclipse.rse.internal.importexport.SystemImportExportResources;
-import org.eclipse.rse.ui.wizards.AbstractSystemWizard;
-import org.eclipse.ui.IImportWizard;
-import org.eclipse.ui.IWorkbench;
-
-// Similar to org.eclipse.ui.wizards.datatransfer.FileSystemImportWizard
-// Changes marked with "IFS:" comments. Also see use of RemoteImportExportPlugin
-/**
- * Standard workbench wizard for importing resources from the local file system
- * into the workspace.
- * <p>
- * This class may be instantiated and used without further configuration.
- * </p>
- * <p>
- * Example:
- *
- * <pre>
- * IWizard wizard = new RemoteImportWizard();
- * wizard.init(workbench, selection);
- * WizardDialog dialog = new WizardDialog(shell, wizard);
- * dialog.open();
- * </pre>
- *
- * During the call to <code>open</code>, the wizard dialog is presented to
- * the user. When the user hits Finish, the user-selected files are imported
- * into the workspace, the dialog closes, and the call to <code>open</code>
- * returns.
- * </p>
- *
- * @noextend This class is not intended to be subclassed by clients.
- */
-public class RemoteImportWizard extends AbstractSystemWizard implements IImportWizard {
- private IWorkbench workbench;
- private IStructuredSelection selection;
- private RemoteImportWizardPage1 mainPage;
- private RemoteFileImportData importData;
- private boolean initializeFromExportData;
-
- /**
- * Creates a wizard for importing resources into the workspace from
- * the file system.
- */
- public RemoteImportWizard() {
- IDialogSettings workbenchSettings = RemoteImportExportPlugin.getDefault().getDialogSettings();
- IDialogSettings section = workbenchSettings.getSection("RemoteImportWizard"); //$NON-NLS-1$
- if (section == null) section = workbenchSettings.addNewSection("RemoteImportWizard"); //$NON-NLS-1$
- setDialogSettings(section);
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public void addPages() {
- mainPage = new RemoteImportWizardPage1(workbench, selection);
- addPage(mainPage);
- }
-
- /**
- * Returns the image descriptor with the given key.
- */
- private ImageDescriptor getImageDescriptor(String key) {
- return RemoteImportExportPlugin.getDefault().getImageDescriptor(key);
- }
-
- /* (non-Javadoc)
- * Method declared on IWorkbenchWizard.
- */
- public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
- this.workbench = workbench;
- selection = currentSelection;
- setWindowTitle(SystemImportExportResources.RESID_FILEIMPORT_TITLE);
- setDefaultPageImageDescriptor(getImageDescriptor(RemoteImportExportPlugin.ICON_IMPORTWIZARD_ID));
- setNeedsProgressMonitor(true);
- }
-
- public void init(IWorkbench workbench, RemoteFileImportData importData) {
- this.workbench = workbench;
- this.selection = new StructuredSelection(importData.getElements().toArray());
- this.importData = importData;
- setInitializeFromImportData(true);
- setWindowTitle(SystemImportExportResources.RESID_FILEIMPORT_TITLE);
- setDefaultPageImageDescriptor(getImageDescriptor(RemoteImportExportPlugin.ICON_IMPORTWIZARD_ID));
- setNeedsProgressMonitor(true);
- }
-
- protected void setInitializeFromImportData(boolean init) {
- this.initializeFromExportData = init;
- }
-
- public boolean getInitializeFromImportData() {
- return initializeFromExportData;
- }
-
- public RemoteFileImportData getImportData() {
- return importData;
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public boolean performFinish() {
- return mainPage.finish();
- }
-
- public boolean performCancel() {
- mainPage.cancel();
- return super.performCancel();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteImportWizardPage1.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteImportWizardPage1.java
deleted file mode 100644
index 2a0d39798..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/RemoteImportWizardPage1.java
+++ /dev/null
@@ -1,1647 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
- * Martin Oberhuber (Wind River) - [168870] refactor org.eclipse.rse.core package of the UI plugin
- * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
- * David McKnight (IBM) - [216252] MessageFormat.format -> NLS.bind
- * David McKnight (IBM) - [219792] use background query when doing import
- * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
- * David McKnight (IBM) - [219792][importexport][ftp] RSE hangs on FTP import
- * Takuya Miyamoto - [185925] Integrate Platform/Team Synchronization
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- * David McKnight (IBM) - [276535] File Conflict when Importing Remote Folder with Case-Differentiated-Only Filenames into Project
- * David McKnight (IBM) - [191558] [importexport][efs] Import to Project doesn't work with remote EFS projects
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.files.ui.actions.SystemSelectRemoteFolderAction;
-import org.eclipse.rse.internal.importexport.IRemoteImportExportConstants;
-import org.eclipse.rse.internal.importexport.RemoteImportExportPlugin;
-import org.eclipse.rse.internal.importexport.RemoteImportExportResources;
-import org.eclipse.rse.internal.importexport.RemoteImportExportUtil;
-import org.eclipse.rse.internal.importexport.SystemImportExportResources;
-import org.eclipse.rse.internal.synchronize.RSESyncUtils;
-import org.eclipse.rse.internal.synchronize.SynchronizeData;
-import org.eclipse.rse.internal.synchronize.provisional.ISynchronizeOperation;
-import org.eclipse.rse.internal.synchronize.provisional.SynchronizeOperation;
-import org.eclipse.rse.internal.synchronize.provisional.Synchronizer;
-import org.eclipse.rse.services.clientserver.messages.CommonMessages;
-import org.eclipse.rse.services.clientserver.messages.ICommonMessageIds;
-import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.SystemWidgetHelpers;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.rse.ui.messages.SystemMessageLine;
-import org.eclipse.rse.ui.wizards.ISystemWizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.dialogs.SaveAsDialog;
-import org.eclipse.ui.dialogs.WizardResourceImportPage;
-import org.eclipse.ui.internal.ide.dialogs.IElementFilter;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-
-/**
- * Page 1 of the base resource import-from-file-system Wizard
- */
-class RemoteImportWizardPage1 extends WizardResourceImportPage implements Listener, ISystemWizardPage {
-
- private class DummyProvider implements ISelectionProvider {
-
- public void addSelectionChangedListener(
- ISelectionChangedListener listener) {
- // TODO Auto-generated method stub
-
- }
-
- public ISelection getSelection() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void removeSelectionChangedListener(
- ISelectionChangedListener listener) {
- // TODO Auto-generated method stub
-
- }
-
- public void setSelection(ISelection selection) {
- // TODO Auto-generated method stub
-
- }
- }
-
- private class QueryAllJob extends Job
- {
- private Object _fileSystemObject;
- private IImportStructureProvider _provider;
- private MinimizedFileSystemElement _element;
- private volatile boolean _isActive = false;
-
- public QueryAllJob(Object fileSystemObject, IImportStructureProvider provider, MinimizedFileSystemElement element){
- super("Querying All"); //$NON-NLS-1$
- _fileSystemObject = fileSystemObject;
- _provider = provider;
- _element = element;
- }
-
-
- public IStatus run(IProgressMonitor monitor){
- _isActive = true;
- Display.getDefault().asyncExec(new Runnable(){
- public void run(){
- updateWidgetEnablements();
- selectionGroup.setAllSelections(true);
- }
- });
- query(_fileSystemObject, _element, monitor);
- _isActive = false;
-
- return Status.OK_STATUS;
- }
-
- public boolean isActive()
- {
- return _isActive;
- }
-
-
- private void query(Object parent, MinimizedFileSystemElement element, IProgressMonitor monitor){
-
- if (monitor.isCanceled()){
- return;
- }
-
- List children = _provider.getChildren(parent);
- if (children == null) children = new ArrayList(1);
-
- Iterator childrenEnum = children.iterator();
-
- List resultsToQuery = new ArrayList();
-
- while (childrenEnum.hasNext()) {
- Object child = childrenEnum.next();
- String elementLabel = _provider.getLabel(child);
- //Create one level below
- MinimizedFileSystemElement result = new MinimizedFileSystemElement(elementLabel, element, _provider.isFolder(child));
- result.setFileSystemObject(child);
-
- if (child instanceof UniFilePlus){
- if (((UniFilePlus)child).isDirectory()){
- resultsToQuery.add(result);
- }
- }
- }
-
- // only with first level query do this to asynchronously update the table view
- if (element == _element){
- Display.getDefault().asyncExec(new Runnable(){
- public void run(){
- DummyProvider provider = new DummyProvider();
-
- ISelection sel1 = new StructuredSelection(_element.getParent());
- SelectionChangedEvent evt1 = new SelectionChangedEvent(provider, sel1);
- selectionGroup.selectionChanged(evt1);
-
- ISelection sel2 = new StructuredSelection(_element);
- SelectionChangedEvent evt2 = new SelectionChangedEvent(provider, sel2);
- selectionGroup.selectionChanged(evt2);
- }
- });
- }
-
- for (int i = 0; i < resultsToQuery.size(); i++) {
- MinimizedFileSystemElement celement = (MinimizedFileSystemElement)resultsToQuery.get(i);
- query(celement.getFileSystemObject(), celement, monitor);
- celement.setPopulated(true);
- }
-
- element.setPopulated(true);
- }
-
- }
-
-
-
- private Object sourceDirectory = null;
- private String helpId;
- private Composite parentComposite;
- private SystemMessageLine msgLine;
- private SystemMessage pendingMessage, pendingErrorMessage;
- private String pendingString, pendingErrorString;
- protected Composite sourceComposite;
- protected Combo sourceNameField;
- protected Button reviewSynchronizeCheckbox;
- protected Button overwriteExistingResourcesCheckbox;
- protected Button createContainerStructureButton;
- protected Button createOnlySelectedButton;
- protected Button saveSettingsButton;
- protected Label descFilePathLabel;
- protected Text descFilePathField;
- protected Button descFileBrowseButton;
- protected Button sourceBrowseButton;
- protected Button selectTypesButton;
- protected Button selectAllButton;
- protected Button deselectAllButton;
- // a boolean to indicate if the user has typed anything
- private boolean entryChanged = false;
-
- private QueryAllJob _queryAllJob;
- private MinimizedFileSystemElement _fileSystemTree;
-
- // input object
- protected Object inputObject = null;
- // flag to indicate whether initial selection was used to set source field
- protected boolean initSourceNameSet = false;
- // dialog store id constants
- private final static String STORE_SOURCE_NAMES_ID = "RemoteImportWizardPage1.STORE_SOURCE_NAMES_ID"; //$NON-NLS-1$
- private final static String STORE_REVIEW_SYNCHRONIZE_ID = "RemoteImportWizardPage1.STORE_REVIEW_SYNCHRONIZE_ID"; //$NON-NLS-1$
- private final static String STORE_OVERWRITE_EXISTING_RESOURCES_ID = "RemoteImportWizardPage1.STORE_OVERWRITE_EXISTING_RESOURCES_ID"; //$NON-NLS-1$
- private final static String STORE_CREATE_CONTAINER_STRUCTURE_ID = "RemoteImportWizardPage1.STORE_CREATE_CONTAINER_STRUCTURE_ID"; //$NON-NLS-1$
- private static final String STORE_CREATE_DESCRIPTION_FILE_ID = "RemoteImportWizardPage1.STORE_CREATE_DESCRIPTION_FILE_ID"; //$NON-NLS-1$
- private static final String STORE_DESCRIPTION_FILE_NAME_ID = "RemoteImportWizardPage1.STORE_DESCRIPTION_FILE_NAME_ID"; //$NON-NLS-1$
- // messages
- protected static final SystemMessage SOURCE_EMPTY_MESSAGE = new SimpleSystemMessage(RemoteImportExportPlugin.PLUGIN_ID,
- IRemoteImportExportConstants.FILEMSG_SOURCE_EMPTY,
- IStatus.ERROR,
- RemoteImportExportResources.FILEMSG_SOURCE_EMPTY,
- RemoteImportExportResources.FILEMSG_SOURCE_EMPTY_DETAILS);
-
-
- /**
- * Creates an instance of this class
- */
- protected RemoteImportWizardPage1(String name, IWorkbench aWorkbench, IStructuredSelection selection) {
- super(name, selection);
- setInputObject(selection);
- }
-
- /**
- * Creates an instance of this class
- *
- * @param aWorkbench IWorkbench
- * @param selection IStructuredSelection
- */
- public RemoteImportWizardPage1(IWorkbench aWorkbench, IStructuredSelection selection) {
- this("fileSystemImportPage1", aWorkbench, selection); //$NON-NLS-1$
- setTitle(SystemImportExportResources.RESID_FILEIMPORT_PAGE1_TITLE);
- setDescription(SystemImportExportResources.RESID_FILEIMPORT_PAGE1_DESCRIPTION);
- }
-
- /**
- * Creates a new button with the given id.
- * <p>
- * The <code>Dialog</code> implementation of this framework method
- * creates a standard push button, registers for selection events
- * including button presses and registers
- * default buttons with its shell.
- * The button id is stored as the buttons client data.
- * Note that the parent's layout is assumed to be a GridLayout and
- * the number of columns in this layout is incremented.
- * Subclasses may override.
- * </p>
- *
- * @param parent the parent composite
- * @param id the id of the button (see
- * <code>IDialogConstants.*_ID</code> constants
- * for standard dialog button ids)
- * @param label the label from the button
- * @param defaultButton <code>true</code> if the button is to be the
- * default button, and <code>false</code> otherwise
- */
- protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
- // increment the number of columns in the button bar
- ((GridLayout) parent.getLayout()).numColumns++;
- Button button = new Button(parent, SWT.PUSH);
- GridData buttonData = new GridData(GridData.FILL_HORIZONTAL);
- button.setLayoutData(buttonData);
- button.setData(new Integer(id));
- button.setText(label);
- if (defaultButton) {
- Shell shell = parent.getShell();
- if (shell != null) {
- shell.setDefaultButton(button);
- }
- button.setFocus();
- }
- return button;
- }
-
- /**
- * Creates the buttons for selecting specific types or selecting all or none of the
- * elements.
- *
- * @param parent the parent control
- */
- protected final void createButtonsGroup(Composite parent) {
- Composite buttonComposite = SystemWidgetHelpers.createComposite(parent, 3);
- ((GridLayout) buttonComposite.getLayout()).makeColumnsEqualWidth = true;
- selectTypesButton = SystemWidgetHelpers.createPushButton(buttonComposite, null, SystemImportExportResources.RESID_FILEIMPEXP_BUTTON_SELECTTYPES_LABEL,
- SystemImportExportResources.RESID_FILEIMPEXP_BUTTON_SELECTTYPES_TOOLTIP);
- selectAllButton = SystemWidgetHelpers.createPushButton(buttonComposite, null, SystemImportExportResources.RESID_FILEIMPEXP_BUTTON_SELECTALL_LABEL,
- SystemImportExportResources.RESID_FILEIMPEXP_BUTTON_SELECTALL_TOOLTIP);
- deselectAllButton = SystemWidgetHelpers.createPushButton(buttonComposite, null, SystemImportExportResources.RESID_FILEIMPEXP_BUTTON_DESELECTALL_LABEL,
- SystemImportExportResources.RESID_FILEIMPEXP_BUTTON_DESELECTALL_TOOLTIP);
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleTypesEditButtonPressed();
- }
- };
- selectTypesButton.addSelectionListener(listener);
- listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setAllSelections(true);
- }
- };
- selectAllButton.addSelectionListener(listener);
- listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setAllSelections(false);
- }
- };
- deselectAllButton.addSelectionListener(listener);
- }
-
- /** (non-Javadoc)
- * Method declared on IDialogPage.
- */
- public void createControl(Composite parent) {
- parentComposite = new Composite(parent, SWT.NONE);
- parentComposite.setLayout(new GridLayout(1, false));
- parentComposite.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
- super.createControl(parentComposite);
- msgLine = new SystemMessageLine(parentComposite);
- msgLine.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
- if (pendingMessage != null) {
- setMessage(pendingMessage);
- }
- if (pendingErrorMessage != null) {
- setErrorMessage(pendingErrorMessage);
- }
- if (pendingString != null) {
- setMessage(pendingString);
- }
- if (pendingErrorString != null) {
- setErrorMessage(pendingErrorString);
- }
- validateSourceGroup();
- // if source not set from remote file selection, set focus to source name field
- if (!initSourceNameSet) {
- sourceNameField.setFocus();
- }
- // otherwise, set focus to selection group
- else {
- selectionGroup.setFocus();
- }
- SystemWidgetHelpers.setWizardPageMnemonics(parentComposite);
- if (helpId != null) {
- SystemWidgetHelpers.setHelp(parentComposite, helpId);
- } else {
- SystemWidgetHelpers.setHelp(parentComposite, RemoteImportExportPlugin.HELPPREFIX + "import_context"); //$NON-NLS-1$
- }
- setControl(parentComposite);
- // SystemWidgetHelpers.setHelp(getControl(), RemoteImportExportPlugin.HELPPREFIX + "import_context");
- // Control c = getControl();
- // if (c instanceof Composite)
- // {
- // SystemWidgetHelpers.setWizardPageMnemonics((Composite)c);
- // parentComposite = (Composite)c;
- // if (helpId != null)
- // SystemWidgetHelpers.setHelp(parentComposite, helpId);
- // }
- // else if (c instanceof Button)
- // {
- // Mnemonics ms = new Mnemonics();
- // ms.setMnemonic((Button)c);
- // }
- // configureMessageLine();
- }
-
- /**
- * Create the import options specification widgets.
- */
- protected void createOptionsGroupButtons(Group optionsGroup) {
- reviewSynchronizeCheckbox = SystemWidgetHelpers.createCheckBox(optionsGroup, 1, null, SystemImportExportResources.RESID_FILEIMPORT_REVIEW_LABEL,
- SystemImportExportResources.RESID_FILEIMPORT_REVIEW_TOOLTIP);
- reviewSynchronizeCheckbox.addListener(SWT.Selection, this);
- overwriteExistingResourcesCheckbox = SystemWidgetHelpers.createCheckBox(optionsGroup, 1, null, SystemImportExportResources.RESID_FILEIMPORT_OPTION_OVERWRITE_LABEL,
- SystemImportExportResources.RESID_FILEIMPORT_OPTION_OVERWRITE_TOOLTIP);
- createContainerStructureButton = SystemWidgetHelpers.createRadioButton(optionsGroup, null, SystemImportExportResources.RESID_FILEIMPORT_OPTION_CREATEALL_LABEL,
- SystemImportExportResources.RESID_FILEIMPORT_OPTION_CREATEALL_TOOLTIP);
- createOnlySelectedButton = SystemWidgetHelpers.createRadioButton(optionsGroup, null, SystemImportExportResources.RESID_FILEIMPORT_OPTION_CREATESEL_LABEL,
- SystemImportExportResources.RESID_FILEIMPORT_OPTION_CREATESEL_TOOLTIP);
- createOnlySelectedButton.setSelection(true);
- Composite comp = SystemWidgetHelpers.createComposite(optionsGroup, 3);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- layout.marginWidth = 0;
- comp.setLayout(layout);
- comp.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
- saveSettingsButton = SystemWidgetHelpers.createCheckBox(comp, 3, null, SystemImportExportResources.RESID_FILEIMPORT_OPTION_SETTINGS_LABEL,
- SystemImportExportResources.RESID_FILEIMPORT_OPTION_SETTINGS_TOOLTIP);
- saveSettingsButton.addListener(SWT.Selection, this);
- descFilePathLabel = new Label(comp, SWT.NONE);
- descFilePathLabel.setText(SystemImportExportResources.RESID_FILEIMPORT_OPTION_SETTINGS_DESCFILE_LABEL);
- GridData data = new GridData();
- descFilePathLabel.setLayoutData(data);
- descFilePathField = new Text(comp, SWT.SINGLE | SWT.BORDER);
- descFilePathField.setToolTipText(SystemImportExportResources.RESID_FILEIMPORT_OPTION_SETTINGS_DESCFILE_PATH_TOOLTIP);
- data = new GridData();
- data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_FILL;
- data.grabExcessHorizontalSpace = true;
- data.widthHint = convertWidthInCharsToPixels(60);
- descFilePathField.setLayoutData(data);
- descFilePathField.addListener(SWT.Modify, this);
- descFileBrowseButton = SystemWidgetHelpers.createPushButton(comp, null, SystemImportExportResources.RESID_FILEIMPORT_OPTION_SETTINGS_DESCFILE_BROWSE_LABEL,
- SystemImportExportResources.RESID_FILEIMPORT_OPTION_SETTINGS_DESCFILE_BROWSE_TOOLTIP);
- descFileBrowseButton.addListener(SWT.Selection, this);
- }
-
- /**
- * Create the group for creating the root directory
- */
- protected void createRootDirectoryGroup(Composite parent) {
- Composite sourceContainerGroup = SystemWidgetHelpers.createComposite(parent, 3);
- ((GridData) sourceContainerGroup.getLayoutData()).grabExcessHorizontalSpace = true;
- sourceNameField = SystemWidgetHelpers.createLabeledReadonlyCombo(sourceContainerGroup, null, SystemImportExportResources.RESID_FILEIMPORT_SOURCE_LABEL,
- SystemImportExportResources.RESID_FILEIMPORT_SOURCE_TOOLTIP);
- ((GridData) sourceNameField.getLayoutData()).widthHint = SIZING_TEXT_FIELD_WIDTH;
- ((GridData) sourceNameField.getLayoutData()).grabExcessHorizontalSpace = true;
- sourceNameField.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateFromSourceField();
- }
- });
- sourceNameField.addKeyListener(new KeyListener() {
- /*
- * @see KeyListener.keyPressed
- */
- public void keyPressed(KeyEvent e) {
- //If there has been a key pressed then mark as dirty
- entryChanged = true;
- }
-
- /*
- * @see KeyListener.keyReleased
- */
- public void keyReleased(KeyEvent e) {
- }
- });
- sourceNameField.addFocusListener(new FocusListener() {
- /*
- * @see FocusListener.focusGained(FocusEvent)
- */
- public void focusGained(FocusEvent e) {
- //Do nothing when getting focus
- }
-
- /*
- * @see FocusListener.focusLost(FocusEvent)
- */
- public void focusLost(FocusEvent e) {
- //Clear the flag to prevent constant update
- if (entryChanged) {
- entryChanged = false;
- updateFromSourceField();
- }
- }
- });
- // source browse button
- sourceBrowseButton = SystemWidgetHelpers.createPushButton(sourceContainerGroup, null, SystemImportExportResources.RESID_FILEEXPORT_DESTINATION_BROWSE_LABEL,
- SystemImportExportResources.RESID_FILEEXPORT_DESTINATION_BROWSE_TOOLTIP);
- ((GridData) sourceBrowseButton.getLayoutData()).grabExcessHorizontalSpace = false;
- sourceBrowseButton.addListener(SWT.Selection, this);
- }
-
- /**
- * Update the receiver from the source name field.
- */
- private void updateFromSourceField() {
- setSourceName(sourceNameField.getText());
- //Update enablements when this is selected
- updateWidgetEnablements();
- }
-
- /**
- * Creates and returns a <code>FileSystemElement</code> if the specified
- * file system object merits one. The criteria for this are:
- * Also create the children.
- */
- protected MinimizedFileSystemElement createRootElement(Object fileSystemObject, IImportStructureProvider provider) {
- boolean isContainer = provider.isFolder(fileSystemObject);
- String elementLabel = provider.getLabel(fileSystemObject);
-
- // Use an empty label so that display of the element's full name
- // doesn't include a confusing label
- MinimizedFileSystemElement dummyParent = new MinimizedFileSystemElement("", null, true); //$NON-NLS-1$
- MinimizedFileSystemElement result = new MinimizedFileSystemElement(elementLabel, dummyParent, isContainer);
- result.setFileSystemObject(fileSystemObject);
-
- if (_queryAllJob == null){
- _queryAllJob = new QueryAllJob(fileSystemObject, provider, result);
- _queryAllJob.schedule();
- }
-
- ////Get the files for the element so as to build the first level
- //result.getFiles(provider);
-
- return dummyParent;
- }
-
-
- /**
- * Create the import source specification widgets
- */
- protected void createSourceGroup(Composite parent) {
- sourceComposite = parent;
- createRootDirectoryGroup(parent);
- createFileSelectionGroup(parent);
- createButtonsGroup(parent);
- }
-
- /**
- * Enable or disable the button group.
- */
- protected void enableButtonGroup(boolean enable) {
- selectTypesButton.setEnabled(enable);
- selectAllButton.setEnabled(enable);
- deselectAllButton.setEnabled(enable);
- }
-
- /**
- * Answer a boolean indicating whether the specified source currently exists
- * and is valid
- */
- protected boolean ensureSourceIsValid() {
- if (((File) sourceDirectory).isDirectory()) return true;
- String msgTxt = RemoteImportExportResources.FILEMSG_FOLDER_IS_FILE;
- String msgDetails = NLS.bind(RemoteImportExportResources.FILEMSG_FOLDER_IS_FILE_DETAILS, ((File)sourceDirectory).getAbsolutePath());
-
- SystemMessage msg = new SimpleSystemMessage(RemoteImportExportPlugin.PLUGIN_ID,
- IRemoteImportExportConstants.FILEMSG_FOLDER_IS_FILE,
- IStatus.ERROR, msgTxt, msgDetails);
- setErrorMessage(msg);
- sourceNameField.setFocus();
- return false;
- }
-
- /**
- * Execute the passed import operation. Answer a boolean indicating success.
- */
- protected boolean executeImportOperation(RemoteFileImportOperation op) {
- try {
- getContainer().run(true, true, op);
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) {
- displayErrorDialog(e.getTargetException());
- return false;
- }
- IStatus status = op.getStatus();
- if (!status.isOK()) {
- if (status.isMultiStatus()){
- if (((MultiStatus)status).getChildren().length > 0){
- status = ((MultiStatus)status).getChildren()[0];
- }
- }
- String msgTxt = NLS.bind(RemoteImportExportResources.MSG_IMPORT_EXPORT_UNEXPECTED_EXCEPTION, status.getMessage());
-
- SystemMessage msg = null;
- if (status.getException() != null){
- msg = new SimpleSystemMessage(RemoteImportExportPlugin.PLUGIN_ID,
- IRemoteImportExportConstants.FILEMSG_IMPORT_FAILED,
- IStatus.ERROR, msgTxt, status.getException());
- } else {
- msg = new SimpleSystemMessage(RemoteImportExportPlugin.PLUGIN_ID,
- IRemoteImportExportConstants.FILEMSG_IMPORT_FAILED,
- IStatus.ERROR, msgTxt);
- }
-
- SystemMessageDialog dlg = new SystemMessageDialog(getContainer().getShell(), msg);
- dlg.openWithDetails();
- return false;
- }
- return true;
- }
-
- /**
- * The Finish button was pressed. Try to do the required work now and answer
- * a boolean indicating success. If false is returned then the wizard will
- * not close.
- *
- * @return boolean
- */
- public boolean finish() {
- clearMessage();
- clearErrorMessage();
- Object file;
- IHost conn;
- String temp;
- if (!ensureSourceIsValid()) return false;
- saveWidgetValues();
- Iterator resourcesEnum = getSelectedResources().iterator();
- List fileSystemObjects = new ArrayList();
- conn = Utilities.parseForSystemConnection(sourceNameField.getText());
- while (resourcesEnum.hasNext()) {
- Object fo = ((FileSystemElement) resourcesEnum.next()).getFileSystemObject();
- temp = ((File) fo).getAbsolutePath();
- if (UniFilePlus.class.isInstance(fo))
- file = fo;
- else
- file = new UniFilePlus(Utilities.getIRemoteFile(conn, temp));
- fileSystemObjects.add(file);
- }
- if (fileSystemObjects.size() > 0) {
- RemoteFileImportData data = new RemoteFileImportData();
- data.setContainerPath(getContainerFullPath());
- data.setSource(getSourceDirectory());
- data.setElements(fileSystemObjects);
- data.setOverWriteExistingFiles(overwriteExistingResourcesCheckbox.getSelection());
- data.setCreateDirectoryStructure(createContainerStructureButton.getSelection());
- data.setCreateSelectionOnly(createOnlySelectedButton.getSelection());
- data.setSaveSettings(saveSettingsButton.getSelection());
- data.setDescriptionFilePath(getDescriptionLocation());
-
- if (!reviewSynchronizeCheckbox.getSelection()) {
- boolean ret = executeImportOperation(new RemoteFileImportOperation(data, FileSystemStructureProvider.INSTANCE, this));
- return ret;
- } else {
- // run synchronization
- SynchronizeData data2 = null;
- try {
- data2 = new SynchronizeData(data);
- } catch (SystemMessageException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- if (reviewSynchronizeCheckbox.getSelection()) {
- data2.setSynchronizeType(ISynchronizeOperation.SYNC_MODE_UI_REVIEW_INITIAL);
- }
-
- boolean ret = false;
-
- try {
- ret = new Synchronizer(data2).run(new SynchronizeOperation());
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- // save description after synchronize operation
- try {
- if (data.isSaveSettings()) {
- RSESyncUtils.saveDescription(data);
- }
- } catch (CoreException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- } catch (IOException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- return ret;
- }
- }
- String msgTxt = RemoteImportExportResources.FILEMSG_IMPORT_NONE_SELECTED;
- String msgDetails = RemoteImportExportResources.FILEMSG_IMPORT_NONE_SELECTED_DETAILS;
-
- SystemMessage msg = new SimpleSystemMessage(RemoteImportExportPlugin.PLUGIN_ID,
- IRemoteImportExportConstants.FILEMSG_IMPORT_NONE_SELECTED,
- IStatus.ERROR, msgTxt, msgDetails);
- setErrorMessage(msg);
- return false;
- }
-
-
-
-
- /**
- * Returns a content provider for <code>FileSystemElement</code>s that returns
- * only files as children.
- */
- protected ITreeContentProvider getFileProvider() {
- //IFS: add BusyIndicator
- return new WorkbenchContentProvider() {
- boolean busy = false;
-
- public Object[] getChildren(Object o) {
- if (o instanceof MinimizedFileSystemElement && !busy) {
- final MinimizedFileSystemElement element = (MinimizedFileSystemElement) o;
- final Object[] oa = new Object[1];
- busy = true;
- BusyIndicator.showWhile(sourceComposite.getDisplay(), new Runnable() {
- public void run() {
- oa[0] = element.getFiles(FileSystemStructureProvider.INSTANCE).getChildren(element);
- }
- });
- busy = false;
- return (Object[]) oa[0];
- }
- return new Object[0];
- }
- };
- }
-
- /**
- * Answer the root FileSystemElement that represents the contents of
- * the currently-specified source. If this FileSystemElement is not
- * currently defined then create and return it.
- */
- protected MinimizedFileSystemElement getFileSystemTree() {
- File sourceDirectory = getSourceDirectory();
- if (sourceDirectory == null) return null;
-
- if (_fileSystemTree == null){
- _fileSystemTree = selectFiles(sourceDirectory, FileSystemStructureProvider.INSTANCE);
- }
- return _fileSystemTree;
- }
-
- /**
- * Returns a content provider for <code>FileSystemElement</code>s that returns
- * only folders as children.
- */
- protected ITreeContentProvider getFolderProvider() {
- //IFS: add BusyIndicator
- return new WorkbenchContentProvider() {
- boolean busy = false;
-
- public Object[] getChildren(Object o) {
- if (o instanceof MinimizedFileSystemElement && !busy) {
- final MinimizedFileSystemElement element = (MinimizedFileSystemElement) o;
- final Object[] oa = new Object[1];
- busy = true;
- BusyIndicator.showWhile(sourceComposite.getDisplay(), new Runnable() {
- public void run() {
- oa[0] = element.getFolders(FileSystemStructureProvider.INSTANCE).getChildren(element);
- }
- });
- busy = false;
- return (Object[]) oa[0];
- }
- return new Object[0];
- }
-
- public boolean hasChildren(Object o) {
- if (o instanceof MinimizedFileSystemElement) {
- MinimizedFileSystemElement element = (MinimizedFileSystemElement) o;
- if (!element.isPopulated()){
- return true;
- } else {
- return getChildren(element).length > 0;
- }
- }
- return false;
- }
- };
- }
-
- /**
- * Returns this page's collection of currently-specified resources to be
- * imported. This is the primary resource selection facility accessor for
- * subclasses.
- *
- * Added here to allow access for inner classes.
- *
- * @return a collection of resources currently selected
- * for export (element type: <code>IResource</code>)
- */
- protected List getSelectedResources() {
- return super.getSelectedResources();
- }
-
- /**
- * Returns a File object representing the currently-named source directory iff
- * it exists as a valid directory, or <code>null</code> otherwise.
- */
- protected File getSourceDirectory() {
- return getSourceDirectory(this.sourceNameField.getText());
- }
-
- /**
- * Returns a File object representing the currently-named source directory iff
- * it exists as a valid directory, or <code>null</code> otherwise.
- *
- * @param path a String not yet formatted for java.io.File compatability
- */
- private File getSourceDirectory(String path) {
- return (File) sourceDirectory;
- }
-
- /**
- * Answer the directory name specified as being the import source.
- * Note that if it ends with a separator then the separator is first
- * removed so that java treats it as a proper directory
- */
- private String getSourceDirectoryName() {
- return getSourceDirectoryName(this.sourceNameField.getText());
- }
-
- /**
- * Answer the directory name specified as being the import source.
- * Note that if it ends with a separator then the separator is first
- * removed so that java treats it as a proper directory
- */
- private String getSourceDirectoryName(String sourceName) {
- IPath result = new Path(sourceName.trim());
- if (result.getDevice() != null && result.segmentCount() == 0) // something like "c:"
- result = result.addTrailingSeparator();
- else
- result = result.removeTrailingSeparator();
- //return result.toOSString();
- return result.toString();
- }
-
- /**
- * Gets the description.
- * @return the description.
- */
- protected String getDescriptionLocation() {
- return descFilePathField.getText().trim();
- }
-
- /**
- * Returns whether the settings should be saved.
- * @return whether settings should be saved.
- */
- protected boolean isSaveSettings() {
- // need this check
- if (saveSettingsButton != null) {
- return saveSettingsButton.getSelection();
- } else {
- return false;
- }
- }
-
- /**
- * Handle all events and enablements for widgets in this dialog
- *
- * @param event Event
- */
- public void handleEvent(Event event) {
- if (event.widget == sourceBrowseButton) {
- handleSourceBrowseButtonPressed();
- } else if (event.widget == descFileBrowseButton) {
- handleDescriptionFileBrowseButtonPressed();
- }
- super.handleEvent(event);
- }
-
- /**
- * Open an appropriate source browser so that the user can specify a source
- * to import from
- */
- protected void handleSourceBrowseButtonPressed() {
- SystemSelectRemoteFolderAction action = new SystemSelectRemoteFolderAction(this.getShell());
- action.setShowNewConnectionPrompt(true);
- action.setShowPropertySheet(true, false);
- action.setFoldersOnly(true);
- action.run();
- IRemoteFile folder = action.getSelectedFolder();
- if (folder != null) {
- clearErrorMessage();
- setSourceName(Utilities.getAsString(folder));
- selectionGroup.setFocus();
- }
- }
-
- /**
- * Open an appropriate destination browser so that the user can specify a source
- * to import from.
- */
- protected void handleDescriptionFileBrowseButtonPressed() {
- SaveAsDialog dialog = new SaveAsDialog(getContainer().getShell());
- dialog.create();
- dialog.getShell().setText(RemoteImportExportResources.IMPORT_EXPORT_DESCRIPTION_FILE_DIALOG_TITLE);
- dialog.setMessage(RemoteImportExportResources.IMPORT_EXPORT_DESCRIPTION_FILE_DIALOG_MESSAGE);
- dialog.setOriginalFile(createFileHandle(new Path(getDescriptionLocation())));
- if (dialog.open() == Window.OK) {
- IPath path = dialog.getResult();
- path = path.removeFileExtension().addFileExtension(Utilities.IMPORT_DESCRIPTION_EXTENSION);
- descFilePathField.setText(path.toString());
- }
- }
-
- /**
- * Creates a file resource handle for the file with the given workspace path.
- * This method does not create the file resource; this is the responsibility
- * of <code>createFile</code>.
- *
- * @param filePath the path of the file resource to create a handle for
- * @return the new file resource handle
- */
- protected IFile createFileHandle(IPath filePath) {
- if (filePath.isValidPath(filePath.toString()) && filePath.segmentCount() >= 2)
- return SystemBasePlugin.getWorkspace().getRoot().getFile(filePath);
- else
- return null;
- }
-
- /**
- * Open a registered type selection dialog and note the selections
- * in the receivers types-to-export field.,
- * Added here so that inner classes can have access
- */
- protected void handleTypesEditButtonPressed() {
- super.handleTypesEditButtonPressed();
- }
-
- /**
- * Returns whether the extension provided is an extension that
- * has been specified for import by the user.
- * @param extension the resource extension.
- * @return <code>true</code> if the resource name is suitable for import based upon its extension.
- */
- protected boolean isImportableExtension(String extension) {
- // i.e. - all extensions are acceptable
- if (selectedTypes == null) {
- return true;
- }
- Iterator z = selectedTypes.iterator();
- while (z.hasNext()) {
- if (extension.equalsIgnoreCase((String) (z.next()))) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Is the element included in import data.
- * @param element the file element.
- * @return <code>true</code> if the element is included in the import data, <code>false</code> if not.
- */
- protected boolean isIncludedInImportData(MinimizedFileSystemElement element) {
- UniFilePlus file = (UniFilePlus) (element.getFileSystemObject());
- RemoteImportWizard parentWizard = (RemoteImportWizard) getWizard();
- RemoteFileImportData importData = parentWizard.getImportData();
- return importData.doesExist(file);
- }
-
- /**
- * Repopulate the view based on the currently entered directory.
- */
- protected void resetSelection() {
- MinimizedFileSystemElement currentRoot = getFileSystemTree();
- this.selectionGroup.setRoot(currentRoot);
- }
-
- /**
- * Use the dialog store to restore widget values to the values that they held
- * last time this wizard was used to completion
- */
- protected void restoreWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String[] sourceNames = settings.getArray(STORE_SOURCE_NAMES_ID);
- if (sourceNames != null) {
- // set filenames history
- for (int i = 0; i < sourceNames.length; i++) {
- sourceNameField.add(sourceNames[i]);
- }
- }
- RemoteImportWizard parentWizard = (RemoteImportWizard) getWizard();
- boolean isInitializingFromImportData = parentWizard.getInitializeFromImportData();
- if (!isInitializingFromImportData) {
- // radio buttons and checkboxes
- reviewSynchronizeCheckbox.setSelection(settings.getBoolean(STORE_REVIEW_SYNCHRONIZE_ID));
- overwriteExistingResourcesCheckbox.setSelection(settings.getBoolean(STORE_OVERWRITE_EXISTING_RESOURCES_ID));
- boolean createStructure = settings.getBoolean(STORE_CREATE_CONTAINER_STRUCTURE_ID);
- createContainerStructureButton.setSelection(createStructure);
- createOnlySelectedButton.setSelection(!createStructure);
- boolean saveSettings = settings.getBoolean(STORE_CREATE_DESCRIPTION_FILE_ID);
- saveSettingsButton.setSelection(saveSettings);
- String descFilePathStr = settings.get(STORE_DESCRIPTION_FILE_NAME_ID);
- if (descFilePathStr == null) {
- descFilePathStr = ""; //$NON-NLS-1$
- }
- descFilePathField.setText(descFilePathStr);
- } else {
- RemoteFileImportData importData = parentWizard.getImportData();
- // container path
- String containerPath = importData.getContainerPath().toString();
- if (containerPath != null) {
- setContainerFieldValue(containerPath);
- }
- // radio buttons and checkboxes
- reviewSynchronizeCheckbox.setSelection(importData.isReviewSynchronize());
- overwriteExistingResourcesCheckbox.setSelection(importData.isOverWriteExistingFiles());
- createContainerStructureButton.setSelection(importData.isCreateDirectoryStructure());
- createOnlySelectedButton.setSelection(importData.isCreateSelectionOnly());
- saveSettingsButton.setSelection(importData.isSaveSettings());
- String descFilePathStr = importData.getDescriptionFilePath();
- if (descFilePathStr == null) {
- descFilePathStr = ""; //$NON-NLS-1$
- }
- descFilePathField.setText(descFilePathStr);
- UniFilePlus source = (UniFilePlus) (importData.getSource());
- if (source != null) {
- setSourceName(source.getCanonicalPath());
- }
- }
- }
- // check if there was an initial selection
- // if it is a remote directory, then set the absolute path in the source name field
- Object initSelection = getInputObject();
- if ((initSelection != null) && (initSelection instanceof IStructuredSelection)) {
- IStructuredSelection sel = (IStructuredSelection) initSelection;
- if (sel.size() == 1) {
- Object theSel = sel.getFirstElement();
- if (theSel instanceof IRemoteFile) {
- IRemoteFile file = (IRemoteFile) theSel;
- // set source name if the input is a folder
- if (file.isDirectory()) {
- setSourceName(Utilities.getAsString(file));
- // indicate source name set initially from remote folder selection
- initSourceNameSet = true;
- }
- }
- }
- }
- }
-
- /**
- * Since Finish was pressed, write widget values to the dialog store so that they
- * will persist into the next invocation of this wizard page
- */
- protected void saveWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- // update source names history
- String[] sourceNames = settings.getArray(STORE_SOURCE_NAMES_ID);
- if (sourceNames == null) sourceNames = new String[0];
- sourceNames = addToHistory(sourceNames, getSourceDirectoryName());
- settings.put(STORE_SOURCE_NAMES_ID, sourceNames);
- // radio buttons and checkboxes
- settings.put(STORE_REVIEW_SYNCHRONIZE_ID, reviewSynchronizeCheckbox.getSelection());
- settings.put(STORE_OVERWRITE_EXISTING_RESOURCES_ID, overwriteExistingResourcesCheckbox.getSelection());
- settings.put(STORE_CREATE_CONTAINER_STRUCTURE_ID, createContainerStructureButton.getSelection());
- settings.put(STORE_CREATE_DESCRIPTION_FILE_ID, isSaveSettings());
- settings.put(STORE_DESCRIPTION_FILE_NAME_ID, getDescriptionLocation());
- }
- }
-
- /**
- * Invokes a file selection operation using the specified file system and
- * structure provider. If the user specifies files to be imported then
- * this selection is cached for later retrieval and is returned.
- */
- protected MinimizedFileSystemElement selectFiles(final Object rootFileSystemObject, final IImportStructureProvider structureProvider) {
- final MinimizedFileSystemElement[] results = new MinimizedFileSystemElement[1];
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- //Create the root element from the supplied file system object
- results[0] = createRootElement(rootFileSystemObject, structureProvider);
- }
- });
- return results[0];
- }
-
- /**
- * Set all of the selections in the selection group to value. Implemented here
- * to provide access for inner classes.
- * @param value boolean
- */
- protected void setAllSelections(boolean value) {
- super.setAllSelections(value);
- }
-
- /**
- * Sets the source name of the import to be the supplied path.
- * Adds the name of the path to the list of items in the
- * source combo and selects it.
- *
- * @param path the path to be added
- */
- protected void setSourceName(String path) {
- if (path.length() > 0) {
- // Clear selection in case this method is Excepted.
- sourceDirectory = null;
- sourceNameField.setText(""); //$NON-NLS-1$
- resetSelection();
- String[] currentItems = this.sourceNameField.getItems();
- int selectionIndex = -1;
- for (int i = 0; i < currentItems.length && selectionIndex < 0; i++) {
- if (currentItems[i].equals(path)) selectionIndex = i;
- }
- if (selectionIndex < 0) { // New one from Browse
- int oldLength = currentItems.length;
- String[] newItems = new String[oldLength + 1];
- System.arraycopy(currentItems, 0, newItems, 0, oldLength);
- newItems[oldLength] = path;
- this.sourceNameField.setItems(newItems);
- selectionIndex = oldLength;
- }
- if (Utilities.isConnectionValid(path, getShell()))
- // At time of writing no exceptions were expected from this code!
- // if one is received, issue it.
- try {
- sourceDirectory = null;
- IHost as400Conn = Utilities.parseForSystemConnection(path);
- if (as400Conn != null) {
- IRemoteFile rf = Utilities.parseForIRemoteFile(path);
- if (rf != null && rf.exists()) sourceDirectory = new UniFilePlus(rf);
- sourceNameField.select(selectionIndex);
- }
- resetSelection();
- } catch (Exception e) {
- Utilities.error(e);
- }
- }
- }
-
- /**
- * Update the tree to only select those elements that match the selected types
- */
- protected void setupSelectionsBasedOnSelectedTypes() {
- ProgressMonitorDialog dialog = new ProgressMonitorDialog(getContainer().getShell());
- final Map selectionMap = new Hashtable();
- final IElementFilter filter = new IElementFilter() {
- public void filterElements(Collection files, IProgressMonitor monitor) throws InterruptedException {
- if (files == null) {
- throw new InterruptedException();
- }
- Iterator filesList = files.iterator();
- while (filesList.hasNext()) {
- if (monitor.isCanceled()) throw new InterruptedException();
- checkFile(filesList.next());
- }
- }
-
- public void filterElements(Object[] files, IProgressMonitor monitor) throws InterruptedException {
- if (files == null) {
- throw new InterruptedException();
- }
- for (int i = 0; i < files.length; i++) {
- if (monitor.isCanceled()) throw new InterruptedException();
- checkFile(files[i]);
- }
- }
-
- private void checkFile(Object fileElement) {
- MinimizedFileSystemElement file = (MinimizedFileSystemElement) fileElement;
- if (isImportableExtension(file.getFileNameExtension())) {
- List elements = new ArrayList();
- FileSystemElement parent = file.getParent();
- if (selectionMap.containsKey(parent)) elements = (List) selectionMap.get(parent);
- elements.add(file);
- selectionMap.put(parent, elements);
- }
- }
- };
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(final IProgressMonitor monitor) throws InterruptedException {
-
- String msg = RemoteImportExportResources.FILEMSG_IMPORT_FILTERING;
- monitor.beginTask(msg, IProgressMonitor.UNKNOWN);
- getSelectedResources(filter, monitor);
- }
- };
- try {
- // have to set fork to false to avoid InvocationTargetException !!
- dialog.run(false, true, runnable);
- } catch (InvocationTargetException exception) {
- //Couldn't start. Do nothing.
- return;
- } catch (InterruptedException exception) {
- //Got interrupted. Do nothing.
- return;
- }
- // make sure that all paint operations caused by closing the progress
- // dialog get flushed, otherwise extra pixels will remain on the screen until
- // updateSelections is completed
- getShell().update();
- // The updateSelections method accesses SWT widgets so cannot be executed
- // as part of the above progress dialog operation since the operation forks
- // a new process.
- updateSelections(selectionMap);
- }
-
- /**
- * Update the tree to only select those elements that are in the import data.
- */
- protected void setupSelectionsBasedOnImportData() {
- ProgressMonitorDialog dialog = new ProgressMonitorDialog(getContainer().getShell());
- final Map selectionMap = new Hashtable();
- final IElementFilter filter = new IElementFilter() {
- public void filterElements(Collection files, IProgressMonitor monitor) throws InterruptedException {
- if (files == null) {
- throw new InterruptedException();
- }
- Iterator filesList = files.iterator();
- while (filesList.hasNext()) {
- if (monitor.isCanceled()) {
- throw new InterruptedException();
- }
- checkFile(filesList.next());
- }
- }
-
- public void filterElements(Object[] files, IProgressMonitor monitor) throws InterruptedException {
- if (files == null) {
- throw new InterruptedException();
- }
- for (int i = 0; i < files.length; i++) {
- if (monitor.isCanceled()) {
- throw new InterruptedException();
- }
- checkFile(files[i]);
- }
- }
-
- private void checkFile(Object fileElement) {
- MinimizedFileSystemElement file = (MinimizedFileSystemElement) fileElement;
- if (isIncludedInImportData(file)) {
- List elements = new ArrayList();
- FileSystemElement parent = file.getParent();
- if (selectionMap.containsKey(parent)) {
- elements = (List) (selectionMap.get(parent));
- }
- elements.add(file);
- selectionMap.put(parent, elements);
- }
- }
- };
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(final IProgressMonitor monitor) throws InterruptedException {
- String msg = RemoteImportExportResources.FILEMSG_IMPORT_FILTERING;
- monitor.beginTask(msg, IProgressMonitor.UNKNOWN);
- getSelectedResources(filter, monitor);
- }
- };
- try {
- // have to set fork to false to avoid InvocationTargetException !!
- dialog.run(false, true, runnable);
- } catch (InvocationTargetException exception) {
- //Couldn't start. Do nothing.
- return;
- } catch (InterruptedException exception) {
- //Got interrupted. Do nothing.
- return;
- }
- // make sure that all paint operations caused by closing the progress
- // dialog get flushed, otherwise extra pixels will remain on the screen until
- // updateSelections is completed
- getShell().update();
- // The updateSelections method accesses SWT widgets so cannot be executed
- // as part of the above progress dialog operation since the operation forks
- // a new process.
- updateSelections(selectionMap);
- }
-
- /* (non-Javadoc)
- * Method declared on IDialogPage. Set the selection up when it becomes visible.
- */
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- resetSelection();
- // importing from remote folder selection
- if (initSourceNameSet) {
- setAllSelections(true);
- selectionGroup.setFocus();
- }
- RemoteImportWizard parentWizard = (RemoteImportWizard) getWizard();
- boolean isInitializingFromImportData = parentWizard.getInitializeFromImportData();
- // initializing from import data
- if (isInitializingFromImportData) {
- setAllSelections(true);
- setupSelectionsBasedOnImportData();
- }
- }
-
- /**
- * Update the selections with those in map . Implemented here to give inner class
- * visibility
- * @param map Map - key tree elements, values Lists of list elements
- */
- protected void updateSelections(Map map) {
- super.updateSelections(map);
- }
-
- /**
- * Check if widgets are enabled or disabled by a change in the dialog.
- * Provided here to give access to inner classes.
- */
- protected void updateWidgetEnablements() {
- // need this check because handleEvent(), which calls this, is called when restoring container
- if (saveSettingsButton != null && descFilePathLabel != null && descFilePathField != null && descFileBrowseButton != null) {
- boolean isSaveSettings = isSaveSettings();
- descFilePathLabel.setEnabled(isSaveSettings);
- descFilePathField.setEnabled(isSaveSettings);
- descFileBrowseButton.setEnabled(isSaveSettings);
- }
-
- // if review is selected, the other options are grayed out without save settings
- if (reviewSynchronizeCheckbox != null){ // event handling could come before the widgets are created
- boolean isReview = reviewSynchronizeCheckbox.getSelection();
- overwriteExistingResourcesCheckbox.setEnabled(!isReview);
- createContainerStructureButton.setEnabled(!isReview);
- createOnlySelectedButton.setEnabled(!isReview);
- }
-
-
- // this calls to determine whether page can be completed
- super.updateWidgetEnablements();
- }
-
- /**
- * Answer a boolean indicating whether self's source specification
- * widgets currently all contain valid values.
- */
- protected boolean validateSourceGroup() {
- File sourceDirectory = getSourceDirectory();
- if (sourceDirectory == null) {
- setMessage(SOURCE_EMPTY_MESSAGE);
- enableButtonGroup(false);
- return false;
- }
- if (sourceConflictsWithDestination(new Path(sourceDirectory.getPath()))) {
- setErrorMessage(getSourceConflictMessage());
- enableButtonGroup(false);
- return false;
- }
- enableButtonGroup(true);
- return true;
- }
-
- /**
- * @see org.eclipse.ui.dialogs.WizardDataTransferPage#validateOptionsGroup()
- */
- protected boolean validateOptionsGroup() {
- if (isSaveSettings()) {
- IPath location = new Path(getDescriptionLocation());
- // if location is empty, no error message, but it's not valid
- if (location.toString().length() == 0) {
- setErrorMessage((String) null);
- return false;
- }
- // location must start with '/'
- if (!location.toString().startsWith("/")) { //$NON-NLS-1$
- setErrorMessage(RemoteImportExportResources.IMPORT_EXPORT_ERROR_DESCRIPTION_ABSOLUTE);
- return false;
- }
- // find the resource, including a variant if any
- IResource resource = findResource(location);
- // if resource is not a file, it must be a container. So location is pointing to a container, which is an error
- if (resource != null && resource.getType() != IResource.FILE) {
- setErrorMessage(RemoteImportExportResources.IMPORT_EXPORT_ERROR_DESCRIPTION_EXISTING_CONTAINER);
- return false;
- }
- // get the resource (or any variant of it) after removing the last segment
- // this gets the parent resource
- resource = findResource(location.removeLastSegments(1));
- // if parent resource does not exist, or if it is a file, then it is not valid
- if (resource == null || resource.getType() == IResource.FILE) {
- setErrorMessage(RemoteImportExportResources.IMPORT_EXPORT_ERROR_DESCRIPTION_NO_CONTAINER);
- return false;
- }
- // get the file extension
- String fileExtension = location.getFileExtension();
- // ensure that file extension is valid
- if (fileExtension == null || !fileExtension.equals(Utilities.IMPORT_DESCRIPTION_EXTENSION)) {
- setErrorMessage(NLS.bind(RemoteImportExportResources.IMPORT_EXPORT_ERROR_DESCRIPTION_INVALID_EXTENSION, Utilities.IMPORT_DESCRIPTION_EXTENSION));
- return false;
- }
- }
- return true;
- }
-
- /**
- * Returns the resource for the specified path.
- *
- * @param path the path for which the resource should be returned
- * @return the resource specified by the path or <code>null</code>
- */
- protected IResource findResource(IPath path) {
- IWorkspace workspace = SystemBasePlugin.getWorkspace();
- // validate path
- IStatus result = workspace.validatePath(path.toString(), IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE);
- // if path valid
- if (result.isOK()) {
- // get the workspace root
- IWorkspaceRoot root = workspace.getRoot();
- // see if path exists. If it does, return the resource at the path
- if (root.exists(path)) {
- return root.findMember(path);
- }
- // see if a variant of the path exists
- else {
- // look for variant
- IResource variant = RemoteImportExportUtil.getInstance().findExistingResourceVariant(path);
- // if a variant does exist, return it
- if (variant != null) {
- return variant;
- }
- }
- }
- return null;
- }
-
- /**
- * Returns whether the source location conflicts
- * with the destination resource. This will occur if
- * the source is already under the destination.
- *
- * @param sourcePath the path to check
- * @return <code>true</code> if there is a conflict, <code>false</code> if not
- */
- protected boolean sourceConflictsWithDestination(IPath sourcePath) {
- IContainer container = getSpecifiedContainer();
- if (container == null)
- return false;
- else {
- if (container.getLocation() == null){
- // this is an EFS project
- return false;
- }
- else {
- return container.getLocation().isPrefixOf(sourcePath);
- }
- }
- }
-
- /* (non-Javadoc)
- * @see com.ibm.etools.systems.core.ui.wizards.ISystemWizardPage#setInputObject(java.lang.Object)
- */
- public void setInputObject(Object inputObject) {
- this.inputObject = inputObject;
- }
-
- /* (non-Javadoc)
- * @see com.ibm.etools.systems.core.ui.wizards.ISystemWizardPage#getInputObject()
- */
- public Object getInputObject() {
- return inputObject;
- }
-
- /* (non-Javadoc)
- * @see com.ibm.etools.systems.core.ui.wizards.ISystemWizardPage#performFinish()
- */
- public boolean performFinish() {
- return finish();
- }
-
- public void cancel() {
- if (_queryAllJob != null && _queryAllJob.isActive()){
- _queryAllJob.cancel();
- }
- }
-
-
-
- /* (non-Javadoc)
- * @see com.ibm.etools.systems.core.ui.wizards.ISystemWizardPage#setHelp(java.lang.String)
- */
- public void setHelp(String id) {
- if (parentComposite != null) SystemWidgetHelpers.setHelp(parentComposite, helpId);
- this.helpId = id;
- }
-
- /* (non-Javadoc)
- * @see com.ibm.etools.systems.core.ui.wizards.ISystemWizardPage#getHelpContextId()
- */
- public String getHelpContextId() {
- return helpId;
- }
-
- // ----------------
- // INTERNAL METHODS
- // ----------------
- /**
- * Internal method <br>
- * Configure the message line
- */
- // private void configureMessageLine()
- // {
- // msgLine = SystemDialogPageMessageLine.createWizardMsgLine(this);
- // if (msgLine!=null)
- // {
- // if (pendingMessage!=null)
- // setMessage(pendingMessage);
- // if (pendingErrorMessage!=null)
- // setErrorMessage(pendingErrorMessage);
- // }
- // }
- // -----------------------------
- // ISystemMessageLine methods...
- // -----------------------------
- /**
- * ISystemMessageLine method. <br>
- * Clears the currently displayed error message and redisplayes
- * the message which was active before the error message was set.
- */
- public void clearErrorMessage() {
- if (msgLine != null) msgLine.clearErrorMessage();
- }
-
- /**
- * ISystemMessageLine method. <br>
- * Clears the currently displayed message.
- */
- public void clearMessage() {
- if (msgLine != null) msgLine.clearMessage();
- }
-
- /**
- * ISystemMessageLine method. <br>
- * Get the currently displayed error text.
- * @return The error message. If no error message is displayed <code>null</code> is returned.
- */
- public SystemMessage getSystemErrorMessage() {
- if (msgLine != null)
- return msgLine.getSystemErrorMessage();
- else
- return null;
- }
-
- /**
- * ISystemMessageLine method. <br>
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(SystemMessage message) {
- if (msgLine != null) {
- if (message != null) {
- msgLine.setErrorMessage(message);
- } else {
- msgLine.clearErrorMessage();
- }
- } else { // not configured yet
- pendingErrorMessage = message;
- }
- }
-
- /**
- * ISystemMessageLine method. <br>
- * Convenience method to set an error message from an exception
- */
- public void setErrorMessage(Throwable exc) {
- if (msgLine != null)
- msgLine.setErrorMessage(exc);
- else {
-
- SystemMessage msg = new SimpleSystemMessage(RemoteImportExportPlugin.PLUGIN_ID,
- ICommonMessageIds.MSG_ERROR_UNEXPECTED,
- IStatus.ERROR,
- CommonMessages.MSG_ERROR_UNEXPECTED, exc);
- pendingErrorMessage = msg;
- }
- }
-
- /**
- * ISystemMessageLine method. <br>
- * Display the given error message. A currently displayed message
- * is saved and will be redisplayed when the error message is cleared.
- */
- public void setErrorMessage(String message) {
- if (msgLine != null) {
- if (message != null) {
- msgLine.setErrorMessage(message);
- } else {
- msgLine.clearErrorMessage();
- }
- } else { // not configured yet
- pendingErrorString = message;
- }
- }
-
- /**
- * ISystemMessageLine method. <br>
- * If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage
- */
- public void setMessage(SystemMessage message) {
- if (msgLine != null) {
- msgLine.setMessage(message);
- } else { // not configured yet
- pendingMessage = message;
- }
- }
-
- /**
- * ISystemMessageLine method. <br>
- * Set the non-error message text. If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage
- */
- public void setMessage(String message) {
- if (msgLine != null) {
- msgLine.setMessage(message);
- } else { // not configured yet
- pendingString = message;
- }
- }
-
- public boolean determinePageCompletion(){
- if (_queryAllJob != null && _queryAllJob.isActive()){
- return false;
- }
- return super.determinePageCompletion();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/TreeExpandDropListener.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/TreeExpandDropListener.java
deleted file mode 100644
index 3d4e26186..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/TreeExpandDropListener.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.DropTargetAdapter;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * TreeExpandDropListener provides automatic expansion for Trees during drag and drop
- * operations.
- * <p>
- * If the pointer hovers for a time over an item in the Tree that has not yet been
- * expanded, the item is expanded automatically. This behaviour is consistent with
- * that of popular GUI systems.
- * </p><p>
- * To use it send addDropListener(new TreeExpandDropListener(tree)) to the DropTarget
- * object attached to the Tree.
- * </p>
- */
-public class TreeExpandDropListener extends DropTargetAdapter {
- public static final long DEFAULT_EXPAND_DELAY = 1000; // millis
- private long hoverThreshhold = DEFAULT_EXPAND_DELAY;
- private long hoverBegin = 0;
- private TreeItem hoverItem = null;
- private Tree tree;
-
- /**
- * Constructs a Tree expanding Drop Listener
- *
- * @param tree the Tree that the DropTarget is attached to
- */
- public TreeExpandDropListener(final Tree tree) {
- this.tree = tree;
- }
-
- /**
- * Handles dragEnter events.
- * This is an implementation detail.
- */
- public void dragEnter(DropTargetEvent event) {
- hoverItem = null;
- }
-
- /**
- * Handles dragOver events.
- * This is an implementation detail.
- */
- public void dragOver(DropTargetEvent event) {
- Point point = tree.toControl(new Point(event.x, event.y));
- // Get the item directly under the point
- TreeItem item = tree.getItem(point);
- if (item != hoverItem) {
- // We just started hovering, remember this item
- if ((item != null) && (!item.getExpanded())) {
- hoverBegin = System.currentTimeMillis();
- hoverItem = item;
- } else {
- hoverItem = null;
- }
- } else if (hoverItem != null) {
- // We've been hovering for a while, expand if our timer elapsed
- long hoverCurrent = System.currentTimeMillis();
- if (hoverCurrent - hoverBegin >= hoverThreshhold) {
- // Fake as if the user expanded the item manually
- Event hoverEvent = new Event();
- hoverEvent.x = event.x;
- hoverEvent.y = event.y;
- hoverEvent.item = hoverItem;
- hoverEvent.time = (int) hoverCurrent;
- hoverItem.setExpanded(true);
- hoverItem = null;
- tree.notifyListeners(SWT.Expand, hoverEvent);
- }
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/TreeScrollDropListener.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/TreeScrollDropListener.java
deleted file mode 100644
index e99e1ec7e..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/TreeScrollDropListener.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import org.eclipse.swt.dnd.DropTargetAdapter;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * TreeScrollDropListener provides automatic scrolling for Trees during drag and drop
- * operations.
- * <p>
- * If the pointer drags over an item in the Tree near its upper or
- * lower edges, the Tree will scroll so as to make previous or successive items visible
- * onscreen. This behaviour is consistent with that of popular GUI systems.
- * </p><p>
- * To use it send addDropListener(new TreeScrollDropListener(tree)) to the DropTarget
- * object attached to the Tree.
- * </p>
- */
-public class TreeScrollDropListener extends DropTargetAdapter {
- private Tree tree;
-
- /**
- * Constructs a Tree scrolling Drop Listener
- *
- * @param tree the Tree that the DropTarget is attached to
- */
- public TreeScrollDropListener(final Tree tree) {
- this.tree = tree;
- }
-
- /**
- * Handles dragOver events.
- * This is an implementation detail.
- */
- public void dragOver(DropTargetEvent event) {
- Point point = tree.toControl(new Point(event.x, event.y));
- // Get the item directly under the point
- TreeItem item = tree.getItem(point);
- if (item == null) return;
- // Determine scroll direction according to whether we're nearer the top, middle, or bottom
- Rectangle clientArea = tree.getClientArea();
- int scrollRegionSize = Math.min(clientArea.height / 3, 24); // cut region into 3 parts
- if (scrollRegionSize < 8) return; // don't scroll if the control is too small to make sense
- TreeItem showItem = item;
- for (;;) {
- if (point.y < clientArea.y + scrollRegionSize) {
- // in upper region
- showItem = getPreviousVisibleItem(tree, showItem);
- } else if (point.y > clientArea.height + clientArea.y - scrollRegionSize) {
- // in lower region
- showItem = getNextVisibleItem(tree, showItem, false);
- } else {
- // in middle region
- break;
- }
- // Show the item (causes a scroll if it is outside of the visible region)
- if (showItem == null) break;
- tree.showItem(showItem);
- // Test that we actually scrolled, if we didn't try again with the next item
- if (item != tree.getItem(point)) break;
- }
- }
-
- /**
- * Given a TreeItem, locates its last (lowest) visible item
- * <p>
- * Note that the item may not be actually rendered onscreen though it would be
- * visible were the control scrolled appropriately.
- * </p>
- *
- * @param item the TreeItem whose last visible child is to be found
- * @return the last visible child, or <code>item</code> if no visible children.
- */
- private TreeItem getLastVisibleChild(TreeItem item) {
- if (!item.getExpanded()) return item;
- TreeItem[] items = item.getItems();
- if (items == null || items.length == 0) return item;
- return getLastVisibleChild(items[items.length - 1]);
- }
-
- /**
- * Given a TreeItem, locates the following (below the specified item) visible TreeItem in a tree.
- * <p>
- * Note that the item may not be actually rendered onscreen though it would be
- * visible were the control scrolled appropriately.
- * </p>
- *
- * @param tree the Tree containing the items
- * @param item the TreeItem whose next visible neighbour is to be found
- * @return the next visible item, or null if none.
- */
- private TreeItem getNextVisibleItem(Tree tree, TreeItem item, boolean ignoreChildren) {
- TreeItem parent = item.getParentItem();
- TreeItem[] items = (parent != null) ? parent.getItems() : tree.getItems();
- if (items != null) {
- for (int i = 0; i < items.length; ++i) {
- if (items[i] == item) {
- if (!ignoreChildren && items[i].getExpanded()) {
- TreeItem[] children = items[i].getItems();
- if (children != null && children.length > 0) return children[0];
- }
- if (i + 1 < items.length) return items[i + 1];
- break;
- }
- }
- if (parent != null) return getNextVisibleItem(tree, parent, true);
- }
- return null;
- }
-
- /**
- * Given a TreeItem, locates the previous (above the specified item) visible TreeItem in a tree.
- * <p>
- * Note that the item may not be actually rendered onscreen though it would be
- * visible were the control scrolled appropriately.
- * </p>
- *
- * @param tree the Tree containing the items
- * @param item the TreeItem whose previous visible neighbour is to be found
- * @return the previous visible item, or null if none.
- */
- private TreeItem getPreviousVisibleItem(Tree tree, TreeItem item) {
- TreeItem parent = item.getParentItem();
- TreeItem[] items = (parent != null) ? parent.getItems() : tree.getItems();
- if (items != null) {
- for (int i = items.length - 1; i > 0; --i) {
- if (items[i] == item) return getLastVisibleChild(items[i - 1]);
- }
- }
- return parent;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/UniFilePlus.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/UniFilePlus.java
deleted file mode 100644
index 1b8f497b8..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/UniFilePlus.java
+++ /dev/null
@@ -1,432 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
- * Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem
- * David McKnight (IBM) - [207178] changing list APIs for file service and subsystems
- * David Dykstal (IBM) [230821] fix IRemoteFileSubSystem API to be consistent with IFileService
- * Takuya Miyamoto - [185925] Integrate Platform/Team Synchronization
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import java.io.File;
-import java.io.FileFilter;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.services.files.RemoteFileException;
-import org.eclipse.rse.services.files.RemoteFileSecurityException;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.SystemBasePlugin;
-
-public class UniFilePlus extends File {
- /**
- *
- */
- private static final long serialVersionUID = -1717648997950319457L;
- public IRemoteFile remoteFile = null;
-
- /**
- * Constructor. There is only one way to construct this object,
- * and that is by giving an IRemoteFile object. All java.io.File
- * methods are intercepted and delegated to this contained object.
- */
- public UniFilePlus(IRemoteFile remoteFile) {
- super(remoteFile.getAbsolutePath());
- this.remoteFile = remoteFile;
- }
-
- public boolean canRead() {
- return remoteFile.canRead();
- }
-
- public boolean canWrite() {
- return remoteFile.canWrite();
- }
-
- public int compareTo(File pathname) {
- if (pathname instanceof UniFilePlus) return remoteFile.compareTo(pathname);
- return super.compareTo(pathname);
- }
-
- /*
- public int compareTo(Object o)
- {
- return remoteFile.compareTo(o);
- }
- */
- public boolean createNewFile() throws IOException {
- IRemoteFile newFile = null;
- try {
- newFile = remoteFile.getParentRemoteFileSubSystem().createFile(remoteFile, new NullProgressMonitor());
- } catch (RemoteFileException exc) {
- Exception e = exc.getRemoteException();
- if (e != null) {
- if (e instanceof SecurityException)
- throw (SecurityException) e;
- else if (e instanceof IOException) throw (IOException) e;
- }
- if (exc instanceof RemoteFileSecurityException)
- throw new SecurityException(exc.getMessage());
- else
- throw new IOException(exc.getMessage());
- } catch (SystemMessageException e) {
- throw new IOException(e.getMessage());
- }
- if (newFile != null) {
- remoteFile = newFile;
- return true;
- } else
- return false;
- }
-
- public boolean delete() {
- boolean ok = true;
- try {
- remoteFile.getParentRemoteFileSubSystem().delete(remoteFile, new NullProgressMonitor());
- //hmm, should we set remoteFile to null?
- } catch (RemoteFileException exc) {
- Exception e = exc.getRemoteException();
- if ((e != null) && (e instanceof SecurityException)) throw (SecurityException) e;
- throw new SecurityException(exc.getMessage());
- } catch (SystemMessageException e) {
- //TODO should there be more user feedback?
- SystemBasePlugin.logMessage(e.getSystemMessage());
- ok = false;
- }
- return ok;
- }
-
- /**
- * NOT SUPPORTED!
- */
- public void deleteOnExit() {
- }
-
- public boolean equals(Object obj) {
- return remoteFile.equals(obj);
- }
-
- public boolean exists() {
- return remoteFile.exists();
- }
-
- public File getAbsoluteFile() {
- return this; // Remote File objects are always absolute!
- }
-
- public String getAbsolutePath() {
- return remoteFile.getAbsolutePath();
- }
-
- public File getCanonicalFile() {
- // hmm, maybe we should equal getAbsolutePathPlusConnection as canonical!
- return this;
- }
-
- public String getCanonicalPath() {
- return remoteFile.getAbsolutePathPlusConnection();
- }
-
- public String getName() {
- return remoteFile.getName();
- }
-
- public String getParent() {
- return remoteFile.getParentPath();
- }
-
- public UniFilePlus getParentFile() {
- IRemoteFile parentFolder = this.remoteFile.getParentRemoteFileSubSystem().getParentFolder(this.remoteFile, null);
-
- if (parentFolder != null) {
- return new UniFilePlus(parentFolder);
- } else
- return null;
- }
-
- public String getPath() {
- return remoteFile.getAbsolutePath();
- }
-
- public int hashCode() {
- return remoteFile.getAbsolutePathPlusConnection().hashCode();
- }
-
- public boolean isAbsolute() {
- return true;
- }
-
- public boolean isDirectory() {
- return remoteFile.isDirectory();
- }
-
- public boolean isFile() {
- return remoteFile.isFile();
- }
-
- public boolean isHidden() {
- return remoteFile.isHidden();
- }
-
- public long lastModified() {
- return remoteFile.getLastModified();
- }
-
- public long length() {
- return remoteFile.getLength();
- }
-
- /**
- * Returns an array of remote files that are children of this folder.
- * This will be an null if there is an error or if the target object
- * is not a folder.
- * @return the array of IRemoteFiles.
- */
- public IRemoteFile[] listIRemoteFiles() {
- IRemoteFile[] result = null;
- try {
- result = remoteFile.getParentRemoteFileSubSystem().list(remoteFile, getNullMonitor());
- } catch (SystemMessageException e) {
- SystemBasePlugin.logError("unexpected exception", e); //$NON-NLS-1$
- }
- return result;
- }
-
- public String[] list() {
- IRemoteFile[] files = null;
- try {
- files = remoteFile.getParentRemoteFileSubSystem().list(remoteFile, getNullMonitor());
- } catch (SystemMessageException e) {
- SystemBasePlugin.logError("unexpected exception", e); //$NON-NLS-1$
- }
- if (files != null) {
- String[] fileNames = new String[files.length];
- for (int idx = 0; idx < files.length; idx++)
- fileNames[idx] = files[idx].getName();
- return fileNames;
- } else
- return null;
- }
-
- public File[] listFiles() {
- IRemoteFile[] files = null;
-
- try {
- files = remoteFile.getParentRemoteFileSubSystem().list(this.remoteFile, null);
- } catch (SystemMessageException e) {
- e.printStackTrace();
- SystemBasePlugin.logError("unexpected exception", e); //$NON-NLS-1$
- }
- if (files != null) {
- Vector<UniFilePlus> children = new Vector<UniFilePlus>();
- for (int i = 0; i < files.length; i++) {
- // fileName = files[idx].getName();
- UniFilePlus fileObj = new UniFilePlus(files[i]);
- children.addElement(fileObj);
- }
- UniFilePlus[] fileObjs = new UniFilePlus[children.size()];
- // for (int i = 0; i < children.size(); i++)
- // fileObjs[i] = (UniFilePlus) children.elementAt(i);
- // return fileObjs;
- return children.toArray(fileObjs);
- } else
- return null;
- }
-
- public String[] list(FilenameFilter filter) {
- IRemoteFile[] files = null;
- try {
- files = remoteFile.getParentRemoteFileSubSystem().list(remoteFile, getNullMonitor());
- } catch (SystemMessageException e) {
- SystemBasePlugin.logError("unexpected exception", e); //$NON-NLS-1$
- }
- if (files != null) {
- Vector v = new Vector();
- String fileName = null;
- for (int idx = 0; idx < files.length; idx++) {
- fileName = files[idx].getName();
- if ((fileName != null) && (filter.accept(this, fileName))) v.addElement(fileName);
- }
- String[] fileNames = new String[v.size()];
- for (int idx = 0; idx < v.size(); idx++)
- fileNames[idx] = (String) v.elementAt(idx);
- return fileNames;
- } else
- return null;
- }
-
- public File[] listFiles(FileFilter filter) {
- IRemoteFile[] files = null;
- try {
- files = remoteFile.getParentRemoteFileSubSystem().list(remoteFile, getNullMonitor());
- } catch (SystemMessageException e) {
- SystemBasePlugin.logError("unexpected exception", e); //$NON-NLS-1$
- }
- if (files != null) {
- Vector v = new Vector();
- for (int idx = 0; idx < files.length; idx++) {
- //fileName = files[idx].getName();
- File fileObj = new File(files[idx].getAbsolutePath());
- if (filter.accept(fileObj)) v.addElement(fileObj);
- }
- File[] fileObjs = new File[v.size()];
- for (int idx = 0; idx < v.size(); idx++)
- fileObjs[idx] = (File) v.elementAt(idx);
- return fileObjs;
- } else
- return null;
- }
-
- public File[] listFiles(FilenameFilter filter) {
- IRemoteFile[] files = null;
- try {
- files = remoteFile.getParentRemoteFileSubSystem().list(remoteFile, getNullMonitor());
- } catch (SystemMessageException e) {
- SystemBasePlugin.logError("unexpected exception", e); //$NON-NLS-1$
- }
- if (files != null) {
- Vector v = new Vector();
- String fileName = null;
- for (int idx = 0; idx < files.length; idx++) {
- fileName = files[idx].getName();
- if ((fileName != null) && (filter.accept(this, fileName))) v.addElement(files[idx]);
- }
- File[] fileObjs = new File[v.size()];
- for (int idx = 0; idx < v.size(); idx++) {
- fileObjs[idx] = new File(((IRemoteFile) v.elementAt(idx)).getAbsolutePath());
- }
- return fileObjs;
- } else
- return null;
- }
-
- public boolean mkdir() {
- IRemoteFile dir = null;
- try {
- if (!remoteFile.exists()) dir = remoteFile.getParentRemoteFileSubSystem().createFolder(remoteFile, new NullProgressMonitor());
- } catch (RemoteFileException exc) {
- Exception e = exc.getRemoteException();
- if ((e != null) && (e instanceof SecurityException)) throw (SecurityException) e;
- throw new SecurityException(exc.getMessage());
- } catch (SystemMessageException e) {
- //TODO should there be more user feedback?
- SystemBasePlugin.logMessage(e.getSystemMessage());
- }
- if (dir != null) remoteFile = dir;
- return (dir != null);
- }
-
- public boolean mkdirs() {
- IRemoteFile dir = null;
- try {
- if (!remoteFile.exists()) dir = remoteFile.getParentRemoteFileSubSystem().createFolders(remoteFile, new NullProgressMonitor());
- } catch (RemoteFileException exc) {
- Exception e = exc.getRemoteException();
- if ((e != null) && (e instanceof SecurityException)) throw (SecurityException) e;
- throw new SecurityException(exc.getMessage());
- } catch (SystemMessageException e) {
- //TODO should there be more user feedback?
- SystemBasePlugin.logMessage(e.getSystemMessage());
- }
- if (dir != null) remoteFile = dir;
- return (dir != null);
- }
-
- public boolean renameTo(File dest) {
- boolean ok = false;
- try {
- remoteFile.getParentRemoteFileSubSystem().rename(remoteFile, dest.getName(), new NullProgressMonitor());
- ok = true;
- } catch (RemoteFileException exc) {
- Exception e = exc.getRemoteException();
- if ((e != null) && (e instanceof SecurityException)) throw (SecurityException) e;
- throw new SecurityException(exc.getMessage());
- } catch (SystemMessageException e) {
- //TODO should there be more user feedback?
- SystemBasePlugin.logMessage(e.getSystemMessage());
- }
- return ok;
- }
-
- public boolean setLastModified(long time) {
- boolean ok = false;
- if (time < 0) throw new IllegalArgumentException();
- try {
- IProgressMonitor monitor = new NullProgressMonitor();
- remoteFile.getParentRemoteFileSubSystem().setLastModified(remoteFile, time, monitor);
- ok = true;
- } catch (RemoteFileException exc) {
- Exception e = exc.getRemoteException();
- if ((e != null) && (e instanceof SecurityException)) throw (SecurityException) e;
- throw new SecurityException(exc.getMessage());
- } catch (SystemMessageException e) {
- //TODO should there be more user feedback?
- SystemBasePlugin.logMessage(e.getSystemMessage());
- }
- return ok;
- }
-
- public boolean setReadOnly() {
- boolean ok = false;
- try {
- remoteFile.getParentRemoteFileSubSystem().setReadOnly(remoteFile, true, new NullProgressMonitor());
- ok = true;
- } catch (RemoteFileException exc) {
- Exception e = exc.getRemoteException();
- if ((e != null) && (e instanceof SecurityException)) throw (SecurityException) e;
- throw new SecurityException(exc.getMessage());
- } catch (SystemMessageException e) {
- //TODO should there be more user feedback?
- SystemBasePlugin.logMessage(e.getSystemMessage());
- }
- return ok;
- }
-
- public String toString() {
- return getPath();
- }
-
- public URL toURL() throws MalformedURLException {
- String urlName = "file://" + remoteFile.getAbsolutePathPlusConnection().replace('\\', '/'); //$NON-NLS-1$
- if (remoteFile.isDirectory() && !urlName.endsWith("/")) //$NON-NLS-1$
- urlName = urlName + '/';
- return new URL(urlName);
- }
-
- private IProgressMonitor getNullMonitor() {
- IProgressMonitor result = new NullProgressMonitor();
- return result;
- }
-
- public IRemoteFile getRemoteFile() {
- return remoteFile;
- }
-
- public InputStream getInputStream() throws SystemMessageException {
- return this.remoteFile.getParentRemoteFileSubSystem().getInputStream(this.remoteFile.getParentPath(), this.remoteFile.getName(), this.remoteFile.isBinary(), null);
- }
-
- public void synchRemoteFile() {
- // get the latest version of the remote file
- remoteFile.markStale(true);
- try {
- remoteFile = remoteFile.getParentRemoteFileSubSystem().getRemoteFileObject(remoteFile.getAbsolutePath(), new NullProgressMonitor());
- }
- catch (Exception e){}
- }
-}
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
deleted file mode 100644
index 30ffcd94d..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/importexport/files/Utilities.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Martin Oberhuber (Wind River) - [180562][api] dont implement IRemoteImportExportConstants
- * Martin Oberhuber (Wind River) - [174945] split importexport icons from rse.ui
- * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
- * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
- *******************************************************************************/
-package org.eclipse.rse.internal.importexport.files;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.internal.importexport.IRemoteImportExportConstants;
-import org.eclipse.rse.internal.importexport.RemoteImportExportPlugin;
-import org.eclipse.rse.internal.importexport.RemoteImportExportResources;
-import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.subsystems.files.core.model.RemoteFileUtility;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Contains several helper methods.
- * A lot of these should really be provided by comm. layer, but for
- * many reasons they were not. oh well ....
- */
-public class Utilities {
- public static final String IMPORT_DESCRIPTION_EXTENSION = IRemoteImportExportConstants.REMOTE_FILE_IMPORT_DESCRIPTION_FILE_EXTENSION;
- public static final String EXPORT_DESCRIPTION_EXTENSION = IRemoteImportExportConstants.REMOTE_FILE_EXPORT_DESCRIPTION_FILE_EXTENSION;
-
- /**
- * Use this method to get IRemoteFile object from SystemConnection, and path
- *
- */
- public static IRemoteFile getIRemoteFile(IHost c, String path) {
- IRemoteFile ret = null;
- 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, new NullProgressMonitor());
- } catch (SystemMessageException e) {
- // get RemoteFileObject has been changed to raise
- // SystemMessageException.
- error(e);
- }
- }
- return ret;
- }
-
- /**
- * Use this method to get selected string from an
- * IRemoteFile object.
- */
- public static String getAsString(IRemoteFile selectedDirectory) {
- return selectedDirectory.getHost().getSystemProfileName() + '.' + selectedDirectory.getHost().getAliasName() + ":" + selectedDirectory.getAbsolutePath(); //$NON-NLS-1$
- }
-
- /**
- * Use this method to get selected string from an
- * UniFilePlus object.
- */
- public static String getAsString(UniFilePlus selectedDirectory) {
- return selectedDirectory.remoteFile.getHost().getSystemProfileName() + '.' + selectedDirectory.remoteFile.getHost().getAliasName() + ":" + selectedDirectory.getPath(); //$NON-NLS-1$
- }
-
- /**
- * Validate remote connection, and issue error if required.
- *
- */
- public static boolean isConnectionValid(String name, Shell s) {
- boolean ret = true;
- IHost sc = parseForSystemConnection(name);
- if (sc == null) {
- // invalid connection
- ret = false;
-
- String msgTxt = RemoteImportExportResources.MSG_IMPORT_EXPORT_UNABLE_TO_USE_CONNECTION;
- String msgDetails = RemoteImportExportResources.MSG_IMPORT_EXPORT_UNABLE_TO_USE_CONNECTION_DETAILS;
-
- SystemMessage msg = new SimpleSystemMessage(RemoteImportExportPlugin.PLUGIN_ID,
- IRemoteImportExportConstants.MSG_IMPORT_EXPORT_UNABLE_TO_USE_CONNECTION,
- IStatus.ERROR, msgTxt, msgDetails);
- SystemMessageDialog.show(s, msg);
- //displayMessage(s, ISystemMessages.MSG_IMPORT_EXPORT_UNABLE_TO_USE_CONNECTION, true);
- }
- return ret;
- }
-
- /**
- * Use this method to retrieve an IRemoteFile object from a
- * selection string.
- */
- public static IRemoteFile parseForIRemoteFile(String sel) {
- IHost c = parseForSystemConnection(sel);
- if (c != null) {
- String path = parseForPath(sel);
- return getIRemoteFile(c, path);
- } else
- return null;
- }
-
- /**
- * Use this method to retrieve the file path from a
- * selection string.
- */
- public static String parseForPath(String sel) {
- return sel.indexOf(":") >= 0 ? sel.substring(sel.indexOf(":") + 1) : sel; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Use this method to retrieve a SystemConnection from profile and a
- * connectionName string.
- */
- public static IHost getConnection(String profileName, String connectionName) {
- IHost[] connections = RSECorePlugin.getTheSystemRegistry().getHosts();
- if (profileName != null) {
- // given both profile and connection name...
- for (int loop = 0; loop < connections.length; loop++) {
- if (connections[loop].getAliasName().equalsIgnoreCase(connectionName) && connections[loop].getSystemProfileName().equalsIgnoreCase(profileName)) return connections[loop];
- }
- } else
- // given only connection name...
- for (int loop = 0; loop < connections.length; loop++) {
- if (connections[loop].getAliasName().equalsIgnoreCase(connectionName)) return connections[loop]; // return 1st match
- }
- return null;
- }
-
- /**
- * Use this method to retrieve a SystemConnection from a
- * selection string. Should really be a part of RSE. If
- * multiple separators ('.') are encountered will try
- * profile names with 0,1,2,...n separators in order until a
- * valid connection is found, or we run out of options.
- *
- * Not perfect, for example will never return connection C for
- * profile one.two.three, if connection three.C for profile one.two
- * exists. But this scheme should work fine for most practical
- * cases.
- *
- * Wish RSE had chosen a separator that could not be part of
- * valid connection name.
- */
- public static IHost parseForSystemConnection(String sel) {
- try {
- // Assumption: following will return null if connection has
- // been deleted or renamed!
- String connectionName = sel.substring(0, sel.indexOf(":")); //$NON-NLS-1$
- if (connectionName.indexOf('.') < 0)
- return getConnection(null, connectionName);
- else {
- // iterate through all possible combinations until we find a match, or
- // run out of options
- int dots = 0, temp = 0;
- IHost sc = null;
- while (connectionName.indexOf('.', temp) >= 0) {
- dots++;
- temp = connectionName.indexOf('.', temp) + 1;
- sc = getConnection(connectionName.substring(0, temp - 1), connectionName.substring(temp));
- if (sc != null) return sc;
- }
- // did not find any, last hope try no profile, and '.' in name
- return getConnection(null, connectionName);
- }
- } catch (Exception e) {
- // Received exception while validating string.
- // Ignore exception, just return null on fall-thru
- }
- // Connection with specified name was not found
- return null;
- }
-
- // generic classes:
- public static void error(Exception e) {
- Object[] o = null;
- // While developing launch configuration work we noticed that
- // we could enter here with no access to a Shell object. Changed
- // this method to simply log the exception in such cases.
- Shell s = getShell();
- try {
- s = SystemBasePlugin.getActiveWorkbenchWindow().getShell();
- } catch (Exception e1) {
- s = null;
- }
- if (SystemMessageException.class.isInstance(e)) {
- String mID = ((SystemMessageException) e).getSystemMessage().getFullMessageID().substring(0, 8);
- Debug.out("About to issue SystemMessageException for " + mID); //$NON-NLS-1$
- if (mID.compareToIgnoreCase("EVFC9104") != 0 && mID.compareToIgnoreCase("EVFC9112") != 0) { //$NON-NLS-1$ //$NON-NLS-2$
- // As per DY, do not issue 9104, or 9112 messages; they must have already been issued!
- if (s != null) {
- SystemMessageDialog d = new SystemMessageDialog(s, ((SystemMessageException) e).getSystemMessage());
- d.open();
- }
- }
- } else {
- o = new Object[] { e.getLocalizedMessage() == null ? e.toString() : e.getLocalizedMessage() };
- logExceptionError(NLS.bind(RemoteImportExportResources.MSG_IMPORT_EXPORT_UNEXPECTED_EXCEPTION, o), e);
- if (s != null) {
- String msgTxt = NLS.bind(RemoteImportExportResources.MSG_IMPORT_EXPORT_UNEXPECTED_EXCEPTION, o[0]);
- String msgDetails = RemoteImportExportResources.MSG_IMPORT_EXPORT_UNEXPECTED_EXCEPTION_DETAILS;
- SystemMessage msg = new SimpleSystemMessage(RemoteImportExportPlugin.PLUGIN_ID,
- IRemoteImportExportConstants.MSG_IMPORT_EXPORT_UNEXPECTED_EXCEPTION,
- IStatus.ERROR, msgTxt, msgDetails);
- SystemMessageDialog.show(s, msg);
- }
- }
- }
-
- public static Shell getShell() {
- Shell s = null;
- try {
- s = SystemBasePlugin.getActiveWorkbenchWindow().getShell();
- } catch (Exception e1) {
- s = null;
- }
- return s;
- }
-
- public static void logExceptionError(String msgTxt, Throwable exception) {
- SystemBasePlugin.logError(msgTxt, exception);
- }
-
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/ISynchronizeData.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/ISynchronizeData.java
deleted file mode 100644
index 1ec97e00a..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/ISynchronizeData.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Takuya Miyamoto and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Takuya Miyamoto - initial API and implementation
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-
-/**
- * Store synchronize information. This class is needed per each synchronize
- * operation.
- *
- */
-public interface ISynchronizeData {
- /**
- * Return the descriptionFile path that store synchronize information.
- *
- * @return
- */
- public IFile getDescriptionFile();
-
- /**
- * Return the remote path.
- *
- * @return
- */
- public String getRemoteLocation();
-
- /**
- * Set the remote path
- *
- * @param location
- */
- public void setRemoteLocation(String location);
-
- /**
- * Return the local path.
- *
- * @return
- */
- public IPath getLocalLocation();
-
- /**
- * Set the local path
- *
- * @param location
- */
- public void setLocalLocation(IPath location);
-
- /**
- * Return the synchronize type of this operation.
- *
- * @return
- */
- public int getSynchronizeType();
-
- public void setSynchronizeType(int synchronizeType);
-
- /**
- * Return the element list that are synchronized in this operation.
- *
- * @return
- */
- public List<IResource> getElements();
-
- public void setElements(List<IResource> elements);
-
- /**
- * Return if synchronize information is saved or not.
- *
- * @return
- */
- public boolean isSaveSettings();
-
- public void setSaveSettings(boolean saveSettings);
-
- /**
- * Return if overwrite existing files or not.
- *
- * @return
- */
- public boolean isOverWriteExistingFiles();
-
- public void setOverWriteExistingFiles(boolean overWriteExistingFiles);
-
- /**
- * Return if create directory structure or not.
- *
- * @return
- */
- public boolean isCreateDirectoryStructure();
-
- public void setCreateDirectoryStructure(boolean createDirectoryStructure);
-
- /**
- * Return the description file path.
- *
- * @return
- */
- public String getDescriptionFilePath();
-
- public void setDescriptionFilePath(String descriptionFilePath);
-
- /**
- * Return if create selection only or not.
- *
- * @return
- */
- public boolean isCreateSelectionOnly();
-
- public void setCreateSelectionOnly(boolean createSelectionOnly);
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/RSEResourceVariantComparator.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/RSEResourceVariantComparator.java
deleted file mode 100644
index 66161185e..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/RSEResourceVariantComparator.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Takuya Miyamoto and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Takuya Miyamoto - initial API and implementation
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.rse.internal.synchronize.filesystem.subscriber.FileSystemResourceVariant;
-import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.core.variants.ThreeWayResourceComparator;
-import org.eclipse.team.core.variants.ThreeWaySynchronizer;
-import org.eclipse.team.internal.core.mapping.LocalResourceVariant;
-
-public class RSEResourceVariantComparator extends ThreeWayResourceComparator {
- private ThreeWaySynchronizer _synchronizer;
- public RSEResourceVariantComparator(ThreeWaySynchronizer synchronizer){
- super(synchronizer);
- _synchronizer = synchronizer;
- }
-
-
-
- public boolean compare(IResource local, IResourceVariant remote) {
- // return super.compare(local, remote) && equalSize(local, remote);
- if(local instanceof IContainer) {
- if(remote.isContainer()) {
- return true;
- }
- return false;
- }
- if(local instanceof IFile && remote instanceof FileSystemResourceVariant) {
- FileSystemResourceVariant myE2 = (FileSystemResourceVariant)remote;
- myE2.synchRemoteFile(); // make sure we've got the latest remote file
-
- SystemIFileProperties properties = new SystemIFileProperties(local);
-
- long remoteTimeStamp = myE2.lastModified();
-
- if (remoteTimeStamp == 0){
- // file no longer exists
- properties.setRemoteFileTimeStamp(0);
- properties.setDownloadFileTimeStamp(0);
- return false;
- }
-
- long storedTimeStamp = properties.getRemoteFileTimeStamp();
- long storedLocalTimeStamp = properties.getDownloadFileTimeStamp();
- long localTimeStamp = local.getLocalTimeStamp();
-
- if (storedTimeStamp == 0){
- // never been stored before
- // assuming up-to-date file and now marking this timestamp
- properties.setRemoteFileTimeStamp(remoteTimeStamp);
- properties.setDownloadFileTimeStamp(local.getLocalTimeStamp());
-
- storedTimeStamp = remoteTimeStamp;
- storedLocalTimeStamp = localTimeStamp;
- }
-
- boolean result = storedTimeStamp == remoteTimeStamp && storedLocalTimeStamp == localTimeStamp;
- return result;
- }
- else if (local instanceof IFile && remote instanceof LocalResourceVariant){
- return true; // local resource variant is for local
- }
- return false;
- }
-
-
- /*
- public boolean compare(IResource local, IResourceVariant remote) {
- // First, ensure the resources are the same gender
- if ((local.getType() == IResource.FILE) == remote.isContainer()) {
- return false;
- }
- try {
- // If the file is locally modified, it cannot be in sync
- if (local.getType() == IResource.FILE && _synchronizer.isLocallyModified(local)) {
- // return false;
- }
-
- // If there is no base, the local cannot match the remote
- if (_synchronizer.getBaseBytes(local) == null) return false;
-
- // Otherwise, assume they are the same if the remote equals the base
- return equals(_synchronizer.getBaseBytes(local), getBytes(remote));
- } catch (TeamException e) {
- TeamPlugin.log(e);
- return false;
- }
- }
- */
-
- public boolean compare(IResourceVariant e1, IResourceVariant e2) {
- if(e1.isContainer()) {
- if(e2.isContainer()) {
- return true;
- }
- return false;
- }
- if(e1 instanceof FileSystemResourceVariant && e2 instanceof FileSystemResourceVariant) {
- FileSystemResourceVariant myE1 = (FileSystemResourceVariant)e1;
- FileSystemResourceVariant myE2 = (FileSystemResourceVariant)e2;
- return myE1.lastModified() == myE2.lastModified();
- }
- return false;
- }
-
- private byte[] getBytes(IResourceVariant remote) {
- return remote.asBytes();
- }
-
- private boolean equals(byte[] syncBytes, byte[] oldBytes) {
- if (syncBytes == null || oldBytes == null){
- return false;
- }
-
- if (syncBytes.length != oldBytes.length) return false;
- for (int i = 0; i < oldBytes.length; i++) {
- if (oldBytes[i] != syncBytes[i]) return false;
- }
- return true;
- }
-
-
- /**
- * Return if the size of local and remote file are the same.
- * @param local
- * @param remote
- * @return
- */
- private boolean equalSize(IResource local, IResourceVariant remote){
- long localSize = local.getLocation().toFile().length();
- long remoteSize = 0;
- if(remote instanceof FileSystemResourceVariant){
- remoteSize = ((FileSystemResourceVariant)remote).getFile().length();
- }
- return localSize == remoteSize;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/RSESyncUtils.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/RSESyncUtils.java
deleted file mode 100644
index 51e359b5e..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/RSESyncUtils.java
+++ /dev/null
@@ -1,285 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Takuya Miyamoto and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Takuya Miyamoto - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.rse.internal.synchronize;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.rse.internal.importexport.RemoteImportExportPlugin;
-import org.eclipse.rse.internal.importexport.RemoteImportExportUtil;
-import org.eclipse.rse.internal.importexport.files.IRemoteFileExportDescriptionWriter;
-import org.eclipse.rse.internal.importexport.files.IRemoteFileImportDescriptionWriter;
-import org.eclipse.rse.internal.importexport.files.RemoteFileExportData;
-import org.eclipse.rse.internal.importexport.files.RemoteFileImportData;
-import org.eclipse.rse.internal.synchronize.filesystem.FileSystemProvider;
-import org.eclipse.rse.internal.synchronize.provisional.ISynchronizeFilter;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-
-public class RSESyncUtils {
-
- /**
- * Convenience method to get the currently active workbench page. Note that
- * the active page may not be the one that the user perceives as active in
- * some situations so this method of obtaining the active page should only
- * be used if no other method is available.
- *
- * @return the active workbench page
- */
- public static IWorkbenchPage getActivePage() {
- IWorkbenchWindow window = RemoteImportExportPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow();
- if (window == null)
- return null;
- return window.getActivePage();
- }
-
- /**
- * Helper method for export operation.
- * Calculate the synchronized elements in local side by using ISynchornizeFilter.
- * The filter contains paths of synchronized elements in local side.
- * The calculated resources are added in the resources.
- *
- * @param local root handle in local side.
- * @param filter
- * @param resources calculated resources
- * @throws CoreException
- */
- public static void getSynchronizeResources(IResource local, ISynchronizeFilter filter, List<IResource> resources) throws CoreException{
- if(!filter.isExcluded(local.getFullPath())){
- resources.add(local);
- }
- if(local.getType() != IResource.FILE){
- for (IResource resource : ((IContainer)local).members()) {
- getSynchronizeResources(resource, filter, resources);
- }
- }
- }
-
- /**
- * Helper method for import operation.
- * Calculate the synchronize elements in local side by using ISynchronizeFilter.
- * The filter contains paths of synchronized elements in remote side.
- * The calculated resources are added in the resources.
- *
- * @param localRoot root handle in local side
- * @param remote current element in remote side
- * @param remoteRoot root handle in remote side
- * @param filter
- * @param resources calculated resources
- * @throws SystemMessageException
- * @throws CoreException
- */
- public static void getSynchronizeResources(IResource localRoot, IRemoteFile remote, IRemoteFile remoteRoot, ISynchronizeFilter filter, List<IResource> resources) throws SystemMessageException, CoreException{
-
- if(!filter.isExcluded(new Path(remote.getAbsolutePathPlusConnection()))){
- String relativePath = remote.getAbsolutePath().replace(remoteRoot.getAbsolutePath(), "");
- if(remote.isFile()){
-// IFile file = ((IProject)localRoot).getFile(relativePath);
-// IPath filePath = file.getProjectRelativePath();
- resources.add(((IProject)localRoot).getFile(relativePath));
- }else{
-// IFolder folder = ((IProject)localRoot).getFolder(relativePath);
-// IPath folderPath = folder.getProjectRelativePath();
- resources.add(((IProject)localRoot).getFolder(relativePath));
- }
-
- }
- if(!remote.isFile()){
- for (IRemoteFile remoteFile : remote.getParentRemoteFileSubSystem().list(remote, null)) {
- getSynchronizeResources(localRoot, remoteFile, remoteRoot, filter, resources);
- }
- }
- }
-
- // <Copied from org.eclipse.rse.internal.importexport.files.RemoteFileExportOperation>
- /**
- * Saves a description file for the export.
- *
- * @throws CoreException
- * if an unexpected exception occurs.
- * @throws IOException
- * if an I/O error occurs.
- */
- public static void saveDescription(RemoteFileExportData exportData) throws CoreException, IOException {
- ByteArrayOutputStream objectStreamOutput = new ByteArrayOutputStream();
- IRemoteFileExportDescriptionWriter writer = exportData.createExportDescriptionWriter(objectStreamOutput);
- ByteArrayInputStream fileInput = null;
- try {
- writer.write(exportData);
- fileInput = new ByteArrayInputStream(objectStreamOutput.toByteArray());
- IFile descriptionFile = exportData.getDescriptionFile();
- // check if resource exists
- if (descriptionFile.isAccessible()) {
- descriptionFile.setContents(fileInput, true, true, null);
- }
- // if resource does not exist
- else {
- // now have to check if a variant of this file exists (i.e.
- // whether a file exists
- // that has the same path with a different case. For case
- // insensitive file systems
- // such as Windows, this is needed since we can't simply create
- // a file with a different
- // case. Note that isAccessible() above does not check for file
- // paths with different case,
- // so we have to check it explicitly).
- IResource variant = RemoteImportExportUtil.getInstance().findExistingResourceVariant(descriptionFile.getFullPath());
- // if a variant was not found, create the new file
- if (variant == null) {
- // check if a variant of the parent exists
- // we need to do this because at this point we know that the
- // file path does not
- // exist, and neither does its variant. However, it is
- // possible that the parent path
- // has a variant, in which case calling create on the
- // description file with
- // the path as it is given will fail. We need to get the
- // variant path of the parent,
- // append the name of the file to the variant path, and
- // create a file with that path.
- // get parent
- IResource parent = descriptionFile.getParent();
- if (parent != null) {
- // get parent path
- IResource parentVariant = RemoteImportExportUtil.getInstance().findExistingResourceVariant(parent.getFullPath());
- // no parent variant (i.e. in a case sensitive file
- // system)
- if (parentVariant == null) {
- descriptionFile.create(fileInput, true, null);
- }
- // parent variant found (might be same as original
- // parent path)
- else {
- IPath newPath = parentVariant.getFullPath().append(descriptionFile.getName());
- IFile newDescriptionFile = SystemBasePlugin.getWorkspace().getRoot().getFile(newPath);
- newDescriptionFile.create(fileInput, true, null);
- }
- }
- }
- // otherwise, simply set the contents of the variant file
- else {
- if (variant instanceof IFile) {
- ((IFile) variant).setContents(fileInput, true, true, null);
- }
- }
- }
- } finally {
- if (fileInput != null) {
- fileInput.close();
- }
- if (writer != null) {
- writer.close();
- }
- }
- }
- // </Copied from org.eclipse.rse.internal.importexport.files.RemoteFileExportOperation>
-
- // <Copied from org.eclipse.rse.internal.importexport.files.RemoteFileExportOperation>
- /**
- * Saves a description file for the export.
- *
- * @throws CoreException
- * if an unexpected exception occurs.
- * @throws IOException
- * if an I/O error occurs.
- */
- public static void saveDescription(RemoteFileImportData importData) throws CoreException, IOException {
- ByteArrayOutputStream objectStreamOutput = new ByteArrayOutputStream();
- IRemoteFileImportDescriptionWriter writer = importData.createImportDescriptionWriter(objectStreamOutput);
- ByteArrayInputStream fileInput = null;
- try {
- writer.write(importData);
- fileInput = new ByteArrayInputStream(objectStreamOutput.toByteArray());
- IFile descriptionFile = importData.getDescriptionFile();
- // check if resource exists
- if (descriptionFile.isAccessible()) {
- descriptionFile.setContents(fileInput, true, true, null);
- }
- // if resource does not exist
- else {
- // now have to check if a variant of this file exists (i.e.
- // whether a file exists
- // that has the same path with a different case. For case
- // insensitive file systems
- // such as Windows, this is needed since we can't simply create
- // a file with a different
- // case. Note that isAccessible() above does not check for file
- // paths with different case,
- // so we have to check it explicitly).
- IResource variant = RemoteImportExportUtil.getInstance().findExistingResourceVariant(descriptionFile.getFullPath());
- // if a variant was not found, create the new file
- if (variant == null) {
- // check if a variant of the parent exists
- // we need to do this because at this point we know that the
- // file path does not
- // exist, and neither does its variant. However, it is
- // possible that the parent path
- // has a variant, in which case calling create on the
- // description file with
- // the path as it is given will fail. We need to get the
- // variant path of the parent,
- // append the name of the file to the variant path, and
- // create a file with that path.
- // get parent
- IResource parent = descriptionFile.getParent();
- if (parent != null) {
- // get parent path
- IResource parentVariant = RemoteImportExportUtil.getInstance().findExistingResourceVariant(parent.getFullPath());
- // no parent variant (i.e. in a case sensitive file
- // system)
- if (parentVariant == null) {
- descriptionFile.create(fileInput, true, null);
- }
- // parent variant found (might be same as original
- // parent path)
- else {
- IPath newPath = parentVariant.getFullPath().append(descriptionFile.getName());
- IFile newDescriptionFile = SystemBasePlugin.getWorkspace().getRoot().getFile(newPath);
- newDescriptionFile.create(fileInput, true, null);
- }
- }
- }
- // otherwise, simply set the contents of the variant file
- else {
- if (variant instanceof IFile) {
- ((IFile) variant).setContents(fileInput, true, true, null);
- }
- }
- }
- } finally {
- if (fileInput != null) {
- fileInput.close();
- }
- if (writer != null) {
- writer.close();
- }
- }
- }
- // </Copied from org.eclipse.rse.internal.importexport.files.RemoteFileExportOperation>
-
- public static final String PLUGIN_ID = "org.eclipse.rse.internal.synchronize"; //$NON-NLS-1$
- // Repository provider name
- public static final String PROVIDER_ID = FileSystemProvider.class.getName();
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/SynchronizeData.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/SynchronizeData.java
deleted file mode 100644
index c03d7b98f..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/SynchronizeData.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Takuya Miyamoto and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Takuya Miyamoto - initial API and implementation
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.rse.internal.importexport.files.RemoteFileExportData;
-import org.eclipse.rse.internal.importexport.files.RemoteFileImportData;
-import org.eclipse.rse.internal.importexport.files.UniFilePlus;
-import org.eclipse.rse.internal.synchronize.provisional.ISynchronizeOperation;
-import org.eclipse.rse.internal.synchronize.provisional.SynchronizeFilter;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.rse.ui.SystemBasePlugin;
-
-public class SynchronizeData implements ISynchronizeData {
- private String descriptionFilePath;
- private String remoteLocation;
- private IPath localLocation;
- private List<IResource> elements;
- private int synchronizeType;
- private boolean saveSettings;
- private boolean createSelectionOnly;
- private boolean createDirectoryStructure;
- private boolean overWriteExistingFiles;
- private boolean reviewSynchronzie;
-
- public SynchronizeData() {
- setDescriptionFilePath(null);
- setRemoteLocation(null);
- setLocalLocation(null);
- setElements(null);
- setSynchronizeType(0);
- setSaveSettings(false);
- setCreateDirectoryStructure(false);
- setCreateSelectionOnly(false);
- setOverWriteExistingFiles(false);
- }
-
- public SynchronizeData(RemoteFileExportData data) {
- setDescriptionFilePath(data.getDescriptionFilePath());
- setRemoteLocation(data.getDestination());
- setElements(data.getElements()); // for an export, the elements determine the source
- setLocalLocation(data.getContainerPath());
- setSynchronizeType(ISynchronizeOperation.SYNC_MODE_OVERRIDE_DEST);
- setSaveSettings(data.isSaveSettings());
- setCreateDirectoryStructure(data.isCreateDirectoryStructure());
- setCreateSelectionOnly(data.isCreateSelectionOnly());
- setReviewSynchronzie(data.isReviewSynchronize());
- setOverWriteExistingFiles(data.isOverWriteExistingFiles());
- }
-
- public SynchronizeData(RemoteFileImportData data) throws SystemMessageException, CoreException{
- IRemoteFile remoteRoot = ((UniFilePlus)data.getSource()).getRemoteFile();
-
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IContainer localRoot = (IContainer)workspace.getRoot().findMember(data.getContainerPath());
-
- ArrayList<IPath> paths = new ArrayList<IPath>();
- List<UniFilePlus> resources = data.getElements();
- for (UniFilePlus uniFilePlus : resources) {
- paths.add(new Path(uniFilePlus.getRemoteFile().getAbsolutePathPlusConnection()));
- }
- SynchronizeFilter filter = new SynchronizeFilter(paths);
- ArrayList<IResource> localResource = new ArrayList<IResource>();
-
- RSESyncUtils.getSynchronizeResources(localRoot, remoteRoot, remoteRoot, filter, localResource);
-
- setLocalLocation(data.getContainerPath());
- setDescriptionFilePath(data.getDescriptionFilePath());
- setRemoteLocation(((UniFilePlus)data.getSource()).getRemoteFile().getAbsolutePathPlusConnection());
- setElements(localResource);
- setSynchronizeType(ISynchronizeOperation.SYNC_MODE_OVERRIDE_SOURCE);
- setSaveSettings(data.isSaveSettings());
- setCreateDirectoryStructure(data.isCreateDirectoryStructure());
- setCreateSelectionOnly(data.isCreateSelectionOnly());
- setOverWriteExistingFiles(data.isOverWriteExistingFiles());
- }
-
- public IFile getDescriptionFile() {
- String pathString = getDescriptionFilePath();
- if (pathString == null) {
- return null;
- }
- IPath path = new Path(pathString);
- if (path.isValidPath(path.toString()) && path.segmentCount() >= 2) {
- return SystemBasePlugin.getWorkspace().getRoot().getFile(path);
- } else {
- return null;
- }
- }
-
- public String getDescriptionFilePath() {
- return descriptionFilePath;
- }
-
- public void setDescriptionFilePath(String descriptionFilePath) {
- this.descriptionFilePath = descriptionFilePath;
- }
-
- public String getRemoteLocation() {
- return remoteLocation;
- }
-
- public void setRemoteLocation(String location) {
- this.remoteLocation = location;
- }
-
- public IPath getLocalLocation() {
- return localLocation;
- }
-
- public void setLocalLocation(IPath location) {
- this.localLocation = location;
- }
-
-
- public List<IResource> getElements() {
- return elements;
- }
-
- public void setElements(List<IResource> elements) {
- this.elements = elements;
- }
-
- public int getSynchronizeType() {
- return synchronizeType;
- }
-
- public void setSynchronizeType(int synchronizeType) {
- this.synchronizeType = synchronizeType;
- }
-
- public boolean isSaveSettings() {
- return saveSettings;
- }
-
- public void setSaveSettings(boolean saveSettings) {
- this.saveSettings = saveSettings;
- }
-
- public boolean isCreateSelectionOnly() {
- return createSelectionOnly;
- }
-
- public void setCreateSelectionOnly(boolean createSelectionOnly) {
- this.createSelectionOnly = createSelectionOnly;
- }
-
- public boolean isOverWriteExistingFiles() {
- return overWriteExistingFiles;
- }
-
- public void setOverWriteExistingFiles(boolean overWriteExistingFiles) {
- this.overWriteExistingFiles = overWriteExistingFiles;
- }
-
- public boolean isCreateDirectoryStructure() {
- return createDirectoryStructure;
- }
-
- public void setCreateDirectoryStructure(boolean createDirectoryStructure) {
- this.createDirectoryStructure = createDirectoryStructure;
- }
-
- public boolean isReviewSynchronzie() {
- return reviewSynchronzie;
- }
-
- public void setReviewSynchronzie(boolean reviewSynchronzie) {
- this.reviewSynchronzie = reviewSynchronzie;
- }
-
- public RemoteFileExportData getExportData() {
- RemoteFileExportData data = new RemoteFileExportData();
- data.setElements(getElements());
- data.setCreateDirectoryStructure(isCreateDirectoryStructure());
- data.setCreateSelectionOnly(isCreateSelectionOnly());
- data.setOverWriteExistingFiles(isOverWriteExistingFiles());
- data.setSaveSettings(isSaveSettings());
- data.setDescriptionFilePath(getDescriptionFilePath());
- data.setDestination(getRemoteLocation());
-
- return data;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/FileModificationValidator.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/FileModificationValidator.java
deleted file mode 100644
index bbf95be9c..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/FileModificationValidator.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Takuya Miyamoto - Adapted from org.eclipse.rse.importexport / FileModificationValidator
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.filesystem;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.team.FileModificationValidationContext;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.rse.internal.synchronize.RSESyncUtils;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-
-/**
- * This class models a sentry that verifies whether resources are available for
- * editing or overwriting. This has been made a separate class for illustration
- * purposes. It may have been more appropriate to have FileSystemProvider
- * implement IFileModificationValidator itself since the interface only has two
- * methods and their implementation is straight forward.
- */
-public final class FileModificationValidator extends org.eclipse.core.resources.team.FileModificationValidator {
-
- private FileSystemOperations operations;
-
- /**
- * Constructor for FileModificationValidator.
- */
- public FileModificationValidator(RepositoryProvider provider) {
- operations = ((FileSystemProvider) provider).getOperations();
- }
-
- /**
- * This method will convert any exceptions thrown by the
- * SimpleAccessOperations.checkout() to a Status.
- *
- * @param resources
- * the resources that are to be checked out
- * @return IStatus a status indicator that reports whether the operation
- * went smoothly or not.
- */
- private IStatus checkout(IResource[] resources) {
- try {
- operations.checkout(resources, IResource.DEPTH_INFINITE, null);
- } catch (TeamException e) {
- // return new Status(IStatus.ERROR, FileSystemPlugin.ID, 0,
- // e.getLocalizedMessage(), e);
- return new Status(IStatus.ERROR, RSESyncUtils.PLUGIN_ID, 0, e.getLocalizedMessage(), e);
- }
- return Status.OK_STATUS;
- }
-
- /**
- * This method will be called by the workbench/editor before it tries to
- * edit one or more files. The idea is to prevent anyone from accidentally
- * working on a file that they won't be able to check in changes to.
- *
- * @see
- * org.eclipse.core.resources.IFileModificationValidator#validateEdit(IFile
- * [], Object)
- */
- @Override
- public IStatus validateEdit(IFile[] files, FileModificationValidationContext context) {
- Collection toBeCheckedOut = new ArrayList();
-
- // Make a list of all the files that need to be checked out:
- for (int i = 0; i < files.length; i++) {
- if (!operations.isCheckedOut(files[i])) {
- toBeCheckedOut.add(files[i]);
- }
- }
-
- return checkout((IResource[]) toBeCheckedOut.toArray(new IResource[toBeCheckedOut.size()]));
- }
-
- /**
- * This method will be called by the workbench before it tries to save a
- * file. It should not attempt to save any files that don't receive an OK
- * status here.
- *
- * @see
- * org.eclipse.core.resources.IFileModificationValidator#validateSave(IFile
- * )
- */
- @Override
- public IStatus validateSave(IFile file) {
- if (file.isReadOnly()) {
- return checkout(new IResource[] { file });
- }
- return Status.OK_STATUS;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/FileSystemOperations.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/FileSystemOperations.java
deleted file mode 100644
index 401ecddcf..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/FileSystemOperations.java
+++ /dev/null
@@ -1,564 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Andreas Voss <av@tonbeller.com> - Bug 181141 [Examples] Team: filesystem provider example can not handle deletions
- * Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemOperations
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.filesystem;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceVisitor;
-import org.eclipse.core.resources.mapping.ResourceTraversal;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.rse.internal.importexport.files.UniFilePlus;
-import org.eclipse.rse.internal.synchronize.filesystem.subscriber.FileSystemResourceVariant;
-import org.eclipse.rse.internal.synchronize.filesystem.subscriber.FileSystemSubscriber;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.core.variants.IResourceVariantComparator;
-import org.eclipse.team.core.variants.ThreeWaySynchronizer;
-import org.eclipse.ui.dialogs.ContainerGenerator;
-
-/**
- * The get and put operations for the file system provider.
- */
-public class FileSystemOperations {
- // A reference to the provider
- // private FileSystemProvider provider;
-
- FileSystemOperations(FileSystemProvider provider) {
- // this.provider = provider;
- }
-
- private FileSystemProvider getProvider(IResource resource) {
- return (FileSystemProvider) RepositoryProvider.getProvider(resource.getProject());
- }
-
- /**
- * Make the local state of the project match the remote state by getting any
- * out-of-sync resources. The overrideOutgoing flag is used to indicate
- * whether locally modified files should also be replaced or left alone.
- *
- * @param resources
- * the resources to get
- * @param depth
- * the depth of the operation
- * @param overrideOutgoing
- * whether locally modified resources should be replaced
- * @param progress
- * a progress monitor
- * @throws TeamException
- */
- public void get(IResource[] resources, int depth, boolean overrideOutgoing, IProgressMonitor progress) throws TeamException {
- try {
- // ensure the progress monitor is not null
- progress = Policy.monitorFor(progress);
- progress.beginTask(Policy.bind("GetAction.working"), 100); //$NON-NLS-1$
- // Refresh the subscriber so we have the latest remote state
- FileSystemSubscriber.getInstance().refresh(resources, depth, new SubProgressMonitor(progress, 30));
- internalGet(resources, depth, overrideOutgoing, new SubProgressMonitor(progress, 70));
- } finally {
- progress.done();
- }
- }
-
- /**
- * Make the local state of the traversals match the remote state by getting
- * any out-of-sync resources. The overrideOutgoing flag is used to indicate
- * whether locally modified files should also be replaced or left alone.
- *
- * @param traversals
- * the traversals that cover the resources to get
- * @param overrideOutgoing
- * whether locally modified resources should be replaced
- * @param progress
- * a progress monitor
- * @throws TeamException
- */
- public void get(ResourceTraversal[] traversals, boolean overrideOutgoing, IProgressMonitor monitor) throws TeamException {
- try {
- // ensure the progress monitor is not null
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(null, 100 * traversals.length);
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
- get(traversal.getResources(), traversal.getDepth(), overrideOutgoing, new SubProgressMonitor(monitor, 100));
- }
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Checkout the given resources to the given depth by setting any files to
- * writable (i.e set read-only to <code>false</code>.
- *
- * @param resources
- * the resources to be checked out
- * @param depth
- * the depth of the checkout
- * @param progress
- * a progress monitor
- * @throws TeamException
- */
- public void checkout(IResource[] resources, int depth, IProgressMonitor progress) throws TeamException {
- try {
- progress = Policy.monitorFor(progress);
- progress.beginTask(Policy.bind("FileSystemSimpleAccessOperations.1"), resources.length); //$NON-NLS-1$
- for (int i = 0; i < resources.length; i++) {
- Policy.checkCanceled(progress);
- resources[i].accept(new IResourceVisitor() {
- public boolean visit(IResource resource) throws CoreException {
- if (resource.getType() == IResource.FILE) {
- // TODO: lock the file on the' server'.
- resource.getResourceAttributes().setReadOnly(false);
- }
- return true;
- }
- }, depth, false /* include phantoms */);
- progress.worked(1);
- }
- } catch (CoreException e) {
- throw TeamException.asTeamException(e);
- } finally {
- progress.done();
- }
- }
-
- /**
- * Check-in the given resources to the given depth by replacing the remote
- * (i.e. file system) contents with the local workspace contents.
- *
- * @param resources
- * the resources
- * @param depth
- * the depth of the operation
- * @param overrideIncoming
- * indicate whether incoming remote changes should be replaced
- * @param progress
- * a progress monitor
- * @throws TeamException
- */
- public void checkin(IResource[] resources, int depth, boolean overrideIncoming, IProgressMonitor progress) throws TeamException {
- try {
- // ensure the progress monitor is not null
- progress = Policy.monitorFor(progress);
- progress.beginTask(Policy.bind("PutAction.working"), 100); //$NON-NLS-1$
- // Refresh the subscriber so we have the latest remote state
- FileSystemSubscriber.getInstance().refresh(resources, depth, new SubProgressMonitor(progress, 30));
- internalPut(resources, depth, overrideIncoming, new SubProgressMonitor(progress, 70));
- } finally {
- progress.done();
- }
- }
-
- /**
- * Check-in the given resources to the given depth by replacing the remote
- * (i.e. file system) contents with the local workspace contents.
- *
- * @param traversals
- * the traversals that cover the resources to check in
- * @param overrideIncoming
- * indicate whether incoming remote changes should be replaced
- * @param progress
- * a progress monitor
- * @throws TeamException
- */
- public void checkin(ResourceTraversal[] traversals, boolean overrideIncoming, IProgressMonitor monitor) throws TeamException {
- try {
- // ensure the progress monitor is not null
- monitor = Policy.monitorFor(monitor);
- monitor.beginTask(null, 100 * traversals.length);
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
- checkin(traversal.getResources(), traversal.getDepth(), overrideIncoming, new SubProgressMonitor(monitor, 100));
- // update to the latest state
- FileSystemSubscriber.getInstance().refresh(traversal.getResources(), traversal.getDepth(), null);
- }
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Return whether the local resource is checked out. A resource is checked
- * out if it is a file that is not read-only. Folders are always checked
- * out.
- *
- * @param resource
- * the resource
- * @return whether the resource is checked out and can be modified
- */
- public boolean isCheckedOut(IResource resource) {
- if (resource.getType() != IResource.FILE) {
- return true;
- }
- return !resource.getResourceAttributes().isReadOnly();
- // return !resource.isReadOnly();
- }
-
- /*
- * Get the resource variant for the given resource.
- */
- private FileSystemResourceVariant getExportResourceVariant(IResource resource) {
- // return
- // (FileSystemResourceVariant)provider.getResourceVariant(resource);
- return (FileSystemResourceVariant) getProvider(resource).getExportResourceVariant(resource);
- }
-
- private FileSystemResourceVariant getImportResourceVariant(IResource resource){
- return (FileSystemResourceVariant) getProvider(resource).getImportResourcevariant(resource);
- }
-
- private void internalGet(IResource[] resources, int depth, boolean overrideOutgoing, IProgressMonitor progress) throws TeamException {
- // Traverse the resources and get any that are out-of-sync
- // System.out.println("get operation");
- progress.beginTask(Policy.bind("GetAction.working"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$
- for (int i = 0; i < resources.length; i++) {
- Policy.checkCanceled(progress);
- if (resources[i].getType() == IResource.FILE) {
- internalGet((IFile) resources[i], overrideOutgoing, progress);
- } else if (depth != IResource.DEPTH_ZERO) {
- internalGet((IContainer) resources[i], depth, overrideOutgoing, progress);
- }
- progress.worked(1);
- }
- }
-
- /*
- * Get the folder and its children to the depth specified.
- */
- private void internalGet(IContainer container, int depth, boolean overrideOutgoing, IProgressMonitor progress) throws TeamException {
- try {
- ThreeWaySynchronizer synchronizer = FileSystemSubscriber.getInstance().getSynchronizer();
- // Make the local folder state match the remote folder state
- List toDelete = new ArrayList();
- if (container.getType() == IResource.FOLDER) {
- IFolder folder = (IFolder) container;
-// FileSystemResourceVariant remote = getExportResourceVariant(container);
- FileSystemResourceVariant remote = getImportResourceVariant(container);
- if (!folder.exists() && remote != null) {
- // Create the local folder
-// folder.create(false, true, progress);
- folder.create(true, true, progress);
- folder.getResourceAttributes().setReadOnly(false);
- synchronizer.setBaseBytes(folder, remote.asBytes());
- } else if (folder.exists() && remote == null) {
- // Schedule the folder for removal but delay in
- // case the folder contains outgoing changes
- toDelete.add(folder);
- }
- }
-
- // Get the children
- IResource[] children = synchronizer.members(container);
- if (children.length > 0) {
- internalGet(children, depth == IResource.DEPTH_INFINITE ? IResource.DEPTH_INFINITE : IResource.DEPTH_ZERO, overrideOutgoing, progress);
- }
-
- // Remove any empty folders
- for (Iterator iter = toDelete.iterator(); iter.hasNext();) {
- IFolder folder = (IFolder) iter.next();
- if (folder.members().length == 0) {
- folder.delete(false, true, progress);
- synchronizer.flush(folder, IResource.DEPTH_INFINITE);
- }
- }
- } catch (CoreException e) {
- throw TeamException.asTeamException(e);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /*
- * Get the file if it is out-of-sync.
- */
- private void internalGet(IFile localFile, boolean overrideOutgoing, IProgressMonitor progress) throws TeamException {
- ThreeWaySynchronizer synchronizer = FileSystemSubscriber.getInstance().getSynchronizer();
- IResourceVariantComparator comparator = FileSystemSubscriber.getInstance().getResourceComparator();
-// FileSystemResourceVariant remote = getExportResourceVariant(localFile);
- FileSystemResourceVariant remote = getImportResourceVariant(localFile);
- byte[] baseBytes = synchronizer.getBaseBytes(localFile);
- FileSystemProvider provider = getProvider(localFile);
- IResourceVariant base = provider.getResourceVariant(localFile, baseBytes);
-//
-// if (!synchronizer.hasSyncBytes(localFile) || (isLocallyModified(localFile) && !overrideOutgoing)) {
-// // Do not overwrite the local modification
-// return;
-// }
- if (base != null && remote == null) {
- // The remote no longer exists so remove the local
- try {
- localFile.delete(false, true, progress);
- synchronizer.flush(localFile, IResource.DEPTH_ZERO);
- return;
- } catch (CoreException e) {
- throw TeamException.asTeamException(e);
- }
- }
- if (!synchronizer.isLocallyModified(localFile) && base != null && remote != null && comparator.compare(base, remote)) {
- // The base and remote are the same and there's no local changes
- // so nothing needs to be done
- return;
- }
- try {
-// UniFilePlus remoteFile = (UniFilePlus) provider.getExportFile(localFile);
- UniFilePlus remoteFile = (UniFilePlus) provider.getImportFile(localFile);
- if(!remoteFile.exists()){
- localFile.delete(true, null);
- synchronizer.flush(localFile, IResource.DEPTH_ZERO);
- }else{
- if(localFile.exists()){
- localFile.delete(true, null);
- }
- try {
- // Copy from the remote file to the local file:
-
-// if(!localFile.getParent().exists()){
-// IPath parentPath = localFile.getFullPath().removeLastSegments(1);
-// ContainerGenerator generator = new ContainerGenerator(parentPath);
-// IContainer container = generator.generateContainer(null);
-// container.getResourceAttributes().setReadOnly(false);
-// }
- createParentFolderRecursively(localFile);
- remoteFile.getRemoteFile().getParentRemoteFileSubSystem().download(remoteFile.getRemoteFile(), localFile.getLocation().toOSString(), localFile.getCharset(), progress);
-// remoteFile.getRemoteFile().getParentRemoteFileSubSystem().download(remoteFile.getRemoteFile(), parent.getLocation().toOSString(), localFile.getCharset(), progress);
-
- // Mark as read-only to force a checkout before editing
- //System.out.println(localFile.getLocation() + " : accessible = " + localFile.isAccessible()+", existing = "+localFile.exists());
- if(localFile.isAccessible()){
- localFile.getResourceAttributes().setReadOnly(true);
- }
-
- localFile.getParent().refreshLocal(IResource.DEPTH_ONE, progress);
-
- // update sync status
- synchronizer.setBaseBytes(localFile, remote.asBytes());
-
- // update stored timestamp
- SystemIFileProperties properties = new SystemIFileProperties(localFile);
- properties.setRemoteFileTimeStamp(remoteFile.lastModified());
- properties.setDownloadFileTimeStamp(localFile.getLocalTimeStamp());
-
- } catch (SystemMessageException e) {
- e.printStackTrace();
- }
- }
- } catch (CoreException e) {
- throw FileSystemPlugin.wrapException(e);
- }
- }
-
- // actual put operation for files
- private void internalPut(IResource[] resources, int depth, boolean overrideIncoming, IProgressMonitor progress) throws TeamException {
- try {
- // ensure the progress monitor is not null
- progress = Policy.monitorFor(progress);
- progress.beginTask(Policy.bind("PutAction.working"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$
- for (int i = 0; i < resources.length; i++) {
- Policy.checkCanceled(progress);
- if (resources[i].getType() == IResource.FILE) {
- internalPut((IFile) resources[i], overrideIncoming, progress);
- } else if (depth > 0) { // Assume that resources are either
- // files or containers.
- internalPut((IContainer) resources[i], depth, overrideIncoming, progress);
- }
- progress.worked(1);
- }
- progress.done();
- } catch (TeamException e) {
- throw e;
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * Put the file if the sync state allows it.
- *
- * @param localFile
- * the local file
- * @param overrideIncoming
- * whether incoming changes should be overwritten
- * @param progress
- * a progress monitor
- * @return whether the put succeeded (i.e. the local matches the remote)
- * @throws TeamException
- */
- private boolean internalPut(IFile localFile, boolean overrideIncoming, IProgressMonitor progress) throws TeamException {
- ThreeWaySynchronizer synchronizer = FileSystemSubscriber.getInstance().getSynchronizer();
- IResourceVariantComparator comparator = FileSystemSubscriber.getInstance().getResourceComparator();
- FileSystemResourceVariant remote = getExportResourceVariant(localFile);
- byte[] baseBytes = synchronizer.getBaseBytes(localFile);
- FileSystemProvider provider = getProvider(localFile);
- IResourceVariant base = provider.getResourceVariant(localFile, baseBytes);
-
- overrideIncoming = true; // DKM - test
- // Check whether we are overriding a remote change
- if (base == null && remote != null && !overrideIncoming) {
- // The remote is an incoming (or conflicting) addition.
- // Do not replace unless we are overriding
- return false;
- } else if (base != null && remote == null) {
- // The remote is an incoming deletion
- if (!localFile.exists()) {
- // Conflicting deletion. Clear the synchronizer.
- synchronizer.flush(localFile, IResource.DEPTH_ZERO);
- } else if (!overrideIncoming) {
- // Do not override the incoming deletion
- return false;
- }
- } else if (base != null && remote != null) {
- boolean same = comparator.compare(base, remote);
- if (!isLocallyModified(localFile) && same) {
- // The base and remote are the same and there's no local changes
- // so nothing needs to be done
- return true;
- }
- if (!same && !overrideIncoming) {
- // The remote has changed. Only override if specified
- return false;
- }
- }
-
- // Handle an outgoing deletion
- UniFilePlus remoteFile = (UniFilePlus) provider.getExportFile(localFile);
- if (!localFile.exists()) {
- remoteFile.delete();
- synchronizer.flush(localFile, IResource.DEPTH_ZERO);
- } else {
- // Otherwise, upload the contents
- try {
- // Copy from the local file to the remote file:
- try {
- if (!remoteFile.getParentFile().exists()) {
- remoteFile.getParentFile().mkdirs();
- }
- remoteFile.getRemoteFile().getParentRemoteFileSubSystem().upload(localFile.getLocation().toOSString(), remoteFile.getRemoteFile(), localFile.getCharset(), progress);
- // Mark the file as read-only to require another checkout
- localFile.getResourceAttributes().setReadOnly(true);
- } catch (Exception e) {
- e.printStackTrace();
- }
- // Update the synchronizer base bytes
- remote = getExportResourceVariant(localFile);
- synchronizer.setBaseBytes(localFile, remote.asBytes());
-
- // update stored timestamp
- // make sure the remote file is up-to-date
- remoteFile.getRemoteFile().markStale(true);
- IRemoteFile updatedRemoteFile = remoteFile.getRemoteFile().getParentRemoteFileSubSystem().getRemoteFileObject(remoteFile.getRemoteFile().getAbsolutePath(), progress);
-
- SystemIFileProperties properties = new SystemIFileProperties(localFile);
- properties.setRemoteFileTimeStamp(updatedRemoteFile.getLastModified());
- properties.setDownloadFileTimeStamp(localFile.getLocalTimeStamp());
-
- } catch (CoreException e) {
- throw FileSystemPlugin.wrapException(e);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- return true;
- }
-
- private boolean isLocallyModified(IFile localFile) throws TeamException {
- ThreeWaySynchronizer synchronizer = FileSystemSubscriber.getInstance().getSynchronizer();
- if (!localFile.exists()) {
- // Extra check for bug 141415
- return synchronizer.getBaseBytes(localFile) != null;
- }
- return synchronizer.isLocallyModified(localFile);
- }
-
- /*
- * Get the folder and its children to the depth specified.
- */
- private void internalPut(IContainer container, int depth, boolean overrideIncoming, IProgressMonitor progress) throws TeamException {
- try {
- ThreeWaySynchronizer synchronizer = FileSystemSubscriber.getInstance().getSynchronizer();
- FileSystemProvider provider = getProvider(container);
- // Make the local folder state match the remote folder state
- List toDelete = new ArrayList();
- if (container.getType() == IResource.FOLDER) {
- IFolder folder = (IFolder) container;
- UniFilePlus diskFile = (UniFilePlus) provider.getExportFile(container);
- FileSystemResourceVariant remote = getExportResourceVariant(container);
- if (!folder.exists() && remote != null) {
- // Schedule the folder for removal but delay in
- // case the folder contains incoming changes
- toDelete.add(diskFile);
- } else if (folder.exists() && remote == null) {
- // Create the remote directory and sync up the local
- diskFile.mkdirs();
-
- IResourceVariant variant = provider.getExportResourceVariant(folder);
- if (variant == null){
- // remote directory does not exist
- }
- else {
- synchronizer.setBaseBytes(folder, variant.asBytes());
- }
- }
- } else if (container.getType() == IResource.PROJECT) {
- IProject project = (IProject) container;
- UniFilePlus remoteProjectFolder = (UniFilePlus) provider.getExportFile(project);
- FileSystemResourceVariant remoteResourceVariant = getExportResourceVariant(container);
- if (project.exists() && remoteResourceVariant == null) {
- remoteProjectFolder.mkdir();
- synchronizer.setBaseBytes(project, provider.getExportResourceVariant(project).asBytes());
- }
- }
-
- // Get the children
- IResource[] children = synchronizer.members(container);
- if (children.length > 0) {
- internalPut(children, depth == IResource.DEPTH_INFINITE ? IResource.DEPTH_INFINITE : IResource.DEPTH_ZERO, overrideIncoming, progress);
- }
-
- // Remove any empty folders
- for (Iterator iter = toDelete.iterator(); iter.hasNext();) {
- File diskFile = (File) iter.next();
- if (diskFile.listFiles().length == 0) {
- diskFile.delete();
- synchronizer.flush(container, IResource.DEPTH_INFINITE);
- }
- }
- } catch (CoreException e) {
- throw TeamException.asTeamException(e);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private void createParentFolderRecursively(IResource resource) throws CoreException{
- if(!resource.getParent().exists()){
- ContainerGenerator generator = new ContainerGenerator(resource.getParent().getFullPath());
- IContainer parent = generator.generateContainer(null);
- createParentFolderRecursively(parent);
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/FileSystemPlugin.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/FileSystemPlugin.java
deleted file mode 100644
index 5b56262b9..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/FileSystemPlugin.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemPlugin
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.filesystem;
-
-import java.io.IOException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.rse.internal.synchronize.RSESyncUtils;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * This is the plugin class for the file system examples. It provides the
- * following:
- *
- * <ol>
- * <li>public fields for the plugin and provider IDs as defined in the
- * plugin.xml
- * <li>initialization on startup of Policy class that provides
- * internationalization of strings
- * <li>helper methods for outputing IStatus objects to the log
- * <li>helper methods for converting CoreExceptions and IOExceptions to
- * TeamExceptions
- * </ol>
- */
-public class FileSystemPlugin extends AbstractUIPlugin {
-
- /**
- * This is the ID of the plugin as defined in the plugin.xml
- */
- /**
- * This is the provider ID of the plugin as defined in the plugin.xml
- */
- // This static field will hold the singleton instance of the plugin class
- private static FileSystemPlugin plugin;
-
- /**
- * Override the standard plugin constructor.
- *
- * @param descriptor
- * the plugin descriptor
- */
- public FileSystemPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- // record this instance as the singleton
- plugin = this;
- }
-
- /**
- * Return the singlton instance of the plugin class to allow other classes
- * in the plugin access to plugin instance methods such as those for logging
- * errors, etc.
- */
- public static FileSystemPlugin getPlugin() {
- return plugin;
- }
-
- /**
- * Helper method to convert a CoreException into a TeamException. We do this
- * to maintain the core status and code. This type of mapping may not be
- * appropriate in more complicated exception handling situations.
- *
- * @param e
- * the CoreException
- */
- public static TeamException wrapException(CoreException e) {
- return new TeamException(e.getStatus());
- }
-
- /**
- * Helper method to convert an IOException into a TeamException. This type
- * of mapping may not be appropriate in more complicated exception handling
- * situations.
- *
- * @param e
- * the CoreException
- */
- public static TeamException wrapException(IOException e) {
- return new TeamException(new Status(IStatus.ERROR,
- RSESyncUtils.PLUGIN_ID, TeamException.IO_FAILED, e
- .getMessage(), e));
- }
-
- /**
- * Helper method to log an exception status.
- *
- * @param status
- * the status to be logged
- */
- public static void log(IStatus status) {
- plugin.getLog().log(status);
- }
-
- /**
- * Returns the standard display to be used. The method first checks, if the
- * thread calling this method has an associated display. If so, this display
- * is returned. Otherwise the method returns the default display.
- */
- public static Display getStandardDisplay() {
- Display display = Display.getCurrent();
- if (display == null) {
- display = Display.getDefault();
- }
- return display;
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- }
-
- public static void log(CoreException e) {
- log(new Status(e.getStatus().getSeverity(),
- RSESyncUtils.PLUGIN_ID, 0, e.getMessage(), e));
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/FileSystemProvider.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/FileSystemProvider.java
deleted file mode 100644
index c637af194..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/FileSystemProvider.java
+++ /dev/null
@@ -1,436 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemProvider
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.filesystem;
-
-import java.io.File;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFileModificationValidator;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceRuleFactory;
-import org.eclipse.core.resources.team.FileModificationValidator;
-import org.eclipse.core.resources.team.ResourceRuleFactory;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.model.IHost;
-import org.eclipse.rse.internal.importexport.files.UniFilePlus;
-import org.eclipse.rse.internal.importexport.files.Utilities;
-import org.eclipse.rse.internal.synchronize.RSESyncUtils;
-import org.eclipse.rse.internal.synchronize.filesystem.subscriber.FileSystemResourceVariant;
-import org.eclipse.rse.internal.synchronize.filesystem.subscriber.FileSystemSubscriber;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.history.IFileHistoryProvider;
-import org.eclipse.team.core.variants.IResourceVariant;
-
-/**
- * This example illustrates how to create a concrete implementation of a
- * <code>RepositoryProvider</code> that uses the file system to act as the
- * repository. See the plugin.xml file for the xml required to register this
- * provider with the Team extension point
- * <code>org.eclipse.team.core.repository</code>. The plugin.xml file also
- * contains examples of how to filter menu items using a repository provider's
- * ID.
- *
- * <p>
- * This example provider illustrates the following:
- * <ol>
- * <li>simple working implementation of <code>RepositoyProvider</code>
- * <li>storage of a persistent property with the project (which provides the
- * target location for the provider)
- * <li>access to an instance of <code>SimpleAccessOperations</code> for
- * performing simple file operations
- * </ol>
- *
- * <p>
- * Additional functionality that will be illustrated in the future include:
- * <ol>
- * <li>Validate Save/Validate Edit
- * <li>Move/Delete Hook
- * <li>Project Sets
- * <li>Use of the workspace synchronizer (ISynchronizOperation)
- * <li>Use of decorators
- * <li>combining streams and progress monitors to get responsive UI
- * </ol>
- *
- */
-public class FileSystemProvider extends RepositoryProvider {
-
- /*
- * Create a custom rule factory to allow more optimistic concurrency
- */
- private static final ResourceRuleFactory RESOURCE_RULE_FACTORY = new ResourceRuleFactory() {
- // Just need a subclass to instantiate
- };
-
- // The location of the folder on file system where the repository is stored.
- private IPath remoteRootPath;
- private IPath localRootPath;
- private UniFilePlus remoteRoot;
-
- private Map _resourceMap;
-
- // The QualifiedName that is used to persist the location across workspace
- // as a persistent property on a resource
- private static QualifiedName FILESYSTEM_REPO_LOC = new QualifiedName(RSESyncUtils.PLUGIN_ID, "disk_location"); //$NON-NLS-1$
-
- /**
- * Create a new FileSystemProvider.
- */
- public FileSystemProvider() {
- super();
- _resourceMap = new HashMap();
- }
-
- public void reset()
- {
- _resourceMap.clear();
- }
-
- /**
- * This method is invoked when the provider is mapped to a project. Although
- * we have access to the project at this point (using
- * <code>getProject()</code>, we don't know the root location so there is
- * nothing we can do yet.
- *
- * @see org.eclipse.team.core.RepositoryProvider#configureProject()
- */
- @Override
- public void configureProject() throws CoreException {
- FileSystemSubscriber.getInstance().handleRootChanged(getProject(), true /* added */);
- }
-
- /**
- * This method is invoked when the provider is unmapped from its project.
- *
- * @see org.eclipse.core.resources.IProjectNature#deconfigure()
- */
- public void deconfigure() throws CoreException {
- // Clear the persistant property containing the location
- getProject().setPersistentProperty(FILESYSTEM_REPO_LOC, null);
- FileSystemSubscriber.getInstance().handleRootChanged(getProject(), false /* removed */);
- }
-
- /**
- * Return the provider ID as specified in the plugin.xml
- *
- * @see RepositoryProvider#getID()
- */
- @Override
- public String getID() {
- return RSESyncUtils.PROVIDER_ID;
- }
-
- /**
- * Set the file system location for the provider. This mist be invoked after
- * the provider is mapped and configured but before the provider is used to
- * perform any operations.
- *
- * @param location
- * the path representing the location where the project contents will
- * be stored.
- * @throws TeamException
- */
- public void setRemoteLocation(String location) throws TeamException {
- // location = transformRSEtoNormal(location);
-
- // set the instance variable to the provided path
- remoteRootPath = new Path(location);
-
- // ensure that the location is a folder (if it exists)
- File file = new File(location);
- if (file.exists() && !file.isDirectory()) {
- throw new TeamException(Policy.bind("FileSystemProvider.mustBeFolder", location)); //$NON-NLS-1$
- }
-
- // record the location as a persistent property so it will be remembered
- // across platform invocations
- try {
- getProject().setPersistentProperty(FILESYSTEM_REPO_LOC, location);
- } catch (CoreException e) {
- throw FileSystemPlugin.wrapException(e);
- }
- }
-
- public void setLocalLocation(IPath location){
- localRootPath = location;
- }
-
- /**
- * Returns the folder in the file system to which the provider is connected.
- * Return <code>null</code> if there is no location or there was a problem
- * determining it.
- *
- * @return IPath The path to the root of the repository.
- */
- public IPath getRemoteRoot() {
- if (remoteRootPath == null) {
- try {
- String location = getProject().getPersistentProperty(FILESYSTEM_REPO_LOC);
- if (location == null) {
- return null;
- }
- remoteRootPath = new Path(location);
- } catch (CoreException e) {
- // log the problem and carry on
- FileSystemPlugin.log(e);
- return null;
- }
- }
- // System.out.println(root);
- return remoteRootPath;
- }
-
- /**
- * Return an object that provides the operations for transferring data to
- * and from the provider's location.
- */
- public FileSystemOperations getOperations() {
- return new FileSystemOperations(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.team.core.RepositoryProvider#getFileModificationValidator()
- */
- @Override
- public IFileModificationValidator getFileModificationValidator() {
- return getFileModificationValidator2();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.team.core.RepositoryProvider#getFileModificationValidator2()
- */
- @Override
- public FileModificationValidator getFileModificationValidator2() {
- return new org.eclipse.rse.internal.synchronize.filesystem.FileModificationValidator(this);
- }
-
- /**
- * Return the resource variant for the local resource using the bytes to
- * identify the variant.
- *
- * @param resource
- * the resource
- * @param bytes
- * the bytes that identify the resource variant
- * @return the resource variant handle
- */
- public IResourceVariant getResourceVariant(IResource resource, byte[] bytes) {
- // Takuya: it's important if resource exist or not.
- if (bytes == null)
- return null;
- UniFilePlus file = (UniFilePlus) getExportFile(resource);
- if (file == null)
- return null;
- return new FileSystemResourceVariant(file, bytes);
- }
-
- /**
- * Return the resource variant for the local resource.
- *
- * @param resource
- * the resource
- * @return the resource variant
- */
- public IResourceVariant getExportResourceVariant(IResource resource) {
- // Takuya: it's important if resource exist or not.
- UniFilePlus file = (UniFilePlus) getExportFile(resource);
- if (file == null || !file.exists())
- return null;
- return new FileSystemResourceVariant(file);
- }
-
- public IResourceVariant getImportResourcevariant(IResource resource){
- UniFilePlus file = (UniFilePlus) getImportFile(resource);
- if (file == null || !file.exists())
- return null;
- return new FileSystemResourceVariant(file);
- }
-
- /**
- * Return the <code>java.io.File</code> that the given resource maps to.
- * Return <code>null</code> if the resource is not a child of this
- * provider's project.
- * The path of return file is targetRootPath/project/relativePath.
- *
- * @param resource
- * the resource
- * @return the file that the resource maps to.
- */
- public File getExportFile(IResource resource) {
- UniFilePlus file = (UniFilePlus)_resourceMap.get(resource);
- //if (file == null)
- {
- try {
- if (resource.getProject().equals(getProject())) {
- UniFilePlus root = getRemoteRootFolder();
-
- String relativePath = transformInDependency(root.getRemoteFile().getHost(), resource.getFullPath().toString());
-
-
- // MOB BUGBUG//IRemoteFile remoteFile =
- // root.getRemoteFile().getParentRemoteFileSubSystem
- // ().getRemoteFileObject(root.getRemoteFile(),relativePath,
- // null);
-
- String path = root.getRemoteFile().getAbsolutePath() + relativePath;
- IRemoteFile remoteFile = root.getRemoteFile().getParentRemoteFileSubSystem().getRemoteFileObject(path,null);
- //String remotePath = root.getAbsolutePath() + root.getRemoteFile().getParentRemoteFileSubSystem().getSeparatorChar() + resource.getName();
- //IRemoteFile remoteFile = root.getRemoteFile().getParentRemoteFileSubSystem().getRemoteFileObject(remotePath, null);
- file = new UniFilePlus(remoteFile);
- _resourceMap.put(resource, file);
-
- }
- } catch (SystemMessageException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- return file;
- }
-
- public File getImportFile(IResource resource){
- UniFilePlus file = (UniFilePlus)_resourceMap.get(resource);
- //if (file == null){
- {
- try {
- if (resource.getProject().equals(getProject())) {
- UniFilePlus root = getRemoteRootFolder();
- String relativePath = transformInDependency(root.getRemoteFile().getHost(), resource.getFullPath().toString());
- //String relativePath = transformInDependency(root.getRemoteFile().getHost(), IPath.SEPARATOR + resource.getProjectRelativePath().toString());
-
- String path = root.getRemoteFile().getAbsolutePath() + relativePath;
- IRemoteFile remoteFile = root.getRemoteFile().getParentRemoteFileSubSystem().getRemoteFileObject(path, null);
- file = new UniFilePlus(remoteFile);
- _resourceMap.put(resource, file);
- }
- } catch (SystemMessageException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- return file;
- }
-
-
- /**
- * return whether the resource is file or not
- *
- * @param resource
- * @return
- */
- private boolean isFile(IResource resource) {
- return new File(this.transformRSEtoNormal(resource.getLocation().toString())).isFile();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.core.RepositoryProvider#getRuleFactory()
- */
- @Override
- public IResourceRuleFactory getRuleFactory() {
- return RESOURCE_RULE_FACTORY;
- }
-
- @Override
- public IFileHistoryProvider getFileHistoryProvider() {
- return null;
- }
-
- private String transformRSEtoNormal(String original) {
- if (original.indexOf(":") == -1) {
- return original;
- }
-
- String transformed = "";
- String[] str = original.split(":");
-
- // Windows
- if (str.length > 2) {
- transformed += str[1] + ":" + str[2];
- }
- // Linux
- else {
- transformed += str[1];
- }
-
- return transformed;
-
- }
-
- /**
- * get the handle fo remote root directory which is specified by IHost and
- * absolute path as the member value of this class.
- *
- * @return
- */
- public UniFilePlus getRemoteRootFolder() {
- if (remoteRoot == null) {
- IPath remoteRootDir = getRemoteRoot();
- String remoteRootDirString = transformRSEtoNormal(remoteRootDir.toString());
- IHost conn = Utilities.parseForSystemConnection(remoteRootDir.toString());
- String absolutePath = transformInDependency(conn, remoteRootDirString);
- return /* remoteRoot = */new UniFilePlus(Utilities.getIRemoteFile(conn, absolutePath));
- }
-
- return remoteRoot;
- }
-
- private String transformInDependency(IHost host, String original) {
- String ret = "";
- IRSESystemType type = host.getSystemType();
- if (host.getSystemType().isWindows()) {
- ret = original.replace("/", "\\");
- } else {
- ret = original.replace("\\", "/");
- }
-
-
- // make sure the mapping corresponds to the correct local location
- if (localRootPath != null){
- String[] lsegs = localRootPath.segments();
- String[] rsegs = ret.substring(1).split("/");
-
- // relative path should not start with the localRoot path
- StringBuffer newPath = new StringBuffer();
- for (int i = 0; i < rsegs.length; i++){
- if (lsegs.length > i){
- if (!lsegs[i].equals(rsegs[i])){
- newPath.append("/");
- newPath.append(rsegs[i]);
- }
- }
- else {
- newPath.append("/");
- newPath.append(rsegs[i]);
- }
- }
- ret = newPath.toString();
- }
- return ret;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/FileSystemProviderType.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/FileSystemProviderType.java
deleted file mode 100644
index d36133999..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/FileSystemProviderType.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemProviderType
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.filesystem;
-
-import org.eclipse.team.core.ProjectSetCapability;
-import org.eclipse.team.core.RepositoryProviderType;
-
-/**
- * The file system repository provider types
- */
-public class FileSystemProviderType extends RepositoryProviderType {
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.team.core.RepositoryProviderType#getProjectSetCapability()
- */
- @Override
- public ProjectSetCapability getProjectSetCapability() {
- // Create an empty project set capability to test backwards
- // compatibility
- return new ProjectSetCapability() {
- };
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/Policy.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/Policy.java
deleted file mode 100644
index a4c31e982..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/Policy.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / Policy
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.filesystem;
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-
-/**
- * This class is a clone of the Policy classes many Eclipse plugin use to
- * provide NLSing of strings and aid in proper progress monitoring.
- */
-public class Policy {
-
- private static ResourceBundle bundle = null;
- //private static final String bundleName = "org.eclipse.rse.internal.synchronize.filesystem.messages"; //$NON-NLS-1$
- private static final String bundleName = Policy.class.getPackage().getName() + ".messages";
-
- /*
- * Returns a resource bundle, creating one if it none is available.
- */
- private static ResourceBundle getResourceBundle() {
- // thread safety
- ResourceBundle tmpBundle = bundle;
- if (tmpBundle != null)
- return tmpBundle;
- // always create a new classloader to be passed in
- // in order to prevent ResourceBundle caching
- return bundle = ResourceBundle.getBundle(bundleName);
- // return bundle = ResourceBundle.getBundle("");
- }
-
- /**
- * Lookup the message with the given ID in this catalog and bind its
- * substitution locations with the given string.
- */
- public static String bind(String id, String binding) {
- return bind(id, new String[] { binding });
- }
-
- /**
- * Lookup the message with the given ID in this catalog and bind its
- * substitution locations with the given strings.
- */
- public static String bind(String id, String binding1, String binding2) {
- return bind(id, new String[] { binding1, binding2 });
- }
-
- /**
- * Gets a string from the resource bundle. We don't want to crash because of
- * a missing String. Returns the key if not found.
- */
- public static String bind(String key) {
- try {
- return getResourceBundle().getString(key);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * Gets a string from the resource bundle and binds it with the given
- * arguments. If the key is not found, return the key.
- */
- public static String bind(String key, Object[] args) {
- try {
- return MessageFormat.format(bind(key), args);
- } catch (MissingResourceException e) {
- return key;
- } catch (NullPointerException e) {
- return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
- * Progress monitor helpers
- */
- public static void checkCanceled(IProgressMonitor monitor) {
- if (monitor.isCanceled())
- throw new OperationCanceledException();
- }
-
- public static IProgressMonitor monitorFor(IProgressMonitor monitor) {
- if (monitor == null)
- return new NullProgressMonitor();
- return monitor;
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/messages.properties b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/messages.properties
deleted file mode 100644
index ba5eb2541..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/messages.properties
+++ /dev/null
@@ -1,46 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2009 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-# Takuya Miyamoto - Adapted from org.eclipse.rse.team.example / messages.properties
-# David McKnight (IBM) - [272720] CheckPII error in import_export plugin
-###############################################################################
-# NLS_MESSAGEFORMAT_ALL
-# NLS_ENCODING=UTF-8
-
-fileSystem.propertyLocation=Location:
-
-FileSystemMainPage.location=Location:
-FileSystemMainPage.browseDir=&Browse...
-FileSystemMainPage.notValidLocation=Location must be an existing directory
-
-fsMainPage.name=Select a file system location
-fsMainPage.description=This location will be used to share resources with a team
-
-ConfigurationWizard.errorTitle=Error configuring the provider.
-ConfigurationWizard.error=File System provider could not be created
-
-ConfigurationWizard.name=File System Repository
-ConfigurationWizard.description=File System Repository Properties
-
-DisconnectAction.errorTitle=Error Disconnecting
-
-PutAction.working=Putting resources...
-PutAction.problemMessage=A problem occured putting the resources.
-
-GetAction.working=Getting resources...
-GetAction.problemMessage=A problem occured getting the resources.
-
-ReplaceAction.working=Replacing resources...
-ReplaceAction.problemMessage=A problem occured replacing the resources.
-
-FileSystemProvider.mustBeFolder=Target location ''{0}'' is a file and must be a folder.
-RemoteResource.mustBeFolder=Resource ''{0}'' is a file so it cannot have entries
-FileSystemRemoteResource.0=This resource is a container so it cannot have data.
-FileSystemSimpleAccessOperations.1=Checking resources out...
-FileSystemSimpleAccessOperations.3=Re-locking resources...
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/subscriber/FileSystemMergeContext.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/subscriber/FileSystemMergeContext.java
deleted file mode 100644
index 74ec42055..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/subscriber/FileSystemMergeContext.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemMergeContext
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.filesystem.subscriber;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.team.core.diff.IDiff;
-import org.eclipse.team.core.mapping.ISynchronizationScopeManager;
-import org.eclipse.team.core.mapping.provider.ResourceDiffTree;
-import org.eclipse.team.core.subscribers.SubscriberMergeContext;
-
-/**
- * A merge context for merging file system changes.
- */
-public class FileSystemMergeContext extends SubscriberMergeContext {
-
- /**
- * Create the file system merge context for the given scope manager.
- *
- * @param manager
- * the scope manager
- */
- public FileSystemMergeContext(ISynchronizationScopeManager manager) {
- super(FileSystemSubscriber.getInstance(), manager);
- initialize();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.team.core.mapping.provider.MergeContext#makeInSync(org.eclipse
- * .team.core.diff.IDiff, org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- protected void makeInSync(IDiff diff, IProgressMonitor monitor) throws CoreException {
- IResource resource = ResourceDiffTree.getResourceFor(diff);
- FileSystemSubscriber.getInstance().makeInSync(resource);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.team.core.mapping.IMergeContext#markAsMerged(org.eclipse.
- * team.core.diff.IDiff, boolean, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void markAsMerged(IDiff diff, boolean inSyncHint, IProgressMonitor monitor) throws CoreException {
- // TODO if inSyncHint is true, we should test to see if the contents
- // match
- IResource resource = ResourceDiffTree.getResourceFor(diff);
- FileSystemSubscriber.getInstance().markAsMerged(resource, monitor);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.team.core.mapping.IMergeContext#reject(org.eclipse.team.core
- * .diff.IDiff, org.eclipse.core.runtime.IProgressMonitor)
- */
- public void reject(IDiff diff, IProgressMonitor monitor) throws CoreException {
- markAsMerged(diff, false, monitor);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.team.core.mapping.provider.MergeContext#getMergeRule(org.
- * eclipse.team.core.diff.IDiff)
- */
- @Override
- public ISchedulingRule getMergeRule(IDiff node) {
- return ResourceDiffTree.getResourceFor(node).getProject();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.team.core.mapping.provider.MergeContext#merge(org.eclipse
- * .team.core.diff.IDiff, boolean,
- * org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public IStatus merge(IDiff diff, boolean ignoreLocalChanges, IProgressMonitor monitor) throws CoreException {
- // Only attempt the merge for non-conflicts. The reason we do this
- // is because the file system provider doesn't really have the proper
- // base
- // so merging conflicts doesn't work properly
- /*
- if (!ignoreLocalChanges) {
- IResource resource = ResourceDiffTree.getResourceFor(diff);
- if (diff instanceof IThreeWayDiff && resource instanceof IFile) {
- IThreeWayDiff twd = (IThreeWayDiff) diff;
- if (twd.getDirection() == IThreeWayDiff.CONFLICTING) {
- // return new MergeStatus(FileSystemPlugin.ID,
- // "Cannot merge conflicting files", new IFile[] {
- // (IFile)resource });
- return new MergeStatus(RSESyncUtils.PLUGIN_ID, "Cannot merge conflicting files", new IFile[] { (IFile) resource });
- }
- }
- }
- */
- return super.merge(diff, ignoreLocalChanges, monitor);
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/subscriber/FileSystemRemoteTree.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/subscriber/FileSystemRemoteTree.java
deleted file mode 100644
index 2d53f1448..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/subscriber/FileSystemRemoteTree.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemRemoteTree
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.filesystem.subscriber;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.rse.internal.synchronize.RSESyncUtils;
-import org.eclipse.rse.internal.synchronize.filesystem.FileSystemProvider;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.core.variants.ThreeWayRemoteTree;
-
-/**
- * The file system three-way remote resource variant tree that provides the
- * ability to traverse the file system for the creation of resource variants.
- */
-public class FileSystemRemoteTree extends ThreeWayRemoteTree {
-
- /**
- * Create the file system remote resource variant tree
- *
- * @param subscriber
- * the file system subscriber
- */
- public FileSystemRemoteTree(FileSystemSubscriber subscriber) {
- super(subscriber);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.team.core.variants.AbstractResourceVariantTree#fetchMembers
- * (org.eclipse.team.core.variants.IResourceVariant,
- * org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- protected IResourceVariant[] fetchMembers(IResourceVariant variant, IProgressMonitor progress) throws TeamException {
- return ((FileSystemResourceVariant) variant).members();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.team.core.variants.AbstractResourceVariantTree#fetchVariant
- * (org.eclipse.core.resources.IResource, int,
- * org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- protected IResourceVariant fetchVariant(IResource resource, int depth, IProgressMonitor monitor) throws TeamException {
- try {
- RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject(), RSESyncUtils.PROVIDER_ID);
- if (provider != null) {
- return ((FileSystemProvider) provider).getExportResourceVariant(resource);
- }
- } catch (RuntimeException e) {
- e.printStackTrace();
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
-
-
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/subscriber/FileSystemResourceVariant.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/subscriber/FileSystemResourceVariant.java
deleted file mode 100644
index b4189f3e8..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/subscriber/FileSystemResourceVariant.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemResourceVariant
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-
-package org.eclipse.rse.internal.synchronize.filesystem.subscriber;
-
-import java.io.InputStream;
-import java.util.Date;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.rse.internal.importexport.files.UniFilePlus;
-import org.eclipse.rse.internal.synchronize.RSESyncUtils;
-import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.variants.CachedResourceVariant;
-
-public class FileSystemResourceVariant extends CachedResourceVariant {
-
- private UniFilePlus ioFile;
- private byte[] bytes;
-
- /**
- * Create a resource variant for the given file. The bytes will be
- * calculated when they are accessed.
- *
- * @param file
- * the file
- */
- public FileSystemResourceVariant(UniFilePlus file) {
- this.ioFile = file;
- }
-
- /**
- * Create a resource variant for the given file and sync bytes.
- *
- * @param file
- * the file
- * @param bytes
- * the timestamp bytes
- */
- public FileSystemResourceVariant(UniFilePlus file, byte[] bytes) {
- this.ioFile = file;
- this.bytes = bytes;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.team.core.variants.CachedResourceVariant#fetchContents(org
- * .eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- protected void fetchContents(IProgressMonitor monitor) throws TeamException {
- setContents(getContents(), monitor);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.core.variants.CachedResourceVariant#getCachePath()
- */
- @Override
- protected String getCachePath() {
- // append the timestamp to the file path to give each variant a unique
- // path
- return getFilePath() + " " + ioFile.lastModified(); //$NON-NLS-1$
- }
-
- private String getFilePath() {
- return ioFile.getCanonicalPath();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.core.variants.CachedResourceVariant#getCacheId()
- */
- @Override
- protected String getCacheId() {
- // return FileSystemPlugin.ID;
- return RSESyncUtils.PLUGIN_ID;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.core.variants.IResourceVariant#getName()
- */
- public String getName() {
- return ioFile.getName();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.core.variants.IResourceVariant#isContainer()
- */
- public boolean isContainer() {
- return ioFile.isDirectory();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.team.core.variants.IResourceVariant#getContentIdentifier()
- */
- public String getContentIdentifier() {
- // Use the modification timestamp as the content identifier
- return new Date(ioFile.lastModified()).toString();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.core.variants.IResourceVariant#asBytes()
- */
- // TODO By using byte[] which this method return, ResourceComparator run
- // comparison.
- // so, this method provide how to compare with which value.
- public byte[] asBytes() {
- if (bytes == null) {
- // For simplicity, convert the timestamp to it's string
- // representation.
- // A more optimal storage format would be the 8 bytes that make up
- // the long.
- bytes = Long.toString(ioFile.lastModified()).getBytes();
- }
- return bytes;
- }
-
- /**
- * Return the files contained by the file of this resource variant.
- *
- * @return the files contained by the file of this resource variant.
- */
- public FileSystemResourceVariant[] members() {
- if (isContainer()) {
- UniFilePlus[] members = (UniFilePlus[]) ioFile.listFiles();
- FileSystemResourceVariant[] result = new FileSystemResourceVariant[members.length];
- for (int i = 0; i < members.length; i++) {
- result[i] = new FileSystemResourceVariant(members[i]);
- }
- return result;
- }
- return new FileSystemResourceVariant[0];
- }
-
- /**
- * @return
- */
- public InputStream getContents() throws TeamException {
- // Takuya: modified for managing remote resource
- try {
- return ioFile.getInputStream();
- } catch (SystemMessageException e) {
- throw new TeamException("Failed to fetch contents for " + getFilePath(), e); //$NON-NLS-1$
- }
- }
-
- public UniFilePlus getFile() {
- return ioFile;
- }
-
- public long lastModified(){
- return ioFile.lastModified();
- }
-
- public String toString(){
- return ioFile.getAbsolutePath();
- }
-
- public void synchRemoteFile() {
- ioFile.synchRemoteFile();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/subscriber/FileSystemSubscriber.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/subscriber/FileSystemSubscriber.java
deleted file mode 100644
index 954c40456..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/subscriber/FileSystemSubscriber.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemSubscriber
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.filesystem.subscriber;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.QualifiedName;
-import org.eclipse.rse.internal.synchronize.RSEResourceVariantComparator;
-import org.eclipse.rse.internal.synchronize.RSESyncUtils;
-import org.eclipse.rse.internal.synchronize.filesystem.FileSystemProvider;
-import org.eclipse.rse.subsystems.files.core.SystemIFileProperties;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.core.variants.ThreeWayRemoteTree;
-import org.eclipse.team.core.variants.ThreeWaySubscriber;
-import org.eclipse.team.core.variants.ThreeWaySynchronizer;
-import org.eclipse.team.internal.core.mapping.LocalResourceVariant;
-
-/**
- * This is an example file system subscriber that overrides ThreeWaySubscriber.
- * It uses a repository provider (<code>FileSystemProvider</code>) to determine
- * and manage the roots and to create resource variants. It also makes use of a
- * file system specific remote tree (<code>FileSystemRemoteTree</code>) for
- * provided the remote tree access and refresh.
- *
- * @see ThreeWaySubscriber
- * @see ThreeWaySynchronizer
- * @see FileSystemProvider
- * @see FileSystemRemoteTree
- */
-public class FileSystemSubscriber extends ThreeWaySubscriber {
-
- private static FileSystemSubscriber instance;
-
- /**
- * Return the file system subscriber singleton.
- *
- * @return the file system subscriber singleton.
- */
- public static synchronized FileSystemSubscriber getInstance() {
- if (instance == null) {
- instance = new FileSystemSubscriber();
- }
- return instance;
- }
-
- /**
- * Create the file system subscriber.
- */
- private FileSystemSubscriber() {
- super(new ThreeWaySynchronizer(new QualifiedName(RSESyncUtils.PLUGIN_ID, "workpsace-sync"))); //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.team.core.variants.ThreeWaySubscriber#getResourceVariant(
- * org.eclipse.core.resources.IResource, byte[])
- */
- @Override
- public IResourceVariant getResourceVariant(IResource resource, byte[] bytes) throws TeamException {
- RepositoryProvider provider = RepositoryProvider.getProvider(resource.getProject(), RSESyncUtils.PROVIDER_ID);
- if (provider != null) {
- return ((FileSystemProvider) provider).getResourceVariant(resource, bytes);
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.core.variants.ThreeWaySubscriber#createRemoteTree()
- */
- @Override
- protected ThreeWayRemoteTree createRemoteTree() {
- return new FileSystemRemoteTree(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.core.subscribers.Subscriber#getName()
- */
- @Override
- public String getName() {
- return "Synchronize"; //$NON-NLS-1$
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.core.subscribers.Subscriber#roots()
- */
- @Override
- public IResource[] roots() {
- List result = new ArrayList();
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
- if (project.isAccessible()) {
- RepositoryProvider provider = RepositoryProvider.getProvider(project, RSESyncUtils.PROVIDER_ID);
- if (provider != null) {
- result.add(project);
- }
- }
- }
- return (IProject[]) result.toArray(new IProject[result.size()]);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.team.core.variants.ThreeWaySubscriber#handleRootChanged(org
- * .eclipse.core.resources.IResource, boolean)
- */
- @Override
- public void handleRootChanged(IResource resource, boolean added) {
- // Override to allow FileSystemProvider to signal the addition and
- // removal of roots
- super.handleRootChanged(resource, added);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.team.core.variants.ResourceVariantTreeSubscriber#getSyncInfo
- * (org.eclipse.core.resources.IResource,
- * org.eclipse.team.core.variants.IResourceVariant,
- * org.eclipse.team.core.variants.IResourceVariant)
- */
- @Override
- protected SyncInfo getSyncInfo(IResource local, IResourceVariant base, IResourceVariant remote) throws TeamException {
-
- FileSystemResourceVariant rv = null;
-
- if (remote instanceof FileSystemResourceVariant){
- rv = (FileSystemResourceVariant)remote;
- rv.synchRemoteFile();
- }
-
- if (base == null && local.exists()){
- base = remote;
- }
- if (base != null) {
- boolean exists = rv.getFile().remoteFile.exists();
- if (!exists){
- base = null;
- }
- else {
-
- if (rv != null){
- long remoteModificationTime = rv.lastModified();
- SystemIFileProperties properties = new SystemIFileProperties(local);
- long storedModificationTime = properties.getRemoteFileTimeStamp();
-
- if (remoteModificationTime > storedModificationTime){
- // what if it's changed locally too?
- long localDownloadTimeStamp = properties.getDownloadFileTimeStamp();
- long localTimeStamp = local.getLocalTimeStamp();
- //if (localTimeStamp > localDownloadTimeStamp){
- // base = null; // conflict for both
- //}
- //else {
- // leaving the local base, since 1 base is better than none
- // if there is no base, then we can't accurately show the diffs
- // need to provide something better
- base = new LocalResourceVariant(local);
- //}
- }
- }
- }
- }
-
- FileSystemSyncInfo info = new FileSystemSyncInfo(local, base, remote, new RSEResourceVariantComparator(getSynchronizer()));
- info.init();
- return info;
- }
-
- /**
- * Make the resource in-sync.
- *
- * @param resource
- * the resource
- * @throws TeamException
- */
- public void makeInSync(IResource resource) throws TeamException {
- ThreeWaySynchronizer synchronizer = getSynchronizer();
- byte[] remoteBytes = synchronizer.getRemoteBytes(resource);
- if (remoteBytes == null) {
- if (!resource.exists())
- synchronizer.flush(resource, IResource.DEPTH_ZERO);
- } else {
- synchronizer.setBaseBytes(resource, remoteBytes);
- }
- }
-
- /**
- * Make the change an outgoing change
- *
- * @param resource
- * @throws TeamException
- */
- public void markAsMerged(IResource resource, IProgressMonitor monitor) throws TeamException {
- makeInSync(resource);
- try {
- resource.touch(monitor);
- } catch (CoreException e) {
- throw TeamException.asTeamException(e);
- }
- }
-
-
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/subscriber/FileSystemSyncInfo.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/subscriber/FileSystemSyncInfo.java
deleted file mode 100644
index dd2d74afc..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/subscriber/FileSystemSyncInfo.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemSyncInfo
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.filesystem.subscriber;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.core.variants.IResourceVariantComparator;
-
-/**
- * Provide a custom sync info that will report files that exist both locally and
- * remotely as in-sync and will return a null base if there is an incoming
- * change.
- */
-public class FileSystemSyncInfo extends SyncInfo {
-
- public FileSystemSyncInfo(IResource local, IResourceVariant base, IResourceVariant remote, IResourceVariantComparator comparator) {
- super(local, base, remote, comparator);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.team.core.subscribers.SyncInfo#calculateKind(org.eclipse.
- * core.runtime.IProgressMonitor)
- */
- @Override
- protected int calculateKind() throws TeamException {
- if (getLocal().getType() != IResource.FILE) {
- if (getLocal().exists() && getRemote() != null) {
- return IN_SYNC;
- }
- }
- int kind = super.calculateKind();
- if ((kind & SyncInfo.PSEUDO_CONFLICT) != 0){
- kind = IN_SYNC;
- }
-
-
- return kind;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.core.synchronize.SyncInfo#getBase()
- */
- @Override
- public IResourceVariant getBase() {
- // If the kind has been set and there is an incoming change
- // return null as the base since the server does not keep the
- // base contents
- // if ((getKind() & INCOMING) > 0) {
- // return null;
- // }
- return super.getBase();
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/CompoundResourceTraversal.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/CompoundResourceTraversal.java
deleted file mode 100644
index 2204cf81a..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/CompoundResourceTraversal.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / CompoundResourceTraversal
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.filesystem.ui;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceTraversal;
-import org.eclipse.core.runtime.IPath;
-
-/**
- * Helper class that accumulates several traversals in order to generate a final
- * set of traversals and to perform certain queries on a set of traversals.
- *
- * TODO: This class was copied from the Team Core plugin since it was an
- * internal class. It should probably be made API at some point.
- */
-public class CompoundResourceTraversal {
-
- private Set deepFolders = new HashSet();
- private Set shallowFolders = new HashSet();
- private Set zeroFolders = new HashSet();
- private Set files = new HashSet();
-
- public void addTraversals(ResourceTraversal[] traversals) {
- for (int i = 0; i < traversals.length; i++) {
- ResourceTraversal traversal = traversals[i];
- addTraversal(traversal);
- }
- }
-
- public void addTraversal(ResourceTraversal traversal) {
- IResource[] resources = traversal.getResources();
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- addResource(resource, traversal.getDepth());
- }
- }
-
- public void addResource(IResource resource, int depth) {
- if (resource.getType() == IResource.FILE) {
- if (!isCovered(resource, IResource.DEPTH_ZERO))
- files.add(resource);
- }
- switch (depth) {
- case IResource.DEPTH_INFINITE:
- addDeepFolder(resource);
- break;
- case IResource.DEPTH_ONE:
- addShallowFolder(resource);
- break;
- case IResource.DEPTH_ZERO:
- addZeroFolder(resource);
- break;
- }
- }
-
- private void addShallowFolder(IResource resource) {
- if (!isCovered(resource, IResource.DEPTH_ONE)) {
- shallowFolders.add(resource);
- removeDescendants(resource, IResource.DEPTH_ONE);
- }
- }
-
- public boolean isCovered(IResource resource, int depth) {
- IPath fullPath = resource.getFullPath();
- // Regardless of the depth, look for a deep folder that covers the
- // resource
- for (Iterator iter = deepFolders.iterator(); iter.hasNext();) {
- IResource deepFolder = (IResource) iter.next();
- if (deepFolder.getFullPath().isPrefixOf(fullPath)) {
- return true;
- }
- }
- // For files, look in the shallow folders and files
- if (resource.getType() == IResource.FILE) {
- return (shallowFolders.contains(resource.getParent()) || files.contains(resource));
- }
- // For folders, look in appropriate sets
- switch (depth) {
- case IResource.DEPTH_ONE:
- return (shallowFolders.contains(resource));
- case IResource.DEPTH_ZERO:
- return (shallowFolders.contains(resource.getParent()) || zeroFolders.contains(resource));
- }
- return false;
- }
-
- private void addZeroFolder(IResource resource) {
- if (!isCovered(resource, IResource.DEPTH_ZERO))
- zeroFolders.add(resource);
- }
-
- private void addDeepFolder(IResource resource) {
- if (!isCovered(resource, IResource.DEPTH_INFINITE)) {
- deepFolders.add(resource);
- removeDescendants(resource, IResource.DEPTH_INFINITE);
- }
- }
-
- private void removeDescendants(IResource resource, int depth) {
- IPath fullPath = resource.getFullPath();
- // First, remove any files that are now covered
- for (Iterator iter = files.iterator(); iter.hasNext();) {
- IResource child = (IResource) iter.next();
- switch (depth) {
- case IResource.DEPTH_INFINITE:
- if (fullPath.isPrefixOf(child.getFullPath())) {
- iter.remove();
- }
- break;
- case IResource.DEPTH_ONE:
- if (fullPath.equals(child.getFullPath().removeLastSegments(1))) {
- iter.remove();
- }
- break;
- }
- }
- // Now, remove any shallow folders
- if (depth == IResource.DEPTH_INFINITE) {
- for (Iterator iter = shallowFolders.iterator(); iter.hasNext();) {
- IResource child = (IResource) iter.next();
- if (fullPath.isPrefixOf(child.getFullPath())) {
- iter.remove();
- }
- }
- }
- // Finally, remove any zero folders
- for (Iterator iter = zeroFolders.iterator(); iter.hasNext();) {
- IResource child = (IResource) iter.next();
- switch (depth) {
- case IResource.DEPTH_INFINITE:
- if (fullPath.isPrefixOf(child.getFullPath())) {
- iter.remove();
- }
- break;
- case IResource.DEPTH_ONE:
- // TODO: Is a zero folder covered by a shallow folder?
- if (fullPath.equals(child.getFullPath().removeLastSegments(1))) {
- iter.remove();
- }
- break;
- }
- }
- }
-
- public void add(CompoundResourceTraversal compoundTraversal) {
- addResources((IResource[]) compoundTraversal.deepFolders.toArray(new IResource[compoundTraversal.deepFolders.size()]), IResource.DEPTH_INFINITE);
- addResources((IResource[]) compoundTraversal.shallowFolders.toArray(new IResource[compoundTraversal.shallowFolders.size()]), IResource.DEPTH_ONE);
- addResources((IResource[]) compoundTraversal.zeroFolders.toArray(new IResource[compoundTraversal.zeroFolders.size()]), IResource.DEPTH_ZERO);
- addResources((IResource[]) compoundTraversal.files.toArray(new IResource[compoundTraversal.files.size()]), IResource.DEPTH_ZERO);
- }
-
- public void addResources(IResource[] resources, int depth) {
- for (int i = 0; i < resources.length; i++) {
- IResource resource = resources[i];
- addResource(resource, depth);
- }
-
- }
-
- /**
- * Return the resources contained in the given traversals that are not
- * covered by this traversal
- *
- * @param traversals
- * the traversals being testes
- * @return the resources contained in the given traversals that are not
- * covered by this traversal
- */
- public IResource[] getUncoveredResources(ResourceTraversal[] traversals) {
- CompoundResourceTraversal newTraversals = new CompoundResourceTraversal();
- newTraversals.addTraversals(traversals);
- return getUncoveredResources(newTraversals);
- }
-
- /*
- * Return any resources in the other traversal that are not covered by this
- * traversal
- */
- private IResource[] getUncoveredResources(CompoundResourceTraversal otherTraversal) {
- Set result = new HashSet();
- for (Iterator iter = otherTraversal.files.iterator(); iter.hasNext();) {
- IResource resource = (IResource) iter.next();
- if (!isCovered(resource, IResource.DEPTH_ZERO)) {
- result.add(resource);
- }
- }
- for (Iterator iter = otherTraversal.zeroFolders.iterator(); iter.hasNext();) {
- IResource resource = (IResource) iter.next();
- if (!isCovered(resource, IResource.DEPTH_ZERO)) {
- result.add(resource);
- }
- }
- for (Iterator iter = otherTraversal.shallowFolders.iterator(); iter.hasNext();) {
- IResource resource = (IResource) iter.next();
- if (!isCovered(resource, IResource.DEPTH_ONE)) {
- result.add(resource);
- }
- }
- for (Iterator iter = otherTraversal.deepFolders.iterator(); iter.hasNext();) {
- IResource resource = (IResource) iter.next();
- if (!isCovered(resource, IResource.DEPTH_INFINITE)) {
- result.add(resource);
- }
- }
- return (IResource[]) result.toArray(new IResource[result.size()]);
- }
-
- public ResourceTraversal[] asTraversals() {
- List result = new ArrayList();
- if (!files.isEmpty() || !zeroFolders.isEmpty()) {
- Set combined = new HashSet();
- combined.addAll(files);
- combined.addAll(zeroFolders);
- result.add(new ResourceTraversal((IResource[]) combined.toArray(new IResource[combined.size()]), IResource.DEPTH_ZERO, IResource.NONE));
- }
- if (!shallowFolders.isEmpty()) {
- result.add(new ResourceTraversal((IResource[]) shallowFolders.toArray(new IResource[shallowFolders.size()]), IResource.DEPTH_ONE, IResource.NONE));
- }
- if (!deepFolders.isEmpty()) {
- result.add(new ResourceTraversal((IResource[]) deepFolders.toArray(new IResource[deepFolders.size()]), IResource.DEPTH_INFINITE, IResource.NONE));
- }
- return (ResourceTraversal[]) result.toArray(new ResourceTraversal[result.size()]);
- }
-
- public IResource[] getRoots() {
- List result = new ArrayList();
- result.addAll(files);
- result.addAll(zeroFolders);
- result.addAll(shallowFolders);
- result.addAll(deepFolders);
- return (IResource[]) result.toArray(new IResource[result.size()]);
- }
-
- public ResourceTraversal[] getUncoveredTraversals(ResourceTraversal[] traversals) {
- CompoundResourceTraversal other = new CompoundResourceTraversal();
- other.addTraversals(traversals);
- return getUncoveredTraversals(other);
- }
-
- public ResourceTraversal[] getUncoveredTraversals(CompoundResourceTraversal otherTraversal) {
- CompoundResourceTraversal uncovered = new CompoundResourceTraversal();
- for (Iterator iter = otherTraversal.files.iterator(); iter.hasNext();) {
- IResource resource = (IResource) iter.next();
- if (!isCovered(resource, IResource.DEPTH_ZERO)) {
- uncovered.addResource(resource, IResource.DEPTH_ZERO);
- }
- }
- for (Iterator iter = otherTraversal.zeroFolders.iterator(); iter.hasNext();) {
- IResource resource = (IResource) iter.next();
- if (!isCovered(resource, IResource.DEPTH_ZERO)) {
- uncovered.addResource(resource, IResource.DEPTH_ZERO);
- }
- }
- for (Iterator iter = otherTraversal.shallowFolders.iterator(); iter.hasNext();) {
- IResource resource = (IResource) iter.next();
- if (!isCovered(resource, IResource.DEPTH_ONE)) {
- uncovered.addResource(resource, IResource.DEPTH_ONE);
- }
- }
- for (Iterator iter = otherTraversal.deepFolders.iterator(); iter.hasNext();) {
- IResource resource = (IResource) iter.next();
- if (!isCovered(resource, IResource.DEPTH_INFINITE)) {
- uncovered.addResource(resource, IResource.DEPTH_INFINITE);
- }
- }
- return uncovered.asTraversals();
- }
-
- public void clear() {
- deepFolders.clear();
- shallowFolders.clear();
- zeroFolders.clear();
- files.clear();
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/FileSystemOperation.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/FileSystemOperation.java
deleted file mode 100644
index 41c427a49..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/FileSystemOperation.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemOperation
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.filesystem.ui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.resources.mapping.ResourceTraversal;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.rse.internal.synchronize.RSESyncUtils;
-import org.eclipse.rse.internal.synchronize.filesystem.FileSystemProvider;
-import org.eclipse.rse.internal.synchronize.filesystem.subscriber.FileSystemSubscriber;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.mapping.ISynchronizationScope;
-import org.eclipse.team.core.subscribers.SubscriberScopeManager;
-import org.eclipse.team.ui.synchronize.ModelOperation;
-import org.eclipse.ui.IWorkbenchPart;
-
-public abstract class FileSystemOperation extends ModelOperation {
-
- /**
- * Create a scope manager for the file system example.
- *
- * @param name
- * the name of the manager
- * @param inputMappings
- * the input mappings
- * @return a scope manager
- */
- public static SubscriberScopeManager createScopeManager(String name, ResourceMapping[] inputMappings) {
- return new SubscriberScopeManager(name, inputMappings, FileSystemSubscriber.getInstance(), true);
- }
-
- /**
- * Create a file system operation.
- *
- * @param part
- * the part from which the operation was launched
- * @param manager
- * the scope manager that provides the input to the operation
- */
- protected FileSystemOperation(IWorkbenchPart part, SubscriberScopeManager manager) {
- super(part, manager);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.team.ui.synchronize.ModelOperation#execute(org.eclipse.core
- * .runtime.IProgressMonitor)
- */
- @Override
- protected void execute(IProgressMonitor monitor) throws InvocationTargetException {
- try {
- Map providerToTraversals = getProviderToTraversalsMap();
- monitor.beginTask(getTaskName(), providerToTraversals.size() * 100);
- monitor.setTaskName(getTaskName());
- for (Iterator iter = providerToTraversals.keySet().iterator(); iter.hasNext();) {
- FileSystemProvider provider = (FileSystemProvider) iter.next();
- ResourceTraversal[] traversals = getTraversals(providerToTraversals, provider);
- execute(provider, traversals, new SubProgressMonitor(monitor, 100));
- }
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Return a map of FileSystemProvider to ResourceTraversals.
- *
- * @return a map of FileSystemProvider to ResourceTraversals
- */
- private Map getProviderToTraversalsMap() {
- HashMap result = new HashMap();
- ISynchronizationScope scope = getScope();
- ResourceMapping[] mappings = scope.getMappings();
- for (int i = 0; i < mappings.length; i++) {
- ResourceMapping mapping = mappings[i];
- ResourceTraversal[] traversals = scope.getTraversals(mapping);
- for (int j = 0; j < traversals.length; j++) {
- ResourceTraversal traversal = traversals[j];
- IResource[] resources = traversal.getResources();
- for (int k = 0; k < resources.length; k++) {
- IResource resource = resources[k];
- recordResourceAndDepth(result, resource, traversal.getDepth());
- }
- }
- }
- return result;
- }
-
- /**
- * Return the file system provider associated with the given project or
- * <code>null</code> if the project is not mapped to the file system
- * provider.
- *
- * @param project
- * the project
- * @return the file system provider associated with the given project
- */
- protected FileSystemProvider getProviderFor(IProject project) {
- return (FileSystemProvider) RepositoryProvider.getProvider(project, RSESyncUtils.PROVIDER_ID);
- }
-
- private void recordResourceAndDepth(HashMap providerToTraversals, IResource resource, int depth) {
- FileSystemProvider provider = getProviderFor(resource.getProject());
- if (provider != null) {
- CompoundResourceTraversal traversal = (CompoundResourceTraversal) providerToTraversals.get(provider);
- if (traversal == null) {
- traversal = new CompoundResourceTraversal();
- providerToTraversals.put(provider, traversal);
- }
- traversal.addResource(resource, depth);
- }
- }
-
- /**
- * Return the traversals that were accumulated for the given provider by the
- * {@link #getProviderToTraversalsMap()} method.
- *
- * @param providerToTraversals
- * the provider to traversals map
- * @param provider
- * the provider
- * @return the traversals for the given provider
- */
- private ResourceTraversal[] getTraversals(Map providerToTraversals, FileSystemProvider provider) {
- CompoundResourceTraversal traversal = (CompoundResourceTraversal) providerToTraversals.get(provider);
- return traversal.asTraversals();
- }
-
- /**
- * Execute the operation for the given provider and traversals.
- *
- * @param provider
- * the provider
- * @param traversals
- * the traversals to be operated on
- * @param monitor
- * a progress monitor
- * @throws CoreException
- */
- protected abstract void execute(FileSystemProvider provider, ResourceTraversal[] traversals, IProgressMonitor monitor) throws CoreException;
-
- /**
- * Return the task name for this operation.
- *
- * @return the task name for this operation
- */
- protected abstract String getTaskName();
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.team.ui.TeamOperation#canRunAsJob()
- */
- @Override
- protected boolean canRunAsJob() {
- return true;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/FileSystemSynchronizeParticipant.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/FileSystemSynchronizeParticipant.java
deleted file mode 100644
index e36ee2811..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/FileSystemSynchronizeParticipant.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / FileSystemSynchronizeParticipant
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.filesystem.ui;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.rse.internal.importexport.SystemImportExportResources;
-import org.eclipse.rse.internal.synchronize.filesystem.FileSystemPlugin;
-import org.eclipse.rse.internal.synchronize.filesystem.subscriber.FileSystemMergeContext;
-import org.eclipse.rse.internal.synchronize.filesystem.subscriber.FileSystemSubscriber;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.mapping.ISynchronizationScopeManager;
-import org.eclipse.team.core.mapping.provider.MergeContext;
-import org.eclipse.team.core.mapping.provider.SynchronizationContext;
-import org.eclipse.team.core.synchronize.SyncInfo;
-import org.eclipse.team.core.variants.IResourceVariant;
-import org.eclipse.team.internal.ui.TeamUIPlugin;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizeModelElement;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.ModelSynchronizeParticipant;
-import org.eclipse.team.ui.synchronize.ModelSynchronizeParticipantActionGroup;
-
-/**
- * This is an example synchronize participant for the file system provider. It
- * will allow showing synchronization state for local resources mapped to a
- * remote file system location.
- *
- * @since 3.0
- */
-public class FileSystemSynchronizeParticipant extends ModelSynchronizeParticipant {
-
- /**
- * The participant id for the org.eclipse.team.ui.synchronizeParticipant
- * extension point.
- */
- public static final String ID = "org.eclipse.rse.internal.synchronize.filesystem.participant"; //$NON-NLS-1$
-
- /**
- * The viewer id for the org.eclipse.ui.navigator.viewer extension point.
- */
- public static final String VIEWER_ID = "org.eclipse.rse.internal.synchronize.filesystem.syncViewer"; //$NON-NLS-1$
-
- /**
- * Custom menu groups included in the viewer definition in the plugin.xml.
- */
- public static final String CONTEXT_MENU_MERGE_GROUP_1 = "merge"; //$NON-NLS-1$
- public static final String CONTEXT_MENU_PUT_GROUP_1 = "put"; //$NON-NLS-1$
- public static final String CONTEXT_MENU_GET_GROUP_1 = "get"; //$NON-NLS-1$
- public static final String CONTEXT_MENU_OVERWRITE_GROUP_1 = "overwrite"; //$NON-NLS-1$
-
- /**
- * A custom label decorator that will show the remote mapped path for each
- * file.
- */
- public class FileSystemParticipantLabelDecorator extends LabelProvider implements ILabelDecorator {
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ILabelDecorator#decorateImage(org.eclipse
- * .swt.graphics.Image, java.lang.Object)
- */
- public Image decorateImage(Image image, Object element) {
- return image;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.jface.viewers.ILabelDecorator#decorateText(java.lang.
- * String, java.lang.Object)
- */
- public String decorateText(String text, Object element) {
- try {
- if (element instanceof ISynchronizeModelElement) {
- IResource resource = ((ISynchronizeModelElement) element).getResource();
- if (resource != null && resource.getType() == IResource.FILE) {
- SyncInfo info = FileSystemSubscriber.getInstance().getSyncInfo(resource);
- IResourceVariant variant = info.getRemote();
- if (variant != null) {
- return text + " (" + variant.getContentIdentifier() + ")";
- }
- }
- }
- } catch (TeamException e) {
- FileSystemPlugin.log(e);
- }
- return null;
- }
- }
-
- /**
- * Action group that contributes the get an put menus to the context menu in
- * the synchronize view
- */
- public class FileSystemParticipantActionGroup extends ModelSynchronizeParticipantActionGroup {
- private ModelPutAction putAction;
- private ModelGetAction getAction;
- private ModelMergeAction mergeAction;
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.team.ui.synchronize.SynchronizePageActionGroup#initialize
- * (org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
- @Override
- public void initialize(ISynchronizePageConfiguration configuration) {
- super.initialize(configuration);
- putAction = new ModelPutAction("", configuration);
- getAction = new ModelGetAction("", configuration);
- mergeAction = new ModelMergeAction("", configuration);
- }
-
-
-
- @Override
- public void fillContextMenu(IMenuManager menu) {
- //menu.remove(CONTEXT_MENU_GET_GROUP_1);
- //menu.remove(CONTEXT_MENU_PUT_GROUP_1);
-
- try {
- //super.fillContextMenu(menu);
- TreeSelection selection = (TreeSelection)getConfiguration().getSite().getSelectionProvider().getSelection();
- boolean hasOutgoingChange = false;
- boolean hasIncomingChange = false;
- boolean hasConflictingChange = false;
- boolean hasSingleResource = selection.size() == 1?true:false;
-
- List<IResource> resources = new ArrayList<IResource>();
- for (Iterator iterator = selection.iterator(); iterator.hasNext();) {
- resources.add(Utils.getResource(iterator.next()));
- }
-
- for (Iterator<IResource> iterator = resources.iterator(); iterator.hasNext();) {
-
- IResource resource = (IResource) iterator.next();
- SyncInfo info = FileSystemSubscriber.getInstance().getSyncInfo(resource);
-
- int kind = info.getKind();
-
- if(SyncInfo.getDirection(kind) == SyncInfo.OUTGOING){
- hasOutgoingChange = true;
- } else if (SyncInfo.getDirection(kind) == SyncInfo.INCOMING){
- hasIncomingChange = true;
- }
- else if (SyncInfo.getDirection(kind) == SyncInfo.CONFLICTING){
- hasConflictingChange = true;
- }
- }
-
- if (hasConflictingChange){
- if(hasSingleResource){
- mergeAction.setText(SystemImportExportResources.RESID_SYNCHRONIZE_ACTIONS_MERGE_LABEL);
- }else{
- mergeAction.setText(SystemImportExportResources.RESID_SYNCHRONIZE_ACTIONS_MERGE_ALL_LABEL);
- }
- appendToGroup(ISynchronizePageConfiguration.P_CONTEXT_MENU, CONTEXT_MENU_MERGE_GROUP_1, putAction);
- menu.appendToGroup(CONTEXT_MENU_MERGE_GROUP_1, mergeAction);
- }
-
- if(hasOutgoingChange){
- if(hasSingleResource){
- putAction.setText(SystemImportExportResources.RESID_SYNCHRONIZE_ACTIONS_PUT_LABEL);
- }else{
- putAction.setText(SystemImportExportResources.RESID_SYNCHRONIZE_ACTIONS_PUT_ALL_LABEL);
- }
- appendToGroup(ISynchronizePageConfiguration.P_CONTEXT_MENU, CONTEXT_MENU_PUT_GROUP_1, putAction);
- menu.appendToGroup(CONTEXT_MENU_PUT_GROUP_1, putAction);
- }
-
- if(hasIncomingChange){
- if(hasSingleResource){
- getAction.setText(SystemImportExportResources.RESID_SYNCHRONIZE_ACTIONS_GET_LABEL);
- }else{
- getAction.setText(SystemImportExportResources.RESID_SYNCHRONIZE_ACTIONS_GET_ALL_LABEL);
- }
- appendToGroup(ISynchronizePageConfiguration.P_CONTEXT_MENU, CONTEXT_MENU_GET_GROUP_1, getAction);
- menu.appendToGroup(CONTEXT_MENU_GET_GROUP_1, getAction);
- }
-
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
- }
- /**
- * Create a file system participant. This method is invoked by the
- * Synchronize view when a persisted participant is being restored.
- * Participants that are persisted must override the {@link
- * #restoreContext(ISynchronizationScopeManager)} method to recreate the
- * context and may also need to override the {@link
- * #createScopeManager(ResourceMapping[])} method if they require a custom
- * scope manager.
- */
- public FileSystemSynchronizeParticipant() {
- super();
- }
-
- /**
- * Create the participant for the given context. This method is used by the
- * file system plugin to create a participant and then add it to the sync
- * view (or show it is some other container).
- *
- * @param context
- * the synchronization context
- */
- public FileSystemSynchronizeParticipant(SynchronizationContext context) {
- super(context);
- try {
- setInitializationData(TeamUI.getSynchronizeManager().getParticipantDescriptor(ID));
- } catch (CoreException e) {
- TeamUIPlugin.log(e);
- }
- setSecondaryId(Long.toString(System.currentTimeMillis()));
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.eclipse.team.ui.synchronize.subscribers.SubscriberParticipant#
- * initializeConfiguration
- * (org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration)
- */
- @Override
- protected void initializeConfiguration(ISynchronizePageConfiguration configuration) {
- super.initializeConfiguration(configuration);
- configuration.setProperty(ISynchronizePageConfiguration.P_VIEWER_ID, VIEWER_ID);
-
- // Add the label decorator
- configuration.addLabelDecorator(new FileSystemParticipantLabelDecorator());
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.eclipse.team.ui.synchronize.ModelSynchronizeParticipant#
- * createMergeActionGroup()
- */
- @Override
- protected ModelSynchronizeParticipantActionGroup createMergeActionGroup() {
- return new FileSystemParticipantActionGroup();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.team.ui.synchronize.ModelSynchronizeParticipant#restoreContext
- * (org.eclipse.team.core.mapping.ISynchronizationScopeManager)
- */
- @Override
- protected MergeContext restoreContext(ISynchronizationScopeManager manager) {
- return new FileSystemMergeContext(manager);
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.eclipse.team.ui.synchronize.ModelSynchronizeParticipant#
- * createScopeManager(org.eclipse.core.resources.mapping.ResourceMapping[])
- */
- @Override
- protected ISynchronizationScopeManager createScopeManager(ResourceMapping[] mappings) {
- return FileSystemOperation.createScopeManager(getName(), mappings);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/GetOperation.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/GetOperation.java
deleted file mode 100644
index ec68a6edf..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/GetOperation.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / GetOperation
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.filesystem.ui;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceTraversal;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.rse.internal.synchronize.filesystem.FileSystemProvider;
-import org.eclipse.rse.internal.synchronize.filesystem.Policy;
-import org.eclipse.rse.internal.synchronize.filesystem.subscriber.FileSystemSubscriber;
-import org.eclipse.team.core.TeamException;
-import org.eclipse.team.core.diff.IDiff;
-import org.eclipse.team.core.diff.IDiffVisitor;
-import org.eclipse.team.core.diff.IThreeWayDiff;
-import org.eclipse.team.core.subscribers.SubscriberScopeManager;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Operation for getting the contents of the selected resources
- */
-public class GetOperation extends FileSystemOperation {
-
- private boolean overwriteOutgoing;
-
- public GetOperation(IWorkbenchPart part, SubscriberScopeManager manager) {
- super(part, manager);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.rse.internal.synchronize.provisional.filesystem.ui.FileSystemOperation#execute
- * (org.eclipse.rse.internal.synchronize.provisional.filesystem.FileSystemProvider,
- * org.eclipse.core.resources.mapping.ResourceTraversal[],
- * org.eclipse.core.runtime.SubProgressMonitor)
- */
- @Override
- protected void execute(FileSystemProvider provider, ResourceTraversal[] traversals, IProgressMonitor monitor) throws CoreException {
- try {
- provider.getOperations().get(traversals, isOverwriteOutgoing(), monitor);
- if (!isOverwriteOutgoing() && hasIncomingChanges(traversals)) {
- throw new TeamException("Could not get all changes due to conflicts.");
- }
-
- provider.getProject().refreshLocal(IResource.DEPTH_INFINITE, monitor);
-
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
-
- private boolean hasIncomingChanges(ResourceTraversal[] traversals) throws CoreException {
- final RuntimeException found = new RuntimeException();
- try {
- FileSystemSubscriber.getInstance().accept(traversals, new IDiffVisitor() {
- public boolean visit(IDiff diff) {
- if (diff instanceof IThreeWayDiff) {
- IThreeWayDiff twd = (IThreeWayDiff) diff;
- if (twd.getDirection() == IThreeWayDiff.INCOMING || twd.getDirection() == IThreeWayDiff.CONFLICTING) {
- throw found;
- }
- }
- return false;
- }
- });
- } catch (RuntimeException e) {
- if (e == found)
- return true;
- throw e;
- }
- return false;
- }
-
- /**
- * Indicate whether the operation should overwrite outgoing changes. By
- * default, the get operation does not override local modifications.
- *
- * @return whether the operation should overwrite outgoing changes.
- */
- protected boolean isOverwriteOutgoing() {
- return overwriteOutgoing;
- }
-
- /**
- * Set whether the operation should overwrite outgoing changes.
- *
- * @param overwriteOutgoing
- * whether the operation should overwrite outgoing changes
- */
- public void setOverwriteOutgoing(boolean overwriteOutgoing) {
- this.overwriteOutgoing = overwriteOutgoing;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.rse.internal.synchronize.provisional.filesystem.ui.FileSystemOperation#getTaskName
- * ()
- */
- @Override
- protected String getTaskName() {
- return Policy.bind("GetAction.working"); //$NON-NLS-1$
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/MergeOperation.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/MergeOperation.java
deleted file mode 100644
index 1459393af..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/MergeOperation.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2009 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-package org.eclipse.rse.internal.synchronize.filesystem.ui;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.team.core.mapping.IMergeContext;
-import org.eclipse.team.core.mapping.ISynchronizationContext;
-import org.eclipse.team.core.mapping.provider.SynchronizationContext;
-import org.eclipse.team.internal.ui.TeamUIMessages;
-import org.eclipse.team.ui.mapping.SynchronizationOperation;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.ModelMergeOperation;
-
-public class MergeOperation extends SynchronizationOperation {
-
- private IMergeContext context;
-
- protected MergeOperation(ISynchronizePageConfiguration configuration, Object[] elements, IMergeContext context) {
- super(configuration, elements);
-
- this.context= context;
- }
-
-
- /* (non-Javadoc)
- * @see org.eclipse.team.ui.mapping.SynchronizationOperation#execute(org.eclipse.core.runtime.IProgressMonitor)
- */
- public void execute(IProgressMonitor monitor) throws InvocationTargetException,
- InterruptedException {
- new ModelMergeOperation(getPart(), ((SynchronizationContext)context).getScopeManager()) {
- public boolean isPreviewRequested() {
- return false;
- }
- protected void initializeContext(IProgressMonitor monitor) throws CoreException {
- monitor.beginTask(null, 10);
- monitor.done();
- }
- protected ISynchronizationContext getContext() {
- return context;
- }
- protected void executeMerge(IProgressMonitor monitor) throws CoreException {
- monitor.beginTask(null, 100);
- if (!hasChangesOfInterest()) {
- handleNoChanges();
- } else if (isPreviewRequested()) {
- handlePreviewRequest();
- } else {
- IStatus status = ModelMergeOperation.validateMerge(getMergeContext(), monitor);
- if (!status.isOK()) {
- if (!promptToContinue(status))
- return;
- }
- status = performMerge(monitor);
- if (!status.isOK()) {
- handleMergeFailure(status);
- }
- }
- monitor.done();
- }
- private IMergeContext getMergeContext() {
- return (IMergeContext)getContext();
- }
- private boolean promptToContinue(final IStatus status) {
- final boolean[] result = new boolean[] { false };
- Runnable runnable = new Runnable() {
- public void run() {
- ErrorDialog dialog = new ErrorDialog(getShell(), TeamUIMessages.ModelMergeOperation_0, TeamUIMessages.ModelMergeOperation_1, status, IStatus.ERROR | IStatus.WARNING | IStatus.INFO) {
- protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL,
- false);
- createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL,
- true);
- createDetailsButton(parent);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.ErrorDialog#buttonPressed(int)
- */
- protected void buttonPressed(int id) {
- if (id == IDialogConstants.YES_ID)
- super.buttonPressed(IDialogConstants.OK_ID);
- else if (id == IDialogConstants.NO_ID)
- super.buttonPressed(IDialogConstants.CANCEL_ID);
- super.buttonPressed(id);
- }
- };
- int code = dialog.open();
- result[0] = code == 0;
- }
- };
- getShell().getDisplay().syncExec(runnable);
- return (result[0]);
- }
- }.run(monitor);
- }
-
-
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/ModelGetAction.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/ModelGetAction.java
deleted file mode 100644
index ee84fbb80..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/ModelGetAction.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / ModelPutAction
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.filesystem.ui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.internal.synchronize.RSESyncUtils;
-import org.eclipse.team.core.subscribers.SubscriberScopeManager;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.ModelParticipantAction;
-
-public class ModelGetAction extends ModelParticipantAction{
- public static final String GET_ACTION_ID = "org.eclipse.rse.internal.synchronize.getAction";
-
- public ModelGetAction(String text, ISynchronizePageConfiguration configuration){
- super(text, configuration);
- setId(GET_ACTION_ID);
- }
-
- @Override
- protected boolean isEnabledForSelection(IStructuredSelection selection) {
- // Only enable the put in outgoing or both modes
- int mode = getConfiguration().getMode();
- if (mode == ISynchronizePageConfiguration.OUTGOING_MODE || mode == ISynchronizePageConfiguration.BOTH_MODE) {
- return getResourceMappings(selection).length > 0;
- }
- return false;
- }
-
- private ResourceMapping[] getResourceMappings(IStructuredSelection selection) {
- List mappings = new ArrayList();
- for (Iterator iter = selection.iterator(); iter.hasNext();) {
- Object element = iter.next();
- ResourceMapping mapping = Utils.getResourceMapping(element);
- if (mapping != null)
- mappings.add(mapping);
- }
- return (ResourceMapping[]) mappings.toArray(new ResourceMapping[mappings.size()]);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.Action#run()
- */
- @Override
- public void run() {
- ResourceMapping[] resourceMappings = getResourceMappings(getStructuredSelection());
- SubscriberScopeManager manager = FileSystemOperation.createScopeManager("Get", resourceMappings);
- try {
- new GetOperation(getConfiguration().getSite().getPart(), manager).run();
- } catch (InvocationTargetException e) {
- IStatus status = getStatus(e);
- ErrorDialog.openError(getConfiguration().getSite().getShell(), null, null, status);
- } catch (InterruptedException e) {
- // Ignore
- }
- }
-
- private IStatus getStatus(Throwable throwable) {
- if (throwable instanceof InvocationTargetException) {
- return getStatus(((InvocationTargetException) throwable).getCause());
- }
- return new Status(IStatus.ERROR, RSESyncUtils.PLUGIN_ID, 0, "An error occurred during the put.", throwable);
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/ModelMergeAction.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/ModelMergeAction.java
deleted file mode 100644
index 5369d98e6..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/ModelMergeAction.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/********************************************************************************
- * Copyright (c) 2009 IBM Corporation. All rights reserved.
- * This program and the accompanying materials are made available under the terms
- * of the Eclipse Public License v1.0 which accompanies this distribution, and is
- * available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Initial Contributors:
- * The following IBM employees contributed to the Remote System Explorer
- * component that contains this file: David McKnight.
- *
- * Contributors:
- * {Name} (company) - description of contribution.
- ********************************************************************************/
-package org.eclipse.rse.internal.synchronize.filesystem.ui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.internal.synchronize.RSESyncUtils;
-import org.eclipse.team.core.mapping.IMergeContext;
-import org.eclipse.team.core.subscribers.SubscriberScopeManager;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.mapping.ITeamContentProviderManager;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.ModelParticipantAction;
-
-public class ModelMergeAction extends ModelParticipantAction {
-
- public ModelMergeAction(String text,
- ISynchronizePageConfiguration configuration) {
- super(text, configuration);
- // TODO Auto-generated constructor stub
- }
-
- @Override
- protected boolean isEnabledForSelection(IStructuredSelection selection) {
- // Only enable the put in outgoing or both modes
- int mode = getConfiguration().getMode();
- if (mode == ISynchronizePageConfiguration.OUTGOING_MODE || mode == ISynchronizePageConfiguration.BOTH_MODE) {
- return getResourceMappings(selection).length > 0;
- }
- return false;
- }
-
- private ResourceMapping[] getResourceMappings(IStructuredSelection selection) {
- List mappings = new ArrayList();
- for (Iterator iter = selection.iterator(); iter.hasNext();) {
- Object element = iter.next();
- ResourceMapping mapping = Utils.getResourceMapping(element);
- if (mapping != null)
- mappings.add(mapping);
- }
- return (ResourceMapping[]) mappings.toArray(new ResourceMapping[mappings.size()]);
- }
-
- private IMergeContext getContext(ResourceMapping[] mappings) {
- //SubscriberScopeManager manager = FileSystemOperation.createScopeManager(FileSystemSubscriber.getInstance().getName(), mappings);
- //return new FileSystemMergeContext(manager);
-
- return ((IMergeContext)getConfiguration().getProperty(ITeamContentProviderManager.P_SYNCHRONIZATION_CONTEXT));
- }
-
- public void run() {
- ResourceMapping[] resourceMappings = getResourceMappings(getStructuredSelection());
- SubscriberScopeManager manager = FileSystemOperation.createScopeManager("Merge", resourceMappings);
- try {
- new MergeOperation(getConfiguration(), resourceMappings, getContext(resourceMappings)).run();
- } catch (InvocationTargetException e) {
- IStatus status = getStatus(e);
- ErrorDialog.openError(getConfiguration().getSite().getShell(), null, null, status);
- } catch (InterruptedException e) {
- // Ignore
- }
- }
-
- private IStatus getStatus(Throwable throwable) {
- if (throwable instanceof InvocationTargetException) {
- return getStatus(((InvocationTargetException) throwable).getCause());
- }
- return new Status(IStatus.ERROR, RSESyncUtils.PLUGIN_ID, 0, "An error occurred during the put.", throwable);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/ModelPutAction.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/ModelPutAction.java
deleted file mode 100644
index eef791279..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/ModelPutAction.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / ModelPutAction
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.filesystem.ui;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.internal.synchronize.RSESyncUtils;
-import org.eclipse.team.core.subscribers.SubscriberScopeManager;
-import org.eclipse.team.internal.ui.Utils;
-import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration;
-import org.eclipse.team.ui.synchronize.ModelParticipantAction;
-
-/**
- * A put action for use in the file system synchronize participant.
- */
-public class ModelPutAction extends ModelParticipantAction {
- public static final String PUT_ACTION_ID = "org.eclipse.rse.internal.synchronize.putAction";
-
- public ModelPutAction(String text, ISynchronizePageConfiguration configuration) {
- super(text, configuration);
- setId(PUT_ACTION_ID);
- }
-
- @Override
- protected boolean isEnabledForSelection(IStructuredSelection selection) {
- // Only enable the put in outgoing or both modes
- int mode = getConfiguration().getMode();
- if (mode == ISynchronizePageConfiguration.OUTGOING_MODE || mode == ISynchronizePageConfiguration.BOTH_MODE) {
- return getResourceMappings(selection).length > 0;
- }
- return false;
- }
-
- private ResourceMapping[] getResourceMappings(IStructuredSelection selection) {
- List mappings = new ArrayList();
- for (Iterator iter = selection.iterator(); iter.hasNext();) {
- Object element = iter.next();
- ResourceMapping mapping = Utils.getResourceMapping(element);
- if (mapping != null)
- mappings.add(mapping);
- }
- return (ResourceMapping[]) mappings.toArray(new ResourceMapping[mappings.size()]);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.action.Action#run()
- */
- @Override
- public void run() {
- ResourceMapping[] resourceMappings = getResourceMappings(getStructuredSelection());
- SubscriberScopeManager manager = FileSystemOperation.createScopeManager("Put", resourceMappings);
- try {
- new PutOperation(getConfiguration().getSite().getPart(), manager).run();
- } catch (InvocationTargetException e) {
- IStatus status = getStatus(e);
- ErrorDialog.openError(getConfiguration().getSite().getShell(), null, null, status);
- } catch (InterruptedException e) {
- // Ignore
- }
- }
-
- private IStatus getStatus(Throwable throwable) {
- if (throwable instanceof InvocationTargetException) {
- return getStatus(((InvocationTargetException) throwable).getCause());
- }
- return new Status(IStatus.ERROR, RSESyncUtils.PLUGIN_ID, 0, "An error occurred during the put.", throwable);
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/PutOperation.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/PutOperation.java
deleted file mode 100644
index 80c4c3032..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/filesystem/ui/PutOperation.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Takuya Miyamoto - Adapted from org.eclipse.team.examples.filesystem / PutOperation
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.filesystem.ui;
-
-import org.eclipse.core.resources.mapping.ResourceTraversal;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.events.ISystemResourceChangeEvents;
-import org.eclipse.rse.core.events.SystemResourceChangeEvent;
-import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.internal.synchronize.filesystem.FileSystemProvider;
-import org.eclipse.rse.internal.synchronize.filesystem.Policy;
-import org.eclipse.rse.internal.synchronize.filesystem.subscriber.FileSystemSubscriber;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.team.core.diff.IDiff;
-import org.eclipse.team.core.diff.IDiffVisitor;
-import org.eclipse.team.core.diff.IThreeWayDiff;
-import org.eclipse.team.core.subscribers.SubscriberScopeManager;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Operation for copying the selected resources to the file system location
- */
-public class PutOperation extends FileSystemOperation {
-
- private boolean overwriteIncoming;
-
- /**
- * Create the put operation
- *
- * @param part
- * the originating part
- * @param manager
- * the scope manager
- */
- protected PutOperation(IWorkbenchPart part, SubscriberScopeManager manager) {
- super(part, manager);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.rse.internal.synchronize.provisional.filesystem.ui.FileSystemOperation#execute
- * (org.eclipse.rse.internal.synchronize.provisional.filesystem.FileSystemProvider,
- * org.eclipse.core.resources.mapping.ResourceTraversal[],
- * org.eclipse.core.runtime.SubProgressMonitor)
- */
- @Override
- protected void execute(FileSystemProvider provider, ResourceTraversal[] traversals, IProgressMonitor monitor) throws CoreException {
- provider.getOperations().checkin(traversals, isOverwriteIncoming(), monitor);
-
- // refresh RSE
- IRemoteFile rootFolder = provider.getRemoteRootFolder().getRemoteFile();
- ISystemRegistry sr = RSECorePlugin.getTheSystemRegistry();
-
- try {
- rootFolder = rootFolder.getParentRemoteFileSubSystem().getRemoteFileObject(rootFolder.getAbsolutePath(), monitor);
- rootFolder.markStale(true);
- sr.fireEvent(new SystemResourceChangeEvent(rootFolder, ISystemResourceChangeEvents.EVENT_REFRESH_REMOTE, rootFolder.getAbsolutePath()));
- }
- catch (Exception e){}
-
- // if (!isOverwriteIncoming() && hasOutgoingChanges(traversals)) {
- // throw new
- // TeamException("Could not put all changes due to conflicts.");
- // }
-
- }
-
- private boolean hasOutgoingChanges(ResourceTraversal[] traversals) throws CoreException {
- final RuntimeException found = new RuntimeException();
- try {
- FileSystemSubscriber.getInstance().accept(traversals, new IDiffVisitor() {
- public boolean visit(IDiff diff) {
- if (diff instanceof IThreeWayDiff) {
- IThreeWayDiff twd = (IThreeWayDiff) diff;
- if (twd.getDirection() == IThreeWayDiff.OUTGOING || twd.getDirection() == IThreeWayDiff.CONFLICTING) {
- throw found;
- }
- }
- return false;
- }
- });
- } catch (RuntimeException e) {
- e.printStackTrace();
- if (e == found)
- return true;
- throw e;
- }
- return false;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.rse.internal.synchronize.provisional.filesystem.ui.FileSystemOperation#getTaskName
- * ()
- */
- @Override
- protected String getTaskName() {
- return Policy.bind("PutAction.working"); //$NON-NLS-1$
- }
-
- /**
- * Return whether incoming changes should be overwritten.
- *
- * @return whether incoming changes should be overwritten
- */
- public boolean isOverwriteIncoming() {
- return overwriteIncoming;
- }
-
- /**
- * Set whether incoming changes should be overwritten.
- *
- * @param overwriteIncoming
- * whether incoming changes should be overwritten
- */
- public void setOverwriteIncoming(boolean overwriteIncoming) {
- this.overwriteIncoming = overwriteIncoming;
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizeByteCalculator.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizeByteCalculator.java
deleted file mode 100644
index 78ca55858..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizeByteCalculator.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Takuya Miyamoto and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Takuya Miyamoto - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.provisional;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-
-/**
- * Helper class to calculate byte array for synchronization in some algorithm.
- * This interface is used in comparison of resource and resourceVariant. In the
- * comparison, it's necessary to calculate byte array associated with them.
- *
- */
-public interface ISynchronizeByteCalculator {
- /**
- * Timestamp: The last modification time is used for comparison
- */
- public static final int DIFF_TYPE_TIMESTAMP = 0;
- /**
- * MD5: The message digest 5 is used for comparison
- */
- public static final int DIFF_TYPE_MD5 = 1;
-
- /**
- * Return byte array for comparison used in synchronization. The criterion
- * is specified by option.
- *
- * @param local
- * @param option
- * @return
- */
- public byte[] cacByte(IResource local, int option);
-
- /**
- * Return byte array for comparison used in synchronization. The criterion
- * is specified by option.
- *
- * @param remote
- * @param option
- * @return
- */
- public byte[] calcByte(IRemoteFile remote, int option);
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizeConnectionManager.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizeConnectionManager.java
deleted file mode 100644
index 909fcac79..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizeConnectionManager.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Takuya Miyamoto and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Takuya Miyamoto - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.provisional;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.team.core.TeamException;
-
-public interface ISynchronizeConnectionManager {
- /**
- * Return if the project is already shared or not.
- *
- * @param project
- * @return
- */
- public boolean isConnected(IProject project);
-
- /**
- * Share the project. Sharing project is necessary for synchronization.
- *
- * @param project
- * @throws TeamException
- */
- public void connect(IProject project) throws TeamException;
-
- /**
- * Finish sharing the project. When sharing finished, re-synchronization no
- * longer runs.
- *
- * @param project
- * @throws TeamException
- */
- public void disconnect(IProject project) throws TeamException;
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizeFilter.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizeFilter.java
deleted file mode 100644
index 0c0ca181f..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizeFilter.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Takuya Miyamoto and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Takuya Miyamoto - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.provisional;
-
-import org.eclipse.core.runtime.IPath;
-
-/**
- * Captures the filter that a user sets up in the import/export wizard, in order
- * to exclude certain files or directories from synchronization. All file system
- * paths are relative to the synchronization root.
- */
-public interface ISynchronizeFilter {
- /**
- * Return if the resource specified by relativePath is excluded or not.
- *
- * @param relativePath
- * @return
- */
- public boolean isExcluded(IPath relativePath);
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizeOperation.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizeOperation.java
deleted file mode 100644
index 2445a0d87..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizeOperation.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Takuya Miyamoto and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Takuya Miyamoto - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.provisional;
-
-import java.util.Calendar;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-
-/**
- * Utility class to synchronize local and remote resources. IResource is used as
- * local resources. IRemoteFile is used as remote resources. There are some
- * kinds of synchronization, such as Import, Export, Synchronize, or Manual
- * Synchronize.
- */
-public interface ISynchronizeOperation {
- /**
- * the mode of synchronization is not defined
- */
- public static final int SYNC_MODE_NON = 0;
- /**
- * "Import": Always override source with destination
- */
- public static final int SYNC_MODE_OVERRIDE_SOURCE = 1;
- /**
- * "Export": Always override destination with source.
- */
- public static final int SYNC_MODE_OVERRIDE_DEST = 2;
- /**
- * "Re-Synchronize": Always override older files with newer ones
- */
- public static final int SYNC_MODE_OVERRIDE_OLDER = 3;
- /**
- * "Manual Re-Synchronize":Review sync in UI
- */
- public static final int SYNC_MODE_UI_REVIEW = 4;
-
- /**
- * TODO This will be removed because initial synchronize will be import or
- * export. "Initial Manual Synchronize":Review sync in UI.
- */
- public static final int SYNC_MODE_UI_REVIEW_INITIAL = 5;
-
- /**
- * Synchronize local with remote, using the given filter. Both local and
- * remote are folder. If lastSyncDate != null, it is the timestamp of last
- * synchronization (for 3-way synchronization). The filter is always applied
- * to the all kinds of synchronize operation. In initial export operation,
- * filter is applied to the exported local resources. In initial import
- * operation, filter is applied to the imported remote resources. In
- * synchronization, filter is applied to the synchronized resources. throws
- * CoreException if any error occurs. When SYNC_MODE_UI_REVIEW is requested
- * option, the method returns as soon as the Synchronize View has been
- * filled with contents according to the request.
- *
- * @param local
- * @param remote
- * @param filter
- * @param lastSyncDate
- * @param options
- * @throws CoreException
- */
- // TODO currently lastSyncDate is unnecessary
- public void synchronize(List<IResource> local, IRemoteFile remote, ISynchronizeFilter filter, Calendar lastSyncDate, int options) throws CoreException;
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizePerspectiveSelector.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizePerspectiveSelector.java
deleted file mode 100644
index 6937677b7..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizePerspectiveSelector.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Takuya Miyamoto and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Takuya Miyamoto - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.provisional;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-
-/**
- *
- * Switch to the team synchronization perspective
- *
- */
-public interface ISynchronizePerspectiveSelector {
-
- /**
- * Open synchronize perspective
- *
- * @param synchronizeElement
- */
- public void openSynchronizePerspective(List<IResource> synchronizeElement);
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizer.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizer.java
deleted file mode 100644
index 7f91c305b..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/ISynchronizer.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Takuya Miyamoto and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Takuya Miyamoto - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.provisional;
-
-/**
- *
- * This class manage the start point of actual synchronize operation. The class
- * that implement this interface must have necessary informations for
- * synchronization.
- *
- */
-public interface ISynchronizer {
-
- /**
- * Run the SynchronizeOperation. Preparing for the synchronization and
- * invoke ISyncronizeOperation#synchronize() as an actual synchronize
- * operation. Preparing is mapping the project to RepositoryProvider, and if
- * needed, unmap for new synchronization. This method is called directory
- * from GUI.
- *
- * @param operation
- * @return
- */
- public boolean run(ISynchronizeOperation operation);
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/SynchronizeConnectionManager.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/SynchronizeConnectionManager.java
deleted file mode 100644
index 9c5a276f4..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/SynchronizeConnectionManager.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Takuya Miyamoto and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Takuya Miyamoto - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.provisional;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.rse.internal.synchronize.RSESyncUtils;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-
-public class SynchronizeConnectionManager implements ISynchronizeConnectionManager {
- public void connect(IProject project) throws TeamException {
- RepositoryProvider.map(project, RSESyncUtils.PROVIDER_ID);
- }
-
- public void disconnect(IProject project) throws TeamException {
- if (isConnected(project)) {
- RepositoryProvider.unmap(project);
- }
- }
-
- public boolean isConnected(IProject project) {
- return RepositoryProvider.isShared(project);
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/SynchronizeFilter.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/SynchronizeFilter.java
deleted file mode 100644
index 2217d0409..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/SynchronizeFilter.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Takuya Miyamoto and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Takuya Miyamoto - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.provisional;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-
-public class SynchronizeFilter implements ISynchronizeFilter {
- /**
- * the paths of synchronize elements
- */
- private List<IPath> paths;
-
- public SynchronizeFilter(List<IPath> sycnhronizeRelativePaths) {
- super();
- this.paths = sycnhronizeRelativePaths;
- }
-
- public boolean isExcluded(IPath relativePath) {
- if(paths.contains(relativePath)){
- return false;
- }else{
- return true;
- }
- }
-
-} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/SynchronizeOperation.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/SynchronizeOperation.java
deleted file mode 100644
index a460ebf76..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/SynchronizeOperation.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Takuya Miyamoto and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Takuya Miyamoto - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.provisional;
-
-import java.util.Calendar;
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.rse.internal.synchronize.filesystem.FileSystemOperations;
-import org.eclipse.rse.internal.synchronize.filesystem.FileSystemProvider;
-import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-
-public class SynchronizeOperation implements ISynchronizeOperation {
- private ISynchronizePerspectiveSelector switcher;
-
- public SynchronizeOperation() {
- this.switcher = new SynchronizePerspectiveSelector();
- }
-
- public void synchronize(List<IResource> local, IRemoteFile remote, ISynchronizeFilter filter, Calendar lastSyncDate, int options) throws CoreException {
-
- switch (options) {
- case SYNC_MODE_OVERRIDE_DEST:
- exportTo(local, remote, filter);
- break;
- case SYNC_MODE_OVERRIDE_SOURCE:
- importFrom(local, remote, filter);
- break;
- case SYNC_MODE_OVERRIDE_OLDER:
- synchronizeWith(local, remote, filter, lastSyncDate);
- break;
- case SYNC_MODE_UI_REVIEW:
- synchronizeManually(local, remote, filter, lastSyncDate);
- break;
- case SYNC_MODE_UI_REVIEW_INITIAL:
- initialSynchronizeManually(local, remote, filter, lastSyncDate);
- break;
- }
-
- }
-
- private void importFrom(List<IResource> local, IRemoteFile remote, ISynchronizeFilter filter) throws TeamException{
- for (IResource resource : local) {
- FileSystemProvider provider = (FileSystemProvider) RepositoryProvider.getProvider(resource.getProject());
- FileSystemOperations operations = provider.getOperations();
- operations.get(new IResource[] { resource }, IResource.DEPTH_INFINITE, true, null);
- }
- }
-
-
- private void exportTo(List<IResource> local, IRemoteFile remote, ISynchronizeFilter filter) throws TeamException {
- for (IResource resource : local) {
- FileSystemProvider provider = (FileSystemProvider) RepositoryProvider.getProvider(resource.getProject());
- FileSystemOperations operations = provider.getOperations();
- operations.checkin(new IResource[] { resource }, IResource.DEPTH_INFINITE, false, null);
- }
- }
-
- private void synchronizeWith(List<IResource> local, IRemoteFile remote, ISynchronizeFilter filter, Calendar lastSyncDate) {
-
- }
-
- private void synchronizeManually(List<IResource> local, IRemoteFile remote, ISynchronizeFilter filter, Calendar lastSyncDate) {
- switcher.openSynchronizePerspective(local);
- }
-
- private void initialSynchronizeManually(List<IResource> local, IRemoteFile remote, ISynchronizeFilter filter, Calendar lastSyncDate) {
- switcher.openSynchronizePerspective(local);
- }
-
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/SynchronizePerspectiveSelector.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/SynchronizePerspectiveSelector.java
deleted file mode 100644
index 57263f639..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/SynchronizePerspectiveSelector.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Takuya Miyamoto and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Takuya Miyamoto - initial API and implementation
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.provisional;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.mapping.ResourceMapping;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.rse.internal.synchronize.RSESyncUtils;
-import org.eclipse.rse.internal.synchronize.filesystem.subscriber.FileSystemMergeContext;
-import org.eclipse.rse.internal.synchronize.filesystem.subscriber.FileSystemSubscriber;
-import org.eclipse.rse.internal.synchronize.filesystem.ui.FileSystemOperation;
-import org.eclipse.rse.internal.synchronize.filesystem.ui.FileSystemSynchronizeParticipant;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.subscribers.SubscriberScopeManager;
-import org.eclipse.team.ui.TeamUI;
-import org.eclipse.team.ui.synchronize.ISynchronizeParticipant;
-import org.eclipse.ui.IContributorResourceAdapter;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.ide.IContributorResourceAdapter2;
-
-public class SynchronizePerspectiveSelector implements ISynchronizePerspectiveSelector {
- private IWorkbenchPart targetPart;
-
- /**
- * Open Synchronize Perspective
- */
- // <Copied copied from
- // org.eclipse.team.examples.filesystem.ui.SynchronizeAction>
- public void openSynchronizePerspective(List<IResource> synchronizeElement) {
- // Get resource mapping which is prepared the previous step.
- ResourceMapping[] mappings = getSelectedResourceMappings(RSESyncUtils.PROVIDER_ID, synchronizeElement);
- if (mappings.length == 0) {
- return;
- }
- SubscriberScopeManager manager = FileSystemOperation.createScopeManager(FileSystemSubscriber.getInstance().getName(), mappings);
- FileSystemMergeContext context = new FileSystemMergeContext(manager);
- FileSystemSynchronizeParticipant participant = new FileSystemSynchronizeParticipant(context);
- TeamUI.getSynchronizeManager().addSynchronizeParticipants(new ISynchronizeParticipant[] { participant });
- participant.run(getTargetPart());
- }
-
- // </Copied copied from
- // org.eclipse.team.examples.filesystem.ui.SynchronizeAction>
-
- // <Copied copied from org.eclipse.team.internal.ui.actions.TeamAction>
- /**
- * Return the selected resource mappins that contain resources in projects
- * that are associated with a repository of the given id.
- *
- * @param providerId
- * the repository provider id
- * @return the resource mappings that contain resources associated with the
- * given provider
- */
- protected ResourceMapping[] getSelectedResourceMappings(String providerId, List synchronizeResources) {
- Object[] elements = synchronizeResources.toArray();
- ArrayList providerMappings = new ArrayList();
- for (int i = 0; i < elements.length; i++) {
- Object object = elements[i];
- Object adapted = getResourceMapping(object);
- if (adapted instanceof ResourceMapping) {
- ResourceMapping mapping = (ResourceMapping) adapted;
- if (providerId == null || isMappedToProvider(mapping, providerId)) {
- providerMappings.add(mapping);
- }
- }
- }
- return (ResourceMapping[]) providerMappings.toArray(new ResourceMapping[providerMappings.size()]);
- }
-
- // </Copied copied from org.eclipse.team.internal.ui.actions.TeamAction>
-
- /**
- * return if the element is mapped to providerId in the RepositoryProvider
- *
- * @param element
- * @param providerId
- * @return
- */
- // <Copied copied from org.eclipse.team.internal.ui.actions.TeamAction>
- private boolean isMappedToProvider(ResourceMapping element, String providerId) {
- IProject[] projects = element.getProjects();
- for (int k = 0; k < projects.length; k++) {
- IProject project = projects[k];
- RepositoryProvider provider = RepositoryProvider.getProvider(project);
- if (provider != null && provider.getID().equals(providerId)) {
- return true;
- }
- }
- return false;
- }
-
- // </Copied copied from org.eclipse.team.internal.ui.actions.TeamAction>
-
- /**
- *
- * @param object
- * @return
- */
- // <Copied copied from org.eclipse.team.internal.ui.actions.TeamAction>
- private Object getResourceMapping(Object object) {
- // if object is already ResourceMapping
- if (object instanceof ResourceMapping) {
- return object;
- }
-
- // <Copied copied from org.eclipse.team.internal.ui.Utils>
- if (object instanceof IAdaptable) {
- IAdaptable adaptable = (IAdaptable) object;
- Object adapted = adaptable.getAdapter(ResourceMapping.class);
- if (adapted instanceof ResourceMapping) {
- return adapted;
- }
- adapted = adaptable.getAdapter(IContributorResourceAdapter.class);
- if (adapted instanceof IContributorResourceAdapter2) {
- IContributorResourceAdapter2 cra = (IContributorResourceAdapter2) adapted;
- return cra.getAdaptedResourceMapping(adaptable);
- }
- } else {
- Object adapted = Platform.getAdapterManager().getAdapter(object, ResourceMapping.class);
- if (adapted instanceof ResourceMapping) {
- return adapted;
- }
- }
- return null;
- // </Copied copied from org.eclipse.team.internal.ui.Utils>
- }
-
- // </Copied copied from org.eclipse.team.internal.ui.actions.TeamAction>
-
- /**
- *
- * @return
- */
- // <Copied copied from org.eclipse.team.internal.ui.actions.TeamAction>
- protected IWorkbenchPart getTargetPart() {
- if (targetPart == null) {
- IWorkbenchPage page = RSESyncUtils.getActivePage();
- if (page != null) {
- targetPart = page.getActivePart();
- }
- }
- return targetPart;
-
- }
- // </Copied copied from org.eclipse.team.internal.ui.actions.TeamAction>
-}
diff --git a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/Synchronizer.java b/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/Synchronizer.java
deleted file mode 100644
index 7be9974e9..000000000
--- a/rse/plugins/org.eclipse.rse.importexport/src/org/eclipse/rse/internal/synchronize/provisional/Synchronizer.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 Takuya Miyamoto and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Takuya Miyamoto - initial API and implementation
- * David McKnight (IBM) - [272708] [import/export] fix various bugs with the synchronization support
- *******************************************************************************/
-package org.eclipse.rse.internal.synchronize.provisional;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.rse.internal.importexport.RemoteImportExportPlugin;
-import org.eclipse.rse.internal.importexport.SystemImportExportResources;
-import org.eclipse.rse.internal.importexport.files.UniFilePlus;
-import org.eclipse.rse.internal.synchronize.ISynchronizeData;
-import org.eclipse.rse.internal.synchronize.filesystem.FileSystemProvider;
-import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
-import org.eclipse.rse.services.clientserver.messages.SystemMessage;
-import org.eclipse.rse.ui.SystemBasePlugin;
-import org.eclipse.rse.ui.messages.SystemMessageDialog;
-import org.eclipse.team.core.RepositoryProvider;
-import org.eclipse.team.core.TeamException;
-
-public class Synchronizer implements ISynchronizer {
- private ISynchronizeData data;
- private ISynchronizeConnectionManager connector;
-
- /**
- * TODO in the future, remoteRoot is probably needed for import or export
- */
- private UniFilePlus remoteRoot;
-
- public Synchronizer(ISynchronizeData data) {
- this.data = data;
- this.connector = new SynchronizeConnectionManager();
- }
-
- public boolean run(ISynchronizeOperation operation) {
- IProject[] projects = null;
- List<IResource> elements = data.getElements();
- Set<IProject> projectSet = new HashSet<IProject>();
-
- for (IResource resource : elements) {
- projectSet.add(resource.getProject());
- if (!resource.exists()){
- IContainer parent = resource.getParent();
- if (!parent.exists()){
- createEmptyFolders(parent);
- }
- }
- }
-
- // get resources to synchronize in the type of Array.
- projects = projectSet.toArray(new IProject[projectSet.size()]);
-
- try {
- // if user request new synchronization, previous mapping are
- // removed.
- if (data.getSynchronizeType() == ISynchronizeOperation.SYNC_MODE_OVERRIDE_DEST ||
- data.getSynchronizeType() == ISynchronizeOperation.SYNC_MODE_OVERRIDE_SOURCE ||
- data.getSynchronizeType() == ISynchronizeOperation.SYNC_MODE_UI_REVIEW_INITIAL) {
- for (int i = 0; i < projects.length; i++) {
-
- IProject project = projects[i];
- // user should be prompted before disconnect or he/she will lose team synch info
- if (connector.isConnected(project)){
-
- RepositoryProvider provider = RepositoryProvider.getProvider(project);
- if (!(provider instanceof FileSystemProvider)){
- String msg = NLS.bind(SystemImportExportResources.RESID_SYNCHRONIZE_DISCONNECT_WARNING, project.getName());
- SystemMessage msgObj = new SimpleSystemMessage(RemoteImportExportPlugin.PLUGIN_ID, IStatus.WARNING, msg);
-
- SystemMessageDialog dlg = new SystemMessageDialog(SystemBasePlugin.getActiveWorkbenchShell(), msgObj);
- if (!dlg.openQuestionNoException(true)){
- return false;
- }
- }
-
- connector.disconnect(project);
- }
- }
-
- }
-
- // create new connection for each project
- for (int i = 0; i < projects.length; i++) {
- IProject project = projects[i];
- connector.connect(project);
- FileSystemProvider provider = (FileSystemProvider) RepositoryProvider.getProvider(project);
- provider.reset();
- String remoteLocation = data.getRemoteLocation();
- IPath localLocation = data.getLocalLocation();
- provider.setRemoteLocation(remoteLocation);
- provider.setLocalLocation(localLocation);
- this.remoteRoot = provider.getRemoteRootFolder();
- }
-
-
-
- // run actual synchronize operation.
- // TODO currently, not support last synchronization date.
- operation.synchronize(data.getElements(), remoteRoot.remoteFile, null, null, data.getSynchronizeType());
- } catch (TeamException e1) {
- e1.printStackTrace();
- } catch (CoreException e) {
- e.printStackTrace();
- }
-
- return true;
- }
-
- private void createEmptyFolders(IContainer container){
- List emptyParent = new ArrayList();
- boolean go = true;
-
- IContainer empty = container;
-
- //check to see which parent folders need to be created
- while(go) {
- if(!empty.exists() && empty instanceof IFolder){
- emptyParent.add(empty);
- }
- else {
- go=false;
- }
- empty = empty.getParent();
- }
-
- IFolder emptyFolder = null;
-
- // create empty parent folders
- for(int j=emptyParent.size()-1;j>=0;j--){
- emptyFolder = (IFolder) emptyParent.get(j);
- if(!emptyFolder.exists()){
- try {
- emptyFolder.create(true, true, new NullProgressMonitor());
- }
- catch (CoreException e){}
- }
- }
- }
-}

Back to the top