mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 15:15:25 +02:00
[245260] Different user's connections on a single host are mapped to the same temp files cache
This commit is contained in:
parent
39d696a0d9
commit
2b355dead2
3 changed files with 112 additions and 40 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006, 2008 IBM Corporation and others.
|
||||
* Copyright (c) 2006, 20089 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
|
||||
|
@ -16,6 +16,7 @@
|
|||
* David McKnight (IBM) - [205820] create the temp files project (if not there) when files.ui is loaded
|
||||
* 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
|
||||
* Martin Oberhuber (Wind River) - [228353] Asynchronously initialize the remote edit project
|
||||
* 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;
|
||||
|
@ -27,14 +28,15 @@ import org.eclipse.core.runtime.IProgressMonitor;
|
|||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.core.runtime.preferences.DefaultScope;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.rse.files.ui.resources.SystemUniversalTempFileListener;
|
||||
import org.eclipse.rse.internal.files.ui.propertypages.SystemCachePreferencePage;
|
||||
import org.eclipse.rse.internal.files.ui.propertypages.UniversalPreferencePage;
|
||||
import org.eclipse.rse.internal.files.ui.resources.SystemRemoteEditManager;
|
||||
import org.eclipse.rse.internal.subsystems.files.core.ISystemFilePreferencesConstants;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.ui.plugin.AbstractUIPlugin;
|
||||
import org.eclipse.ui.preferences.ScopedPreferenceStore;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
|
||||
|
@ -116,9 +118,54 @@ public class Activator extends AbstractUIPlugin
|
|||
{
|
||||
//FIXME This should really be migrated into a Preferences Initializer Extension
|
||||
//in order to avoid unnecessary plugin activation
|
||||
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
SystemCachePreferencePage.initDefaults(store);
|
||||
UniversalPreferencePage.initDefaults(store);
|
||||
//IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
|
||||
|
||||
// as per bug 245260, using scoped store for preference initialization
|
||||
IPreferenceStore store = new ScopedPreferenceStore(new DefaultScope(), RSEUIPlugin.getDefault().getBundle().getSymbolicName());
|
||||
|
||||
// system cache preferences
|
||||
if (store.isDefault(ISystemFilePreferencesConstants.LIMIT_CACHE)){
|
||||
store.setDefault(ISystemFilePreferencesConstants.LIMIT_CACHE, ISystemFilePreferencesConstants.DEFAULT_LIMIT_CACHE);
|
||||
}
|
||||
|
||||
if (store.isDefault(ISystemFilePreferencesConstants.MAX_CACHE_SIZE)){
|
||||
store.setDefault(ISystemFilePreferencesConstants.MAX_CACHE_SIZE, ISystemFilePreferencesConstants.DEFAULT_MAX_CACHE_SIZE);
|
||||
}
|
||||
|
||||
|
||||
// universal preferences
|
||||
if (store.isDefault(ISystemFilePreferencesConstants.FILETRANSFERMODEDEFAULT)){
|
||||
store.setDefault(ISystemFilePreferencesConstants.FILETRANSFERMODEDEFAULT, ISystemFilePreferencesConstants.DEFAULT_FILETRANSFERMODE);
|
||||
}
|
||||
|
||||
if (store.isDefault(ISystemFilePreferencesConstants.SHOWHIDDEN)){
|
||||
store.setDefault(ISystemFilePreferencesConstants.SHOWHIDDEN, false);
|
||||
}
|
||||
|
||||
if (store.isDefault(ISystemFilePreferencesConstants.PRESERVETIMESTAMPS)){
|
||||
store.setDefault(ISystemFilePreferencesConstants.PRESERVETIMESTAMPS, ISystemFilePreferencesConstants.DEFAULT_PRESERVETIMESTAMPS);
|
||||
}
|
||||
|
||||
if (store.isDefault(ISystemFilePreferencesConstants.SHARECACHEDFILES)){
|
||||
store.setDefault(ISystemFilePreferencesConstants.SHARECACHEDFILES, ISystemFilePreferencesConstants.DEFAULT_SHARECACHEDFILES);
|
||||
}
|
||||
|
||||
if (store.isDefault(ISystemFilePreferencesConstants.DOSUPERTRANSFER)){
|
||||
store.setDefault(ISystemFilePreferencesConstants.DOSUPERTRANSFER, ISystemFilePreferencesConstants.DEFAULT_DOSUPERTRANSFER);
|
||||
}
|
||||
|
||||
if (store.isDefault(ISystemFilePreferencesConstants.SUPERTRANSFER_ARC_TYPE)){
|
||||
store.setDefault(ISystemFilePreferencesConstants.SUPERTRANSFER_ARC_TYPE, ISystemFilePreferencesConstants.DEFAULT_SUPERTRANSFER_ARCHIVE_TYPE);
|
||||
}
|
||||
|
||||
if (store.isDefault(ISystemFilePreferencesConstants.DOWNLOAD_BUFFER_SIZE)){
|
||||
store.setDefault(ISystemFilePreferencesConstants.DOWNLOAD_BUFFER_SIZE, ISystemFilePreferencesConstants.DEFAULT_DOWNLOAD_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
if (store.isDefault(ISystemFilePreferencesConstants.UPLOAD_BUFFER_SIZE)){
|
||||
store.setDefault(ISystemFilePreferencesConstants.UPLOAD_BUFFER_SIZE, ISystemFilePreferencesConstants.DEFAULT_DOWNLOAD_BUFFER_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/********************************************************************************
|
||||
* Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
|
||||
* 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
|
||||
|
@ -19,6 +19,7 @@
|
|||
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
|
||||
* David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
|
||||
* David McKnight (IBM) - [239459] Clear Cached Files action should not delete project metadata
|
||||
* 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;
|
||||
|
@ -246,11 +247,11 @@ public class SystemCachePreferencePage extends PreferencePage implements IWorkbe
|
|||
* Set default preferences for the communications preference page.
|
||||
*
|
||||
* @param store PreferenceStore used for this preference page.
|
||||
* @deprecated moved to Activator
|
||||
*/
|
||||
public static void initDefaults(IPreferenceStore store)
|
||||
{
|
||||
store.setDefault(ISystemFilePreferencesConstants.LIMIT_CACHE, ISystemFilePreferencesConstants.DEFAULT_LIMIT_CACHE);
|
||||
store.setDefault(ISystemFilePreferencesConstants.MAX_CACHE_SIZE, ISystemFilePreferencesConstants.DEFAULT_MAX_CACHE_SIZE);
|
||||
// no longer needed here - moved to Activator
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,6 +29,8 @@ import java.util.ArrayList;
|
|||
import java.util.Iterator;
|
||||
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.preferences.DefaultScope;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.preference.BooleanFieldEditor;
|
||||
|
@ -288,7 +290,6 @@ public class UniversalPreferencePage
|
|||
|
||||
addField(showHiddenEditor);
|
||||
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
|
||||
// field to indicate whether or not to preserve timestamps during copy
|
||||
BooleanFieldEditor preserveTimestamps = new BooleanFieldEditor(
|
||||
|
@ -297,9 +298,7 @@ public class UniversalPreferencePage
|
|||
propertiesComposite);
|
||||
|
||||
addField(preserveTimestamps);
|
||||
|
||||
|
||||
store.setDefault(ISystemFilePreferencesConstants.PRESERVETIMESTAMPS, true);
|
||||
|
||||
|
||||
// field to indicate whether or not to share cached files between different connections
|
||||
// to the same remote host
|
||||
|
@ -310,8 +309,6 @@ public class UniversalPreferencePage
|
|||
|
||||
addField(shareCachedFiles);
|
||||
|
||||
store.setDefault(ISystemFilePreferencesConstants.SHARECACHEDFILES, ISystemFilePreferencesConstants.DEFAULT_SHARECACHEDFILES);
|
||||
|
||||
// download and upload buffer size
|
||||
Group transferGroup = new Group(parent, SWT.NULL);
|
||||
transferGroup.setText(FileResources.RESID_FILES_PREFERENCES_BUFFER);
|
||||
|
@ -388,13 +385,7 @@ public class UniversalPreferencePage
|
|||
boolean doSuperTransfer = getDoSuperTransfer();
|
||||
doSuperTransferButton.setSelection(doSuperTransfer);
|
||||
|
||||
String initialArchiveType = store.getString(ISystemFilePreferencesConstants.SUPERTRANSFER_ARC_TYPE);
|
||||
if (initialArchiveType == null ||
|
||||
!ArchiveHandlerManager.getInstance().isRegisteredArchive("test." + initialArchiveType)) //$NON-NLS-1$
|
||||
{
|
||||
initialArchiveType = ISystemFilePreferencesConstants.DEFAULT_SUPERTRANSFER_ARCHIVE_TYPE;
|
||||
}
|
||||
archiveTypeCombo.setText(initialArchiveType);
|
||||
|
||||
archiveTypeCombo.setTextLimit(6);
|
||||
archiveTypeCombo.addModifyListener(new ModifyListener() {
|
||||
|
||||
|
@ -426,15 +417,13 @@ public class UniversalPreferencePage
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @deprecated moved to Activator
|
||||
*/
|
||||
public static void initDefaults(IPreferenceStore store)
|
||||
{
|
||||
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);
|
||||
store.setDefault(ISystemFilePreferencesConstants.UPLOAD_BUFFER_SIZE, ISystemFilePreferencesConstants.DEFAULT_DOWNLOAD_BUFFER_SIZE);
|
||||
// no longer needed here - moved to Activator
|
||||
}
|
||||
|
||||
|
||||
|
@ -499,12 +488,22 @@ public class UniversalPreferencePage
|
|||
tableViewer.setColumnProperties(columnProperties);
|
||||
tableViewer.setCellEditors(editors);
|
||||
|
||||
ISystemFileTransferModeMapping[] mappings = getModeMappings();
|
||||
|
||||
|
||||
initControls();
|
||||
|
||||
}
|
||||
|
||||
private void initControls()
|
||||
{
|
||||
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
|
||||
// init mode mappings for resource type table control
|
||||
ISystemFileTransferModeMapping[] mappings = getModeMappings();
|
||||
for (int i = 0; i < mappings.length; i++) {
|
||||
newResourceTableItem(mappings[i], i, false);
|
||||
}
|
||||
}
|
||||
|
||||
// init default file transfer controls
|
||||
int defaultFileTransferMode = getFileTransferModeDefaultPreference();
|
||||
if (defaultFileTransferMode == ISystemFilePreferencesConstants.FILETRANSFERMODE_BINARY)
|
||||
{
|
||||
|
@ -513,7 +512,22 @@ public class UniversalPreferencePage
|
|||
else if (defaultFileTransferMode == ISystemFilePreferencesConstants.FILETRANSFERMODE_TEXT)
|
||||
{
|
||||
defaultTextButton.setSelection(true);
|
||||
}
|
||||
}
|
||||
|
||||
// init super transfer controls
|
||||
String superTransferArcType = store.getString(ISystemFilePreferencesConstants.SUPERTRANSFER_ARC_TYPE);
|
||||
archiveTypeCombo.setText(superTransferArcType);
|
||||
|
||||
boolean doSuperTransfer = store.getBoolean(ISystemFilePreferencesConstants.DOSUPERTRANSFER);
|
||||
doSuperTransferButton.setSelection(doSuperTransfer);
|
||||
|
||||
// buffer sizes
|
||||
int downloadSize = store.getInt(ISystemFilePreferencesConstants.DOWNLOAD_BUFFER_SIZE);
|
||||
downloadBufferSize.setText(downloadSize + ""); //$NON-NLS-1$
|
||||
|
||||
int uploadSize = store.getInt(ISystemFilePreferencesConstants.UPLOAD_BUFFER_SIZE);
|
||||
uploadBufferSize.setText(uploadSize + ""); //$NON-NLS-1$
|
||||
|
||||
}
|
||||
|
||||
protected ISystemFileTransferModeMapping[] getModeMappings()
|
||||
|
@ -547,7 +561,10 @@ public class UniversalPreferencePage
|
|||
}
|
||||
resourceTypeTable.setRedraw(true);
|
||||
|
||||
int defaultFileTransferMode = ISystemFilePreferencesConstants.DEFAULT_FILETRANSFERMODE;
|
||||
IEclipsePreferences prefs = new DefaultScope().getNode(RSEUIPlugin.getDefault().getBundle().getSymbolicName());
|
||||
|
||||
int defaultFileTransferMode = prefs.getInt(ISystemFilePreferencesConstants.FILETRANSFERMODEDEFAULT, ISystemFilePreferencesConstants.DEFAULT_FILETRANSFERMODE);
|
||||
|
||||
defaultBinaryButton.setSelection(defaultFileTransferMode == ISystemFilePreferencesConstants.FILETRANSFERMODE_BINARY);
|
||||
defaultTextButton.setSelection(defaultFileTransferMode == ISystemFilePreferencesConstants.FILETRANSFERMODE_TEXT);
|
||||
|
||||
|
@ -564,16 +581,23 @@ public class UniversalPreferencePage
|
|||
|
||||
protected void resetSuperTransferPrefs()
|
||||
{
|
||||
archiveTypeCombo.setText(ISystemFilePreferencesConstants.DEFAULT_SUPERTRANSFER_ARCHIVE_TYPE);
|
||||
setSuperTransferTypePreference(ISystemFilePreferencesConstants.DEFAULT_SUPERTRANSFER_ARCHIVE_TYPE);
|
||||
doSuperTransferButton.setSelection(ISystemFilePreferencesConstants.DEFAULT_DOSUPERTRANSFER);
|
||||
setDoSuperTransfer(ISystemFilePreferencesConstants.DEFAULT_DOSUPERTRANSFER);
|
||||
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
String superTransferArcType = store.getDefaultString(ISystemFilePreferencesConstants.SUPERTRANSFER_ARC_TYPE);
|
||||
archiveTypeCombo.setText(superTransferArcType);
|
||||
|
||||
boolean doSuperTransfer = store.getDefaultBoolean(ISystemFilePreferencesConstants.DOSUPERTRANSFER);
|
||||
doSuperTransferButton.setSelection(doSuperTransfer);
|
||||
}
|
||||
|
||||
protected void resetBufferSizePrefs()
|
||||
{
|
||||
downloadBufferSize.setText(ISystemFilePreferencesConstants.DEFAULT_DOWNLOAD_BUFFER_SIZE + ""); //$NON-NLS-1$
|
||||
uploadBufferSize.setText(ISystemFilePreferencesConstants.DEFAULT_DOWNLOAD_BUFFER_SIZE + ""); //$NON-NLS-1$
|
||||
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
|
||||
int downloadSize = store.getDefaultInt(ISystemFilePreferencesConstants.DOWNLOAD_BUFFER_SIZE);
|
||||
downloadBufferSize.setText(downloadSize + ""); //$NON-NLS-1$
|
||||
|
||||
int uploadSize = store.getDefaultInt(ISystemFilePreferencesConstants.UPLOAD_BUFFER_SIZE);
|
||||
uploadBufferSize.setText(uploadSize + ""); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue