diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/FileResources.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/FileResources.java index 22999637307..dbc26cb97c3 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/FileResources.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/FileResources.java @@ -22,6 +22,7 @@ * David McKnight (IBM) - [224377] "open with" menu does not have "other" option * Rupen Mardirossian (IBM) - [227213] Added RESID_CONFLICT_COPY_PATTERN to be used for copying resources to parent folder. * David Dykstal (IBM) [231841] Correcting messages for folder creation + * David McKnight (IBM) - [245260] Different user's connections on a single host are mapped to the same temp files cache *******************************************************************************/ package org.eclipse.rse.internal.files.ui; @@ -82,6 +83,8 @@ public class FileResources extends NLS public static String RESID_PREF_UNIVERSAL_SHOWHIDDEN_LABEL; public static String RESID_PREF_UNIVERSAL_PRESERVE_TIMESTAMPS_LABEL; + + public static String RESID_PREF_UNIVERSAL_SHARE_CACHED_FILES_LABEL; public static String RESID_PREF_UNIVERSAL_FILES_FILETYPES_TYPE_LABEL; public static String RESID_PREF_UNIVERSAL_FILES_FILETYPES_TYPE_TOOLTIP; diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/FileResources.properties b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/FileResources.properties index 20234e19ec9..a6530607c9f 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/FileResources.properties +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/FileResources.properties @@ -24,6 +24,7 @@ # Rupen Mardirossian (IBM) - [227213] Added RESID_CONFLICT_COPY_PATTERN to be used for copying resources to parent folder. # David Dykstal (IBM) [231841] Correcting messages for folder creation # Kevin Doyle (IBM) - [242389] [usability] RSE Save Conflict dialog should indicate which file is in conflict +# David McKnight (IBM) - [245260] Different user's connections on a single host are mapped to the same temp files cache ############################################################################### # NLS_MESSAGEFORMAT_VAR @@ -80,6 +81,8 @@ RESID_PREF_UNIVERSAL_SHOWHIDDEN_LABEL=Show hidden files RESID_PREF_UNIVERSAL_PRESERVE_TIMESTAMPS_LABEL=Copy timestamps during file transfer +RESID_PREF_UNIVERSAL_SHARE_CACHED_FILES_LABEL=Share cached files between different connections to the same host + RESID_PREF_UNIVERSAL_FILES_FILETYPES_TYPE_LABEL=File types: RESID_PREF_UNIVERSAL_FILES_FILETYPES_TYPE_TOOLTIP=List of file types diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/UniversalPreferencePage.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/UniversalPreferencePage.java index 70774965b09..b24d8b564c4 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/UniversalPreferencePage.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/UniversalPreferencePage.java @@ -19,6 +19,7 @@ * Martin Oberhuber (Wind River) - [220020][api][breaking] SystemFileTransferModeRegistry should be internal * 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 + * David McKnight (IBM) - [245260] Different user's connections on a single host are mapped to the same temp files cache ********************************************************************************/ package org.eclipse.rse.internal.files.ui.propertypages; @@ -299,6 +300,16 @@ public class UniversalPreferencePage store.setDefault(ISystemFilePreferencesConstants.PRESERVETIMESTAMPS, true); + // field to indicate whether or not to share cached files between different connections + // to the same remote host + BooleanFieldEditor shareCachedFiles = new BooleanFieldEditor ( + ISystemFilePreferencesConstants.SHARECACHEDFILES, + FileResources.RESID_PREF_UNIVERSAL_SHARE_CACHED_FILES_LABEL, + propertiesComposite); + + addField(shareCachedFiles); + + store.setDefault(ISystemFilePreferencesConstants.SHARECACHEDFILES, ISystemFilePreferencesConstants.DEFAULT_SHARECACHEDFILES); // download and upload buffer size Group transferGroup = new Group(parent, SWT.NULL); @@ -418,6 +429,7 @@ public class UniversalPreferencePage { store.setDefault(ISystemFilePreferencesConstants.SHOWHIDDEN, false); store.setDefault(ISystemFilePreferencesConstants.PRESERVETIMESTAMPS, ISystemFilePreferencesConstants.DEFAULT_PRESERVETIMESTAMPS); + store.setDefault(ISystemFilePreferencesConstants.SHARECACHEDFILES, ISystemFilePreferencesConstants.DEFAULT_SHARECACHEDFILES); store.setDefault(ISystemFilePreferencesConstants.DOSUPERTRANSFER, ISystemFilePreferencesConstants.DEFAULT_DOSUPERTRANSFER); store.setDefault(ISystemFilePreferencesConstants.SUPERTRANSFER_ARC_TYPE, ISystemFilePreferencesConstants.DEFAULT_SUPERTRANSFER_ARCHIVE_TYPE); store.setDefault(ISystemFilePreferencesConstants.DOWNLOAD_BUFFER_SIZE, ISystemFilePreferencesConstants.DEFAULT_DOWNLOAD_BUFFER_SIZE); diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/DefaultMountPathMapper.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/DefaultMountPathMapper.java index 77e14ee92e8..96967f35c11 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/DefaultMountPathMapper.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/DefaultMountPathMapper.java @@ -14,12 +14,18 @@ * Contributors: * {Name} (company) - description of contribution. * David McKnight (IBM) - [195285] mount path mapper changes + * David McKnight (IBM) - [245260] Different user's connections on a single host are mapped to the same temp files cache *******************************************************************************/ package org.eclipse.rse.internal.files.ui.resources; +import java.io.File; + +import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.rse.files.ui.resources.ISystemMountPathMapper; +import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants; import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; +import org.eclipse.rse.ui.RSEUIPlugin; public class DefaultMountPathMapper implements ISystemMountPathMapper { @@ -36,7 +42,19 @@ public class DefaultMountPathMapper implements ISystemMountPathMapper public String getWorkspaceMappingFor(String hostname, String remotePath, IRemoteFileSubSystem subSystem) { - return remotePath; + IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore(); + boolean shareCachedFiles = store.getBoolean(ISystemFilePreferencesConstants.SHARECACHEDFILES); + + // if we're not sharing cached files, then we need a unique path for each connection + if (!shareCachedFiles){ + // prefix with the connection alias + String alias = subSystem.getHostAliasName(); + String configID = subSystem.getConfigurationId(); + return alias + '.' + configID + File.separatorChar + remotePath; + } + else { + return remotePath; + } } /** diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteEditManager.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteEditManager.java index edd043fd964..006271f6be8 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteEditManager.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/resources/SystemRemoteEditManager.java @@ -18,6 +18,7 @@ * David McKnight (IBM) - [195285] mount path mapper changes * David McKnight (IBM) - [228343] RSE unable to recover after RemoteSystemsTempfiles deletion * David McKnight (IBM) - [253262] Cache Cleanup is removing .settings directory + * David McKnight (IBM) - [245260] Different user's connections on a single host are mapped to the same temp files cache *******************************************************************************/ package org.eclipse.rse.internal.files.ui.resources; @@ -151,6 +152,7 @@ public class SystemRemoteEditManager public String getWorkspacePathFor(String hostname, String remotePath, IRemoteFileSubSystem subsystem) { ISystemMountPathMapper mapper = getMountPathMapperFor(hostname, remotePath, subsystem); + if (mapper != null) { return mapper.getWorkspaceMappingFor(hostname, remotePath, subsystem); @@ -189,6 +191,12 @@ public class SystemRemoteEditManager } } } + + // no result - fall back to the default + if (result == null){ + return new DefaultMountPathMapper(); + } + return result; } diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/ISystemFilePreferencesConstants.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/ISystemFilePreferencesConstants.java index cf57d844868..de6c777b0aa 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/ISystemFilePreferencesConstants.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/internal/subsystems/files/core/ISystemFilePreferencesConstants.java @@ -16,6 +16,7 @@ * David McKnight (IBM) - [191367] setting supertransfer to be disabled by default * Xuan Chen (IBM) - [191367] setting supertransfer back to enabled by default * Xuan Chen (IBM) - [202686] Supertransfer should be disabled by default for 2.0.1 + * David McKnight (IBM) - [245260] Different user's connections on a single host are mapped to the same temp files cache *******************************************************************************/ package org.eclipse.rse.internal.subsystems.files.core; @@ -31,6 +32,8 @@ public interface ISystemFilePreferencesConstants public static final String PRESERVETIMESTAMPS = ROOT + "preservetimestamps"; //$NON-NLS-1$ + public static final String SHARECACHEDFILES = ROOT + "sharecachedfiles";//$NON-NLS-1$ + public static final String LIMIT_CACHE = ROOT + "limit.cache"; //$NON-NLS-1$ public static final String MAX_CACHE_SIZE = ROOT + "max.cache.size"; //$NON-NLS-1$ @@ -42,6 +45,7 @@ public interface ISystemFilePreferencesConstants public static final boolean DEFAULT_SHOW_HIDDEN = true; public static final boolean DEFAULT_PRESERVETIMESTAMPS = true; + public static final boolean DEFAULT_SHARECACHEDFILES = true; public static final int DEFAULT_FILETRANSFERMODE = 0; public static final int FILETRANSFERMODE_BINARY = 0;