mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 04:25:21 +02:00
[168870][api][refactor]Moved the following to core from ui
PasswordPersistenceManager SystemResourceConstants Made the following utility class in Core from methods found on RSEUIPlugin RSEHostUtil Moving PasswordPersistenceManager required that preferences that were in the UI plugin are moved to Core. SystemPreferencesManager was rewritten to manage both Core and UI plugin preferences.
This commit is contained in:
parent
44edbbb502
commit
993822a985
37 changed files with 1112 additions and 1178 deletions
|
@ -13,6 +13,22 @@ package org.eclipse.rse.core;
|
|||
* These constants define the set of preference names that the RSE core uses.
|
||||
*/
|
||||
public interface IRSEPreferenceNames {
|
||||
public static final String ST_DEFAULT_USERID = "systemType.defaultUserId"; //$NON-NLS-1$
|
||||
/*
|
||||
* core preference keys
|
||||
*/
|
||||
public static final String ST_ENABLED = "systemType.enabled"; //$NON-NLS-1$
|
||||
public static final String ST_DEFAULT_USERID = "systemType.defaultUserId"; //$NON-NLS-1$
|
||||
public static final String SYSTEMTYPE = "systemtype"; //$NON-NLS-1$
|
||||
public static final String USERIDPERKEY = "useridperkey"; //$NON-NLS-1$
|
||||
public static final String USERIDKEYS = "userid.keys"; //$NON-NLS-1$
|
||||
public static final String ACTIVEUSERPROFILES = "activeuserprofiles"; //$NON-NLS-1$
|
||||
public static final String USE_DEFERRED_QUERIES = "useDeferredQueries"; //$NON-NLS-1$
|
||||
/*
|
||||
* core preference default values
|
||||
*/
|
||||
public static final String DEFAULT_SYSTEMTYPE = ""; //$NON-NLS-1$
|
||||
public static final String DEFAULT_USERID = ""; //$NON-NLS-1$
|
||||
public static final boolean DEFAULT_USE_DEFERRED_QUERIES = true;
|
||||
public static final String DEFAULT_TEAMPROFILE = "Team"; //$NON-NLS-1$
|
||||
public static final String DEFAULT_ACTIVEUSERPROFILES = "Team"; //$NON-NLS-1$
|
||||
}
|
||||
|
|
|
@ -24,12 +24,11 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.core.resources.ResourcesPlugin;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.core.runtime.Preferences;
|
||||
import org.eclipse.rse.core.model.SystemSignonInformation;
|
||||
import org.eclipse.rse.ui.ISystemPreferencesConstants;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -323,7 +322,7 @@ public class PasswordPersistenceManager {
|
|||
// if no passwords found with new URL, check old URL
|
||||
if (passwords == null) {
|
||||
|
||||
URL oldServerURL1 = new URL(SERVER_URL + SystemBasePlugin.getWorkspace().getRoot().getLocation().toOSString());
|
||||
URL oldServerURL1 = new URL(SERVER_URL + ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString());
|
||||
passwords = Platform.getAuthorizationInfo(oldServerURL1, systemType, AUTH_SCHEME);
|
||||
|
||||
// passwords found, so migrate to using new URL
|
||||
|
@ -343,7 +342,7 @@ public class PasswordPersistenceManager {
|
|||
}
|
||||
}
|
||||
catch (MalformedURLException e) {
|
||||
SystemBasePlugin.logError("PasswordPersistenceManager.getPasswordMap", e); //$NON-NLS-1$
|
||||
RSECorePlugin.getDefault().getLogger().logError("PasswordPersistenceManager.getPasswordMap", e); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
return passwords;
|
||||
|
@ -361,10 +360,10 @@ public class PasswordPersistenceManager {
|
|||
Platform.addAuthorizationInfo(serverURL, systemType, AUTH_SCHEME, passwords);
|
||||
}
|
||||
catch (MalformedURLException e) {
|
||||
SystemBasePlugin.logError("PasswordPersistenceManager.savePasswordMap", e); //$NON-NLS-1$
|
||||
RSECorePlugin.getDefault().getLogger().logError("PasswordPersistenceManager.savePasswordMap", e); //$NON-NLS-1$
|
||||
}
|
||||
catch (CoreException e) {
|
||||
SystemBasePlugin.logError("PasswordPersistenceManager.savePasswordMap", e); //$NON-NLS-1$
|
||||
RSECorePlugin.getDefault().getLogger().logError("PasswordPersistenceManager.savePasswordMap", e); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -411,8 +410,8 @@ public class PasswordPersistenceManager {
|
|||
// uid matches, check if hosts are the same
|
||||
if (khostname.startsWith(phostname) || phostname.startsWith(khostname))
|
||||
{
|
||||
String qkhost = RSEUIPlugin.getQualifiedHostName(khostname);
|
||||
String qphost = RSEUIPlugin.getQualifiedHostName(phostname);
|
||||
String qkhost = RSEHostUtil.getQualifiedHostName(khostname);
|
||||
String qphost = RSEHostUtil.getQualifiedHostName(phostname);
|
||||
if (qkhost.equals(qphost))
|
||||
{
|
||||
password = (String)passwords.get(key);
|
||||
|
@ -461,8 +460,8 @@ public class PasswordPersistenceManager {
|
|||
// uid matches, check if hosts are the same
|
||||
if (khostname.startsWith(phostname) || phostname.startsWith(khostname))
|
||||
{
|
||||
String qkhost = RSEUIPlugin.getQualifiedHostName(khostname);
|
||||
String qphost = RSEUIPlugin.getQualifiedHostName(phostname);
|
||||
String qkhost = RSEHostUtil.getQualifiedHostName(khostname);
|
||||
String qphost = RSEHostUtil.getQualifiedHostName(phostname);
|
||||
if (qkhost.equals(qphost))
|
||||
{
|
||||
password = (String)passwords.get(key);
|
||||
|
@ -546,8 +545,8 @@ public class PasswordPersistenceManager {
|
|||
{
|
||||
if (DEFAULT_SYSTEM_TYPE.equals(systemType))
|
||||
{
|
||||
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
systemType = store.getString(ISystemPreferencesConstants.SYSTEMTYPE);
|
||||
Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
|
||||
systemType = store.getString(IRSEPreferenceNames.SYSTEMTYPE);
|
||||
}
|
||||
|
||||
// First find the correct provider
|
|
@ -0,0 +1,24 @@
|
|||
package org.eclipse.rse.core;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* This class is a collection of utility methods that can be used to
|
||||
* deal with IP addresses and hosts.
|
||||
*
|
||||
* This class should not be subclassed.
|
||||
*/
|
||||
public class RSEHostUtil {
|
||||
/**
|
||||
* Returns a qualified hostname given a potentially unqualified hostname
|
||||
*/
|
||||
public static String getQualifiedHostName(String hostName) {
|
||||
try {
|
||||
InetAddress address = InetAddress.getByName(hostName);
|
||||
return address.getCanonicalHostName();
|
||||
} catch (UnknownHostException exc) {
|
||||
return hostName;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package org.eclipse.rse.core;
|
||||
|
||||
import org.eclipse.rse.ui.ISystemPreferencesConstants;
|
||||
|
||||
/**
|
||||
* Constants related to project and folder names.
|
||||
|
@ -32,5 +31,5 @@ public interface SystemResourceConstants
|
|||
public static final String RESOURCE_USERACTIONS_FOLDER_NAME = "UserActions"; //$NON-NLS-1$
|
||||
public static final String RESOURCE_COMPILECOMMANDS_FOLDER_NAME = "CompileCommands"; //$NON-NLS-1$
|
||||
|
||||
public static final String RESOURCE_TEAMPROFILE_NAME = ISystemPreferencesConstants.DEFAULT_TEAMPROFILE;
|
||||
public static final String RESOURCE_TEAMPROFILE_NAME = IRSEPreferenceNames.DEFAULT_TEAMPROFILE;
|
||||
}
|
|
@ -527,7 +527,7 @@ public class SystemQualifiedRemoteFolderCombo extends Composite
|
|||
*/
|
||||
public static String[] getHistory()
|
||||
{
|
||||
return SystemPreferencesManager.getPreferencesManager().getFolderHistory();
|
||||
return SystemPreferencesManager.getFolderHistory();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -444,7 +444,7 @@ public class SystemRemoteFolderCombo extends Composite implements ISystemCombo
|
|||
*/
|
||||
public static String[] getHistory()
|
||||
{
|
||||
return SystemPreferencesManager.getPreferencesManager().getFolderHistory();
|
||||
return SystemPreferencesManager.getFolderHistory();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1496,7 +1496,7 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe
|
|||
setExpandedState(parentSubSystem, true); // expand the subsystem
|
||||
Object filterParentInTree = parentSubSystem; // will be case unless in show filter pool mode
|
||||
// if showing filter pools, expand parent filter pool reference...
|
||||
if (SystemPreferencesManager.getPreferencesManager().getShowFilterPools()) {
|
||||
if (SystemPreferencesManager.getShowFilterPools()) {
|
||||
ISystemFilterPoolReference poolRef = parentSubSystem.getFilterPoolReferenceManager().getReferenceToSystemFilterPool(filter.getParentFilterPool());
|
||||
setExpandedState(poolRef, true);
|
||||
filterParentInTree = poolRef;
|
||||
|
|
|
@ -23,25 +23,6 @@ public interface ISystemPreferencesConstants {
|
|||
* root
|
||||
*/
|
||||
public static final String ROOT = "org.eclipse.rse.preferences."; //$NON-NLS-1$
|
||||
/*
|
||||
* core preference keys
|
||||
*/
|
||||
public static final String SYSTEMTYPE = ROOT + "systemtype"; //$NON-NLS-1$
|
||||
public static final String SYSTEMTYPE_VALUES = ROOT + "systemtype.info"; //$NON-NLS-1$
|
||||
public static final String USERIDPERKEY = ROOT + "useridperkey"; //$NON-NLS-1$
|
||||
public static final String USERIDKEYS = ROOT + "userid.keys"; //$NON-NLS-1$
|
||||
public static final String ACTIVEUSERPROFILES = ROOT + "activeuserprofiles"; //$NON-NLS-1$
|
||||
public static final String USE_DEFERRED_QUERIES = ROOT + "useDeferredQueries"; //$NON-NLS-1$
|
||||
public static final String RESTORE_STATE_FROM_CACHE = ROOT + "restoreStateFromCache"; //$NON-NLS-1$
|
||||
/*
|
||||
* core preference default values
|
||||
*/
|
||||
public static final String DEFAULT_SYSTEMTYPE = ""; //$NON-NLS-1$
|
||||
public static final String DEFAULT_USERID = ""; //$NON-NLS-1$
|
||||
public static final boolean DEFAULT_RESTORE_STATE_FROM_CACHE = true; // yantzi: artemis 6.0
|
||||
public static final boolean DEFAULT_USE_DEFERRED_QUERIES = true;
|
||||
public static final String DEFAULT_TEAMPROFILE = "Team"; //$NON-NLS-1$
|
||||
public static final String DEFAULT_ACTIVEUSERPROFILES = "Team"; //$NON-NLS-1$
|
||||
/*
|
||||
* dstore preference keys
|
||||
*/
|
||||
|
@ -63,6 +44,8 @@ public interface ISystemPreferencesConstants {
|
|||
/*
|
||||
* ui preference keys
|
||||
*/
|
||||
public static final String RESTORE_STATE_FROM_CACHE = ROOT + "restoreStateFromCache"; //$NON-NLS-1$
|
||||
public static final String SYSTEMTYPE_VALUES = ROOT + "systemtype.info"; //$NON-NLS-1$
|
||||
public static final String SHOWFILTERPOOLS = ROOT + "filterpools.show"; //$NON-NLS-1$
|
||||
public static final String QUALIFY_CONNECTION_NAMES = ROOT + "qualifyconnectionnames"; //$NON-NLS-1$
|
||||
public static final String ORDER_CONNECTIONS = ROOT + "order.connections"; //$NON-NLS-1$
|
||||
|
@ -76,6 +59,7 @@ public interface ISystemPreferencesConstants {
|
|||
/*
|
||||
* ui preference default values
|
||||
*/
|
||||
public static final boolean DEFAULT_RESTORE_STATE_FROM_CACHE = true; // yantzi: artemis 6.0
|
||||
public static final boolean DEFAULT_SHOWFILTERPOOLS = false;
|
||||
public static final boolean DEFAULT_QUALIFY_CONNECTION_NAMES = false;
|
||||
public static final String DEFAULT_ORDER_CONNECTIONS = ""; //$NON-NLS-1$
|
||||
|
|
|
@ -21,13 +21,10 @@ import java.net.URL;
|
|||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Plugin;
|
||||
import org.eclipse.core.runtime.Preferences;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.rse.core.IRSEPreferenceNames;
|
||||
import org.eclipse.rse.core.IRSESystemType;
|
||||
import org.eclipse.rse.core.IRSESystemTypeConstants;
|
||||
import org.eclipse.rse.core.RSECorePlugin;
|
||||
import org.eclipse.rse.core.SystemPreferencesManager;
|
||||
import org.osgi.framework.Bundle;
|
||||
|
||||
/**
|
||||
|
@ -183,12 +180,7 @@ public class RSESystemTypeAdapter extends RSEAdapter implements IRSESystemTypeCo
|
|||
boolean result = false;
|
||||
IRSESystemType systemType = getSystemType(object);
|
||||
if ( systemType != null) {
|
||||
Preferences prefs = RSECorePlugin.getDefault().getPluginPreferences();
|
||||
String key = getPreferencesKey(systemType, IRSEPreferenceNames.ST_ENABLED);
|
||||
if (!prefs.contains(key)) {
|
||||
prefs.setDefault(key, true);
|
||||
}
|
||||
result = prefs.getBoolean(key);
|
||||
result = SystemPreferencesManager.getIsSystemTypeEnabled(systemType);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -201,11 +193,7 @@ public class RSESystemTypeAdapter extends RSEAdapter implements IRSESystemTypeCo
|
|||
public void setIsEnabled(Object object, boolean isEnabled) {
|
||||
IRSESystemType systemType = getSystemType(object);
|
||||
if ( systemType != null) {
|
||||
Plugin core = RSECorePlugin.getDefault();
|
||||
Preferences prefs = core.getPluginPreferences();
|
||||
String key = getPreferencesKey(systemType, IRSEPreferenceNames.ST_ENABLED);
|
||||
prefs.setValue(key, isEnabled);
|
||||
core.savePluginPreferences();
|
||||
SystemPreferencesManager.setIsSystemTypeEnabled(systemType, isEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -219,12 +207,7 @@ public class RSESystemTypeAdapter extends RSEAdapter implements IRSESystemTypeCo
|
|||
String result = null;
|
||||
IRSESystemType systemType = getSystemType(object);
|
||||
if ( systemType != null) {
|
||||
Preferences prefs = RSECorePlugin.getDefault().getPluginPreferences();
|
||||
String key = getPreferencesKey(systemType, IRSEPreferenceNames.ST_DEFAULT_USERID);
|
||||
if (!prefs.contains(key)) {
|
||||
prefs.setDefault(key, System.getProperty("user.name")); //$NON-NLS-1$
|
||||
}
|
||||
result = prefs.getString(key);
|
||||
result = SystemPreferencesManager.getDefaultUserId(systemType);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -237,20 +220,11 @@ public class RSESystemTypeAdapter extends RSEAdapter implements IRSESystemTypeCo
|
|||
public void setDefaultUserId(Object object, String defaultUserId) {
|
||||
IRSESystemType systemType = getSystemType(object);
|
||||
if ( systemType != null) {
|
||||
Plugin core = RSECorePlugin.getDefault();
|
||||
Preferences prefs = core.getPluginPreferences();
|
||||
String key = getPreferencesKey(systemType, IRSEPreferenceNames.ST_DEFAULT_USERID);
|
||||
prefs.setValue(key, defaultUserId);
|
||||
core.savePluginPreferences();
|
||||
SystemPreferencesManager.setDefaultUserId(systemType, defaultUserId);
|
||||
}
|
||||
}
|
||||
|
||||
private String getPreferencesKey(IRSESystemType systemType, String preference) {
|
||||
String key = systemType.getName() + "." + preference; //$NON-NLS-1$
|
||||
return key;
|
||||
}
|
||||
|
||||
private IRSESystemType getSystemType(Object systemTypeCandidate) {
|
||||
|
||||
private static IRSESystemType getSystemType(Object systemTypeCandidate) {
|
||||
IRSESystemType result = null;
|
||||
if (systemTypeCandidate instanceof IRSESystemType) {
|
||||
result = (IRSESystemType) systemTypeCandidate;
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package org.eclipse.rse.ui;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.Vector;
|
||||
|
@ -30,6 +29,7 @@ import org.eclipse.jface.resource.ImageDescriptor;
|
|||
import org.eclipse.rse.core.IRSESystemType;
|
||||
import org.eclipse.rse.core.RSECorePlugin;
|
||||
import org.eclipse.rse.core.SystemBasePlugin;
|
||||
import org.eclipse.rse.core.SystemPreferencesManager;
|
||||
import org.eclipse.rse.core.SystemResourceManager;
|
||||
import org.eclipse.rse.core.comm.ISystemKeystoreProvider;
|
||||
import org.eclipse.rse.core.comm.SystemCommunicationsDaemon;
|
||||
|
@ -56,8 +56,6 @@ import org.eclipse.rse.ui.actions.SystemDynamicPopupMenuExtensionManager;
|
|||
import org.eclipse.rse.ui.actions.SystemShowPreferencesPageAction;
|
||||
import org.eclipse.rse.ui.internal.RSESystemTypeAdapterFactory;
|
||||
import org.eclipse.rse.ui.internal.RSEUIRegistry;
|
||||
import org.eclipse.rse.ui.propertypages.RemoteSystemsPreferencePage;
|
||||
import org.eclipse.rse.ui.propertypages.SystemCommunicationsPreferencePage;
|
||||
import org.eclipse.rse.ui.view.SubSystemConfigurationAdapterFactory;
|
||||
import org.eclipse.rse.ui.view.SystemViewAdapterFactory;
|
||||
import org.eclipse.rse.ui.view.team.SystemTeamViewResourceAdapterFactory;
|
||||
|
@ -81,7 +79,6 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
|
|||
private static SystemMessageFile defaultMessageFile = null;
|
||||
|
||||
// private SystemType[] allSystemTypes = null;
|
||||
private String enabledSystemTypes;
|
||||
private SystemRegistry _systemRegistry = null;
|
||||
|
||||
|
||||
|
@ -93,7 +90,6 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
|
|||
private SystemViewAdapterFactory svaf; // for fastpath access
|
||||
private SystemTeamViewResourceAdapterFactory svraf; // for fastpath
|
||||
private SystemShowPreferencesPageAction[] showPrefPageActions = null;
|
||||
private boolean dontShowLocalConnection, dontShowProfilePageInitially;
|
||||
private boolean loggingSystemMessageLine = false;
|
||||
|
||||
/**
|
||||
|
@ -119,50 +115,12 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
|
|||
}
|
||||
|
||||
/**
|
||||
* Initializes default preferences.
|
||||
* Initializes preferences.
|
||||
*/
|
||||
public void initializeDefaultPreferences() {
|
||||
|
||||
boolean showNewConnPromptPref = ISystemPreferencesConstants.DEFAULT_SHOWNEWCONNECTIONPROMPT;
|
||||
dontShowLocalConnection = false;
|
||||
dontShowProfilePageInitially = false;
|
||||
|
||||
String showNewConn = System.getProperty("rse.showNewConnectionPrompt"); //$NON-NLS-1$
|
||||
|
||||
if (showNewConn != null) {
|
||||
showNewConnPromptPref = showNewConn.equals("true"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
String showLocalConn = System.getProperty("rse.showLocalConnection"); //$NON-NLS-1$
|
||||
|
||||
if (showLocalConn != null) {
|
||||
dontShowLocalConnection = showLocalConn.equals("false"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
enabledSystemTypes = System.getProperty("rse.enableSystemTypes"); //$NON-NLS-1$
|
||||
|
||||
if ((enabledSystemTypes != null) && (enabledSystemTypes.length() == 0)) {
|
||||
enabledSystemTypes = null;
|
||||
}
|
||||
|
||||
String showProfileInitially = System.getProperty("rse.showProfilePage"); //$NON-NLS-1$
|
||||
|
||||
if (showProfileInitially != null) {
|
||||
dontShowProfilePageInitially = showProfileInitially.equals("false"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
RemoteSystemsPreferencePage.initDefaults(getPreferenceStore(), showNewConnPromptPref);
|
||||
SystemCommunicationsPreferencePage.initDefaults(getPreferenceStore());
|
||||
SystemPreferencesManager.initDefaults();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether to show profile page initially, i.e. during the first new connection creation.
|
||||
* @return <code>true</code> to show profile page initially, <code>false</code> otherwise.
|
||||
*/
|
||||
public boolean getShowProfilePageInitially() {
|
||||
return !dontShowProfilePageInitially;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set whether or not to log the messages shown on the system message line for dialogs
|
||||
* and wizards. These message are typically validation messages for fields.
|
||||
|
@ -546,7 +504,7 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
|
|||
//}
|
||||
// }
|
||||
// new support to allow products to not pre-create a local connection
|
||||
if (SystemResourceManager.isFirstTime() && !dontShowLocalConnection) {
|
||||
if (SystemResourceManager.isFirstTime() && SystemPreferencesManager.getShowLocalConnection()) {
|
||||
ISystemProfileManager profileManager = SystemProfileManager.getSystemProfileManager();
|
||||
ISystemProfile profile = profileManager.getDefaultPrivateSystemProfile();
|
||||
String userName = System.getProperty("user.name"); //$NON-NLS-1$
|
||||
|
@ -706,22 +664,6 @@ public class RSEUIPlugin extends SystemBasePlugin implements ISystemMessageProvi
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* Returns a qualified hostname given a potentially unqualified hostname
|
||||
*/
|
||||
public static String getQualifiedHostName(String hostName)
|
||||
{
|
||||
try
|
||||
{
|
||||
InetAddress address = InetAddress.getByName(hostName);
|
||||
return address.getCanonicalHostName();
|
||||
}
|
||||
catch (java.net.UnknownHostException exc)
|
||||
{
|
||||
return hostName;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array of SubSystemConfigurationProxy objects.
|
||||
* These represent all extensions to our subsystemConfigurations extension point.
|
||||
|
|
|
@ -37,7 +37,6 @@ import org.eclipse.rse.core.model.ISystemRegistry;
|
|||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.ui.dialogs.SystemPromptDialog;
|
||||
import org.eclipse.rse.ui.messages.ISystemMessageLine;
|
||||
import org.eclipse.rse.ui.propertypages.RemoteSystemsPreferencePage;
|
||||
import org.eclipse.rse.ui.validators.ISystemValidator;
|
||||
import org.eclipse.rse.ui.validators.ValidatorConnectionName;
|
||||
import org.eclipse.rse.ui.validators.ValidatorUserId;
|
||||
|
@ -469,7 +468,7 @@ public class SystemConnectionForm
|
|||
}
|
||||
else
|
||||
userIdLocation = IRSEUserIdConstants.USERID_LOCATION_NOTSET;
|
||||
SystemPreferencesManager.getPreferencesManager().setVerifyConnection(verifyHostNameCB.getSelection());
|
||||
SystemPreferencesManager.setVerifyConnection(verifyHostNameCB.getSelection());
|
||||
}
|
||||
|
||||
return ok;
|
||||
|
@ -699,7 +698,7 @@ public class SystemConnectionForm
|
|||
|
||||
if (!updateMode && (defaultSystemType==null))
|
||||
{
|
||||
defaultSystemType = RemoteSystemsPreferencePage.getSystemTypePreference();
|
||||
defaultSystemType = SystemPreferencesManager.getSystemType();
|
||||
if ((defaultSystemType == null) || (defaultSystemType.length() == 0))
|
||||
defaultSystemType = lastSystemType;
|
||||
if ((defaultSystemType == null) || (defaultSystemType.length() == 0))
|
||||
|
@ -738,7 +737,7 @@ public class SystemConnectionForm
|
|||
if (updateMode)
|
||||
verifyHostNameCB.setSelection(false);
|
||||
else
|
||||
verifyHostNameCB.setSelection(SystemPreferencesManager.getPreferencesManager().getVerifyConnection());
|
||||
verifyHostNameCB.setSelection(SystemPreferencesManager.getVerifyConnection());
|
||||
|
||||
// yantzi: artemis 6.0, work offline
|
||||
if (enableOfflineCB())
|
||||
|
@ -991,7 +990,7 @@ public class SystemConnectionForm
|
|||
{
|
||||
if (defaultSystemType == null)
|
||||
{
|
||||
defaultSystemType = RemoteSystemsPreferencePage.getSystemTypePreference();
|
||||
defaultSystemType = SystemPreferencesManager.getSystemType();
|
||||
if ((defaultSystemType == null) || (defaultSystemType.length()==0))
|
||||
defaultSystemType = lastSystemType;
|
||||
}
|
||||
|
@ -1060,7 +1059,7 @@ public class SystemConnectionForm
|
|||
// ---------------
|
||||
// default user id
|
||||
// ---------------
|
||||
String parentUserId = SystemPreferencesManager.getPreferencesManager().getDefaultUserId(systemType);
|
||||
String parentUserId = SystemPreferencesManager.getUserId(systemType);
|
||||
if (textUserId!=null)
|
||||
{
|
||||
textUserId.setInheritedText(parentUserId);
|
||||
|
|
|
@ -40,7 +40,7 @@ public class SystemPreferenceRestoreStateAction extends SystemBaseAction
|
|||
setSelectionSensitive(false);
|
||||
allowOnMultipleSelection(true);
|
||||
//sr = RSEUIPlugin.getTheSystemRegistry();
|
||||
setChecked(SystemPreferencesManager.getPreferencesManager().getRememberState());
|
||||
setChecked(SystemPreferencesManager.getRememberState());
|
||||
|
||||
setHelp(RSEUIPlugin.HELPPREFIX+"aprefres"); //$NON-NLS-1$
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ public class SystemPreferenceRestoreStateAction extends SystemBaseAction
|
|||
public void run()
|
||||
{
|
||||
boolean newState = isChecked();
|
||||
SystemPreferencesManager.getPreferencesManager().setRememberState(newState);
|
||||
SystemPreferencesManager.setRememberState(newState);
|
||||
firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_RESTORESTATE,
|
||||
!newState,newState);
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public class SystemPreferenceShowFilterPoolsAction extends SystemBaseAction
|
|||
super(SystemResources.ACTION_PREFERENCE_SHOW_FILTERPOOLS_LABEL,SystemResources.ACTION_PREFERENCE_SHOW_FILTERPOOLS_TOOLTIP,
|
||||
parent);
|
||||
allowOnMultipleSelection(true);
|
||||
setChecked(SystemPreferencesManager.getPreferencesManager().getShowFilterPools());
|
||||
setChecked(SystemPreferencesManager.getShowFilterPools());
|
||||
setSelectionSensitive(false);
|
||||
|
||||
setHelp(RSEUIPlugin.HELPPREFIX+"actn0011"); //$NON-NLS-1$
|
||||
|
@ -53,7 +53,7 @@ public class SystemPreferenceShowFilterPoolsAction extends SystemBaseAction
|
|||
public void run()
|
||||
{
|
||||
boolean newState = isChecked();
|
||||
SystemPreferencesManager.getPreferencesManager().setShowFilterPools(newState);
|
||||
SystemPreferencesManager.setShowFilterPools(newState);
|
||||
firePreferenceChangeEvent(ISystemPreferenceChangeEvents.EVENT_SHOWFILTERPOOLS,
|
||||
!newState,newState); // defect 41794
|
||||
}
|
||||
|
|
|
@ -253,7 +253,7 @@ public final class SystemPasswordPromptDialog extends SystemPromptDialog impleme
|
|||
originalUserId = connectorService.getUserId();
|
||||
userId = originalUserId;
|
||||
if (connectorService.supportsUserId() && (userId == null || userId.length() == 0)) {
|
||||
userId = SystemPreferencesManager.getPreferencesManager().getDefaultUserId(connectorService.getHostType());
|
||||
userId = SystemPreferencesManager.getUserId(connectorService.getHostType());
|
||||
}
|
||||
if (textUserId != null && userId != null) {
|
||||
textUserId.setText(userId);
|
||||
|
|
|
@ -16,22 +16,17 @@
|
|||
|
||||
package org.eclipse.rse.ui.propertypages;
|
||||
|
||||
import java.util.Hashtable;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||
import org.eclipse.rse.core.IRSESystemType;
|
||||
import org.eclipse.rse.core.IRSEPreferenceNames;
|
||||
import org.eclipse.rse.core.RSECorePlugin;
|
||||
import org.eclipse.rse.core.SystemPreferencesManager;
|
||||
import org.eclipse.rse.core.model.ISystemPreferenceChangeEvents;
|
||||
import org.eclipse.rse.internal.model.SystemPreferenceChangeEvent;
|
||||
import org.eclipse.rse.internal.model.SystemProfileManager;
|
||||
import org.eclipse.rse.ui.ISystemPreferencesConstants;
|
||||
import org.eclipse.rse.ui.Mnemonics;
|
||||
import org.eclipse.rse.ui.RSESystemTypeAdapter;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.SystemConnectionForm;
|
||||
import org.eclipse.rse.ui.SystemResources;
|
||||
import org.eclipse.rse.ui.SystemWidgetHelpers;
|
||||
import org.eclipse.swt.SWT;
|
||||
|
@ -93,7 +88,7 @@ public class RemoteSystemsPreferencePage
|
|||
{
|
||||
// DEFAULT SYSTEM TYPE
|
||||
SystemComboBoxFieldEditor systemTypeEditor = new SystemComboBoxFieldEditor(
|
||||
ISystemPreferencesConstants.SYSTEMTYPE,
|
||||
IRSEPreferenceNames.SYSTEMTYPE,
|
||||
SystemResources.RESID_PREF_SYSTEMTYPE_PREFIX_LABEL,
|
||||
RSECorePlugin.getDefault().getRegistry().getSystemTypeNames(),
|
||||
true, // readonly
|
||||
|
@ -169,7 +164,7 @@ public class RemoteSystemsPreferencePage
|
|||
|
||||
// USE DEFERRED QUERY
|
||||
useDeferredQueryEditor = new SystemBooleanFieldEditor(
|
||||
ISystemPreferencesConstants.USE_DEFERRED_QUERIES,
|
||||
IRSEPreferenceNames.USE_DEFERRED_QUERIES,
|
||||
SystemResources.RESID_PREF_USEDEFERREDQUERIES_PREFIX_LABEL,
|
||||
getFieldEditorParent())
|
||||
;
|
||||
|
@ -197,419 +192,11 @@ public class RemoteSystemsPreferencePage
|
|||
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------
|
||||
// GETTERS/SETTERS FOR EACH OF THE USER PREFERENCE VALUES...
|
||||
// ---------------------------------------------------------
|
||||
// DWD these preferences methods should be moved to SystemPreferencesManager since they are not a proper function of a preference page.
|
||||
/**
|
||||
* Return the names of the profiles the user has elected to make "active".
|
||||
*/
|
||||
public static String[] getActiveProfiles()
|
||||
{
|
||||
IPreferenceStore store = RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
return parseStrings(store.getString(ISystemPreferencesConstants.ACTIVEUSERPROFILES));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the names of the profiles the user has elected to make "active".
|
||||
*/
|
||||
public static void setActiveProfiles(String[] newProfileNames)
|
||||
{
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
store.setValue(ISystemPreferencesConstants.ACTIVEUSERPROFILES, makeString(newProfileNames));
|
||||
savePreferenceStore();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the ordered list of connection names. This is how user arranged his connections in the system view.
|
||||
*/
|
||||
public static String[] getConnectionNamesOrder()
|
||||
{
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
return parseStrings(store.getString(ISystemPreferencesConstants.ORDER_CONNECTIONS));
|
||||
}
|
||||
/**
|
||||
* Set the ordered list of connection names. This is how user arranged his connections in the system view.
|
||||
*/
|
||||
public static void setConnectionNamesOrder(String[] newConnectionNamesOrder)
|
||||
{
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
store.setValue(ISystemPreferencesConstants.ORDER_CONNECTIONS, makeString(newConnectionNamesOrder));
|
||||
savePreferenceStore();
|
||||
}
|
||||
/**
|
||||
* Return true if the user has elected to show filter pools in the Remote System Explorer view
|
||||
*/
|
||||
public static boolean getShowFilterPoolsPreference()
|
||||
{
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
return store.getBoolean(ISystemPreferencesConstants.SHOWFILTERPOOLS);
|
||||
}
|
||||
/**
|
||||
* Toggle whether to show filter pools in the Remote System Explorer view
|
||||
*/
|
||||
public static void setShowFilterPoolsPreference(boolean show)
|
||||
{
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
store.setValue(ISystemPreferencesConstants.SHOWFILTERPOOLS,show);
|
||||
savePreferenceStore();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the user has elected to show the "New Connection..." prompt in the Remote Systems view
|
||||
*/
|
||||
public static boolean getShowNewConnectionPromptPreference()
|
||||
{
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
boolean value = store.getBoolean(ISystemPreferencesConstants.SHOWNEWCONNECTIONPROMPT);
|
||||
return value;
|
||||
}
|
||||
/**
|
||||
* Toggle whether to show filter pools in the Remote System Explorer view
|
||||
*/
|
||||
public static void setShowNewConnectionPromptPreference(boolean show)
|
||||
{
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
store.setValue(ISystemPreferencesConstants.SHOWNEWCONNECTIONPROMPT,show);
|
||||
savePreferenceStore();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the user has elected to show connection names qualified by profile
|
||||
*/
|
||||
public static boolean getQualifyConnectionNamesPreference()
|
||||
{
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
return store.getBoolean(ISystemPreferencesConstants.QUALIFY_CONNECTION_NAMES);
|
||||
}
|
||||
/**
|
||||
* Set if the user has elected to show connection names qualified by profile
|
||||
*/
|
||||
public static void setQualifyConnectionNamesPreference(boolean set)
|
||||
{
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
store.setValue(ISystemPreferencesConstants.QUALIFY_CONNECTION_NAMES,set);
|
||||
savePreferenceStore();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the user has elected to remember the state of the Remote Systems view
|
||||
*/
|
||||
public static boolean getRememberStatePreference()
|
||||
{
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
return store.getBoolean(ISystemPreferencesConstants.REMEMBER_STATE);
|
||||
}
|
||||
/**
|
||||
* Set if the user has elected to show connection names qualified by profile
|
||||
*/
|
||||
public static void setRememberStatePreference(boolean set)
|
||||
{
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
store.setValue(ISystemPreferencesConstants.REMEMBER_STATE,set);
|
||||
savePreferenceStore();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the user has elected to restore the state of the Remote Systems view from cached information
|
||||
*/
|
||||
public static boolean getRestoreStateFromCachePreference()
|
||||
{
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
return store.getBoolean(ISystemPreferencesConstants.RESTORE_STATE_FROM_CACHE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if the user has elected to restore the state of the Remote Systems view from cached information
|
||||
*/
|
||||
public static void setRestoreStateFromCachePreference(boolean set)
|
||||
{
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
store.setValue(ISystemPreferencesConstants.RESTORE_STATE_FROM_CACHE, set);
|
||||
savePreferenceStore();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the user has elected to show user defined actions cascaded by profile
|
||||
*/
|
||||
public static boolean getCascadeUserActionsPreference()
|
||||
{
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
return store.getBoolean(ISystemPreferencesConstants.CASCADE_UDAS_BYPROFILE);
|
||||
}
|
||||
/**
|
||||
* Set if the user has elected to show user defined actions cascaded by profile
|
||||
*/
|
||||
public static void setCascadeUserActionsPreference(boolean set)
|
||||
{
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
store.setValue(ISystemPreferencesConstants.CASCADE_UDAS_BYPROFILE,set);
|
||||
savePreferenceStore();
|
||||
}
|
||||
/**
|
||||
* Return the userId to default to on the Create Connection wizard, per the given system type.
|
||||
*
|
||||
* @see SystemConnectionForm
|
||||
*/
|
||||
public static String getUserIdPreference(String systemType)
|
||||
{
|
||||
if (systemType == null)
|
||||
return null;
|
||||
|
||||
IRSESystemType sysType = RSECorePlugin.getDefault().getRegistry().getSystemType(systemType);
|
||||
Object adapter = sysType.getAdapter(IRSESystemType.class);
|
||||
if (adapter instanceof RSESystemTypeAdapter)
|
||||
{
|
||||
RSESystemTypeAdapter sysTypeAdapter = (RSESystemTypeAdapter)adapter;
|
||||
return sysTypeAdapter.getDefaultUserId(sysType);
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the default userId per the given system type.
|
||||
*/
|
||||
public static void setUserIdPreference(String systemType, String userId)
|
||||
{
|
||||
IRSESystemType sysType = RSECorePlugin.getDefault().getRegistry().getSystemType(systemType);
|
||||
RSESystemTypeAdapter sysTypeAdapter = (RSESystemTypeAdapter)(sysType.getAdapter(IRSESystemType.class));
|
||||
if (sysTypeAdapter != null)
|
||||
sysTypeAdapter.setDefaultUserId(sysType, userId);
|
||||
else
|
||||
return;
|
||||
// following needs to stay in synch with modify() method in SystemTypeFieldEditor...
|
||||
String value = RSEUIPlugin.getDefault().getPreferenceStore().getString(ISystemPreferencesConstants.SYSTEMTYPE_VALUES);
|
||||
Hashtable keyValues = null;
|
||||
if ((value == null) || (value.length()==0)) // not initialized yet?
|
||||
{
|
||||
keyValues = new Hashtable();
|
||||
// nothing to do, as we have read from systemTypes extension points already
|
||||
}
|
||||
else
|
||||
{
|
||||
keyValues = parseString(value);
|
||||
}
|
||||
|
||||
String defaultUserId = sysTypeAdapter.getDefaultUserId(sysType);
|
||||
|
||||
if (defaultUserId == null) {
|
||||
defaultUserId = "null"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
keyValues.put(sysType.getName(), "" + sysTypeAdapter.isEnabled(sysType) + SystemTypeFieldEditor.EACHVALUE_DELIMITER + defaultUserId); //$NON-NLS-1$
|
||||
String s = SystemTypeFieldEditor.createString(keyValues);
|
||||
|
||||
if (s != null)
|
||||
RSEUIPlugin.getDefault().getPreferenceStore().setValue(ISystemPreferencesConstants.SYSTEMTYPE_VALUES, s);
|
||||
|
||||
savePreferenceStore();
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * Return the hashtable where the key is a string identifying a particular object, and
|
||||
// * the value is the user Id for that object.
|
||||
// */
|
||||
// public static Hashtable getUserIdsPerKey() // DWD remove this later
|
||||
// {
|
||||
// IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
// Hashtable keyValues = null;
|
||||
// String value = store.getString(ISystemPreferencesConstants.USERIDPERKEY);
|
||||
// if (value != null)
|
||||
// keyValues = parseString(value);
|
||||
// else
|
||||
// {
|
||||
// keyValues = new Hashtable();
|
||||
// }
|
||||
// return keyValues;
|
||||
// }
|
||||
// /**
|
||||
// * Set/store the user ids that are saved keyed by some key.
|
||||
// */
|
||||
// public static void setUserIdsPerKey(Hashtable uidsPerKey) // DWD remove this later
|
||||
// {
|
||||
// IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
// store.setValue(ISystemPreferencesConstants.USERIDPERKEY, makeString(uidsPerKey));
|
||||
// savePreferenceStore();
|
||||
// }
|
||||
|
||||
/**
|
||||
* Return the System type to default to on the Create Connection wizard.
|
||||
*
|
||||
* @see SystemConnectionForm
|
||||
*/
|
||||
public static String getSystemTypePreference()
|
||||
{
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
return store.getString(ISystemPreferencesConstants.SYSTEMTYPE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the history for the folder combo box widget
|
||||
*/
|
||||
public static String[] getFolderHistory()
|
||||
{
|
||||
return getWidgetHistory(ISystemPreferencesConstants.HISTORY_FOLDER);
|
||||
}
|
||||
/**
|
||||
* Set the history for the folder combo box widget.
|
||||
*/
|
||||
public static void setFolderHistory(String[] newHistory)
|
||||
{
|
||||
setWidgetHistory(ISystemPreferencesConstants.HISTORY_FOLDER, newHistory);
|
||||
}
|
||||
/**
|
||||
* Return the history for a widget given an arbitrary key uniquely identifying it
|
||||
*/
|
||||
public static String[] getWidgetHistory(String key)
|
||||
{
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
return parseStrings(store.getString(key));
|
||||
}
|
||||
/**
|
||||
* Set the history for a widget given an arbitrary key uniquely identifying it.
|
||||
*/
|
||||
public static void setWidgetHistory(String key, String[] newHistory)
|
||||
{
|
||||
IPreferenceStore store= RSEUIPlugin.getDefault().getPreferenceStore();
|
||||
store.setValue(key, makeString(newHistory));
|
||||
savePreferenceStore();
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------
|
||||
// MISCELLANEOUS METHODS...
|
||||
// -------------------------------------------------
|
||||
|
||||
/**
|
||||
* Parse out list of key-value pairs into a hashtable
|
||||
*/
|
||||
protected static Hashtable parseString(String allvalues)
|
||||
{
|
||||
StringTokenizer tokens = new StringTokenizer(allvalues, "=;"); //$NON-NLS-1$
|
||||
Hashtable keyValues = new Hashtable(10);
|
||||
int count = 0;
|
||||
String token1=null;
|
||||
String token2=null;
|
||||
while (tokens.hasMoreTokens())
|
||||
{
|
||||
count++;
|
||||
if ((count % 2) == 0) // even number
|
||||
{
|
||||
token2 = tokens.nextToken();
|
||||
keyValues.put(token1, token2);
|
||||
}
|
||||
else
|
||||
token1 = tokens.nextToken();
|
||||
}
|
||||
return keyValues;
|
||||
}
|
||||
/**
|
||||
* Convert hashtable of key-value pairs into a single string
|
||||
*/
|
||||
// protected static String makeString(Hashtable keyValues) DWD remove this later
|
||||
// {
|
||||
// Enumeration keys = keyValues.keys();
|
||||
// StringBuffer sb = new StringBuffer();
|
||||
// while (keys.hasMoreElements())
|
||||
// {
|
||||
// String key = (String)keys.nextElement();
|
||||
// String value = (String)keyValues.get(key);
|
||||
// if ((value != null) && (value.length()>0))
|
||||
// {
|
||||
// sb.append(key);
|
||||
// sb.append('=');
|
||||
// sb.append(value);
|
||||
// sb.append(';');
|
||||
// }
|
||||
// }
|
||||
// return sb.toString();
|
||||
// }
|
||||
|
||||
/**
|
||||
* Parse out list of multiple values into a string array per value
|
||||
*/
|
||||
protected static String[] parseStrings(String allvalues)
|
||||
{
|
||||
if (allvalues == null)
|
||||
return new String[0];
|
||||
//StringTokenizer tokens = new StringTokenizer(allvalues, ";");
|
||||
String[] tokens = allvalues.split(";"); //$NON-NLS-1$
|
||||
return tokens;
|
||||
/*
|
||||
Vector v = new Vector();
|
||||
int idx=0;
|
||||
while (tokens.hasMoreTokens())
|
||||
v.addElement(tokens.nextToken());
|
||||
String keyValues[] = new String[v.size()];
|
||||
for (idx=0;idx<v.size();idx++)
|
||||
keyValues[idx] = (String)v.elementAt(idx);
|
||||
return keyValues;
|
||||
*/
|
||||
}
|
||||
/**
|
||||
* Make a single string out of an array of strings
|
||||
*/
|
||||
protected static String makeString(String[] values)
|
||||
{
|
||||
StringBuffer allValues = new StringBuffer();
|
||||
boolean first = true;
|
||||
for (int idx=0; idx<values.length; idx++)
|
||||
{
|
||||
if (values[idx] != null)
|
||||
{
|
||||
if (!first)
|
||||
{
|
||||
allValues = allValues.append(';');
|
||||
}
|
||||
allValues.append(values[idx]);
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
return allValues.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the preference store.
|
||||
*/
|
||||
private static void savePreferenceStore()
|
||||
{
|
||||
/* plugin preferences and preference stores are actually the same store and are flushed to disk using this call */
|
||||
RSEUIPlugin.getDefault().savePluginPreferences();
|
||||
}
|
||||
|
||||
public void init(IWorkbench workbench)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize our preference store with our defaults.
|
||||
* This is called in RSEUIPlugin.initializeDefaultPreferences
|
||||
*/
|
||||
public static void initDefaults(IPreferenceStore store, boolean showNewConnectionPromptDefault)
|
||||
{
|
||||
store.setDefault(ISystemPreferencesConstants.SYSTEMTYPE, ISystemPreferencesConstants.DEFAULT_SYSTEMTYPE);
|
||||
store.setDefault(ISystemPreferencesConstants.QUALIFY_CONNECTION_NAMES, ISystemPreferencesConstants.DEFAULT_QUALIFY_CONNECTION_NAMES);
|
||||
store.setDefault(ISystemPreferencesConstants.SHOWFILTERPOOLS, ISystemPreferencesConstants.DEFAULT_SHOWFILTERPOOLS);
|
||||
|
||||
String defaultProfileNames = ISystemPreferencesConstants.DEFAULT_ACTIVEUSERPROFILES;
|
||||
String userProfileName = SystemProfileManager.getDefaultPrivateSystemProfileName();
|
||||
defaultProfileNames += ";" + userProfileName; //$NON-NLS-1$
|
||||
|
||||
|
||||
store.setDefault(ISystemPreferencesConstants.ACTIVEUSERPROFILES, defaultProfileNames);
|
||||
store.setDefault(ISystemPreferencesConstants.ORDER_CONNECTIONS, ISystemPreferencesConstants.DEFAULT_ORDER_CONNECTIONS);
|
||||
store.setDefault(ISystemPreferencesConstants.HISTORY_FOLDER, ISystemPreferencesConstants.DEFAULT_HISTORY_FOLDER);
|
||||
store.setDefault(ISystemPreferencesConstants.REMEMBER_STATE, ISystemPreferencesConstants.DEFAULT_REMEMBER_STATE);
|
||||
store.setDefault(ISystemPreferencesConstants.RESTORE_STATE_FROM_CACHE, ISystemPreferencesConstants.DEFAULT_RESTORE_STATE_FROM_CACHE);
|
||||
store.setDefault(ISystemPreferencesConstants.SHOWNEWCONNECTIONPROMPT, showNewConnectionPromptDefault);
|
||||
store.setDefault(ISystemPreferencesConstants.CASCADE_UDAS_BYPROFILE, ISystemPreferencesConstants.DEFAULT_CASCADE_UDAS_BYPROFILE);
|
||||
|
||||
store.setDefault(ISystemPreferencesConstants.USE_DEFERRED_QUERIES, ISystemPreferencesConstants.DEFAULT_USE_DEFERRED_QUERIES);
|
||||
}
|
||||
|
||||
/**
|
||||
* we don't use this after all because it causes an event to be fired as the
|
||||
* user makes each change. We prefer to wait until Apply or Defaults are pressed.
|
||||
*/
|
||||
|
@ -635,7 +222,7 @@ public class RemoteSystemsPreferencePage
|
|||
public boolean performOk()
|
||||
{
|
||||
boolean ok = super.performOk();
|
||||
savePreferenceStore(); // better save to disk, just in case.
|
||||
SystemPreferencesManager.savePreferences(); // better save to disk, just in case.
|
||||
if (!RSEUIPlugin.getDefault().isSystemRegistryActive())
|
||||
return ok;
|
||||
if (showFilterPoolsEditor != null)
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package org.eclipse.rse.ui.propertypages;
|
||||
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.preference.IntegerFieldEditor;
|
||||
import org.eclipse.rse.core.comm.SystemCommunicationsDaemon;
|
||||
import org.eclipse.rse.ui.ISystemMessages;
|
||||
|
@ -102,17 +101,6 @@ public class SystemCommunicationsPreferencePage extends FieldEditorPreferencePag
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default preferences for the communications preference page.
|
||||
*
|
||||
* @param store PreferenceStore used for this preference page.
|
||||
*/
|
||||
public static void initDefaults(IPreferenceStore store)
|
||||
{
|
||||
store.setDefault(ISystemPreferencesConstants.DAEMON_AUTOSTART, ISystemPreferencesConstants.DEFAULT_DAEMON_AUTOSTART);
|
||||
store.setDefault(ISystemPreferencesConstants.DAEMON_PORT, ISystemPreferencesConstants.DEFAULT_DAEMON_PORT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see FieldEditorPreferencePage#performOk()
|
||||
*/
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.util.Hashtable;
|
|||
import java.util.StringTokenizer;
|
||||
|
||||
import org.eclipse.jface.preference.FieldEditor;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.viewers.CellEditor;
|
||||
import org.eclipse.jface.viewers.ColumnLayoutData;
|
||||
import org.eclipse.jface.viewers.ColumnWeightData;
|
||||
|
@ -38,8 +37,8 @@ import org.eclipse.jface.viewers.TextCellEditor;
|
|||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.rse.core.IRSESystemType;
|
||||
import org.eclipse.rse.core.RSECorePlugin;
|
||||
import org.eclipse.rse.core.SystemPreferencesManager;
|
||||
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
|
||||
import org.eclipse.rse.ui.ISystemPreferencesConstants;
|
||||
import org.eclipse.rse.ui.RSESystemTypeAdapter;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.SystemResources;
|
||||
|
@ -152,7 +151,7 @@ public class SystemTypeFieldEditor extends FieldEditor
|
|||
if (systemTypes == null)
|
||||
systemTypes = getSystemTypes(false);
|
||||
|
||||
String value = getPreferenceStore().getString(ISystemPreferencesConstants.SYSTEMTYPE_VALUES);
|
||||
String value = SystemPreferencesManager.getSystemTypeValues();
|
||||
keyValues = null;
|
||||
|
||||
if ((value == null) || (value.length() == 0))
|
||||
|
@ -185,8 +184,9 @@ public class SystemTypeFieldEditor extends FieldEditor
|
|||
{
|
||||
String s = createString(keyValues);
|
||||
|
||||
if (s != null)
|
||||
getPreferenceStore().setValue(getPreferenceName(), s);
|
||||
if (s != null) {
|
||||
SystemPreferencesManager.setSystemTypeValues(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -486,55 +486,56 @@ public class SystemTypeFieldEditor extends FieldEditor
|
|||
table.setToolTipText(tip);
|
||||
}
|
||||
|
||||
public static Hashtable initSystemTypePreferences(IPreferenceStore store, IRSESystemType[] systemTypes)
|
||||
{
|
||||
String value = store.getString(ISystemPreferencesConstants.SYSTEMTYPE_VALUES);
|
||||
Hashtable keyValues = null;
|
||||
if ((value == null) || (value.length()==0)) // not initialized yet?
|
||||
{
|
||||
return null;
|
||||
// nothing to do, as we have read from systemTypes extension points already
|
||||
}
|
||||
else
|
||||
{
|
||||
keyValues = parseString(value);
|
||||
// we have now a hashtable, where the keys are the system type names,
|
||||
// and the values are the column-value attributes for that type, separated
|
||||
// by a '+' character: enabled+userid. eg: "true+bob"
|
||||
Enumeration keys = keyValues.keys();
|
||||
while (keys.hasMoreElements())
|
||||
{
|
||||
String key = (String)keys.nextElement();
|
||||
String attributes = (String)keyValues.get(key);
|
||||
String attr1="true", attr2=""; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
if ((attributes != null) && (attributes.length()>0))
|
||||
{
|
||||
StringTokenizer tokens = new StringTokenizer(attributes, Character.toString(EACHVALUE_DELIMITER));
|
||||
if (tokens.hasMoreTokens())
|
||||
{
|
||||
attr1 = tokens.nextToken();
|
||||
if (tokens.hasMoreTokens())
|
||||
{
|
||||
attr2 = tokens.nextToken();
|
||||
}
|
||||
else
|
||||
{
|
||||
attr2 = "null"; //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
// find this system type in the array...
|
||||
IRSESystemType matchingType = RSECorePlugin.getDefault().getRegistry().getSystemType(key);
|
||||
RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(matchingType.getAdapter(IRSESystemType.class));
|
||||
|
||||
// update this system type's attributes as per preferences...
|
||||
{
|
||||
adapter.setIsEnabled(matchingType, attr1.equals("true")); //$NON-NLS-1$
|
||||
if (!attr2.equals("null")) //$NON-NLS-1$
|
||||
adapter.setDefaultUserId(matchingType, attr2);
|
||||
}
|
||||
}
|
||||
}
|
||||
return keyValues;
|
||||
}
|
||||
// public static Hashtable initSystemTypePreferences(IPreferenceStore store, IRSESystemType[] systemTypes)
|
||||
// {
|
||||
// /* this must stay in synch with the SystemPreferencesManager */
|
||||
// String value = store.getString(ISystemPreferencesConstants.SYSTEMTYPE_VALUES);
|
||||
// Hashtable keyValues = null;
|
||||
// if ((value == null) || (value.length()==0)) // not initialized yet?
|
||||
// {
|
||||
// return null;
|
||||
// // nothing to do, as we have read from systemTypes extension points already
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// keyValues = parseString(value);
|
||||
// // we have now a hashtable, where the keys are the system type names,
|
||||
// // and the values are the column-value attributes for that type, separated
|
||||
// // by a '+' character: enabled+userid. eg: "true+bob"
|
||||
// Enumeration keys = keyValues.keys();
|
||||
// while (keys.hasMoreElements())
|
||||
// {
|
||||
// String key = (String)keys.nextElement();
|
||||
// String attributes = (String)keyValues.get(key);
|
||||
// String attr1="true", attr2=""; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
// if ((attributes != null) && (attributes.length()>0))
|
||||
// {
|
||||
// StringTokenizer tokens = new StringTokenizer(attributes, Character.toString(EACHVALUE_DELIMITER));
|
||||
// if (tokens.hasMoreTokens())
|
||||
// {
|
||||
// attr1 = tokens.nextToken();
|
||||
// if (tokens.hasMoreTokens())
|
||||
// {
|
||||
// attr2 = tokens.nextToken();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// attr2 = "null"; //$NON-NLS-1$
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// // find this system type in the array...
|
||||
// IRSESystemType matchingType = RSECorePlugin.getDefault().getRegistry().getSystemType(key);
|
||||
// RSESystemTypeAdapter adapter = (RSESystemTypeAdapter)(matchingType.getAdapter(IRSESystemType.class));
|
||||
//
|
||||
// // update this system type's attributes as per preferences...
|
||||
// {
|
||||
// adapter.setIsEnabled(matchingType, attr1.equals("true")); //$NON-NLS-1$
|
||||
// if (!attr2.equals("null")) //$NON-NLS-1$
|
||||
// adapter.setDefaultUserId(matchingType, attr2);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return keyValues;
|
||||
// }
|
||||
}
|
|
@ -53,7 +53,6 @@ public class SystemTableViewColumnManager
|
|||
public void setCustomDescriptors(ISystemViewElementAdapter adapter, IPropertyDescriptor[] descriptors)
|
||||
{
|
||||
putCachedDescriptors(adapter, descriptors);
|
||||
SystemPreferencesManager mgr = SystemPreferencesManager.getPreferencesManager();
|
||||
String historyKey = getHistoryKey(adapter);
|
||||
String[] history = new String[descriptors.length];
|
||||
for (int i = 0; i < descriptors.length; i++)
|
||||
|
@ -61,7 +60,7 @@ public class SystemTableViewColumnManager
|
|||
history[i] = descriptors[i].getId().toString();
|
||||
}
|
||||
|
||||
mgr.setWidgetHistory(historyKey, history);
|
||||
SystemPreferencesManager.setWidgetHistory(historyKey, history);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -99,9 +98,8 @@ public class SystemTableViewColumnManager
|
|||
{
|
||||
IPropertyDescriptor[] uniqueDescriptors = adapter.getUniquePropertyDescriptors();
|
||||
|
||||
SystemPreferencesManager mgr = SystemPreferencesManager.getPreferencesManager();
|
||||
String historyKey = getHistoryKey(adapter);
|
||||
String[] history = mgr.getWidgetHistory(historyKey);
|
||||
String[] history = SystemPreferencesManager.getWidgetHistory(historyKey);
|
||||
|
||||
// determine the order and which of the uniqueDescriptors to use based on the history
|
||||
if (history != null && history.length > 0)
|
||||
|
|
|
@ -1665,7 +1665,7 @@ public class SystemTableViewPart extends ViewPart implements ISelectionListener,
|
|||
{
|
||||
super.init(site, memento);
|
||||
|
||||
if (memento != null && SystemPreferencesManager.getPreferencesManager().getRememberState())
|
||||
if (memento != null && SystemPreferencesManager.getRememberState())
|
||||
{
|
||||
_memento = memento;
|
||||
|
||||
|
@ -1679,7 +1679,7 @@ public class SystemTableViewPart extends ViewPart implements ISelectionListener,
|
|||
{
|
||||
super.saveState(memento);
|
||||
|
||||
if (!SystemPreferencesManager.getPreferencesManager().getRememberState())
|
||||
if (!SystemPreferencesManager.getRememberState())
|
||||
return;
|
||||
|
||||
if (_viewer != null)
|
||||
|
|
|
@ -1496,7 +1496,7 @@ public class SystemView extends SafeTreeViewer implements ISystemTree, ISystemRe
|
|||
setExpandedState(parentSubSystem, true); // expand the subsystem
|
||||
Object filterParentInTree = parentSubSystem; // will be case unless in show filter pool mode
|
||||
// if showing filter pools, expand parent filter pool reference...
|
||||
if (SystemPreferencesManager.getPreferencesManager().getShowFilterPools()) {
|
||||
if (SystemPreferencesManager.getShowFilterPools()) {
|
||||
ISystemFilterPoolReference poolRef = parentSubSystem.getFilterPoolReferenceManager().getReferenceToSystemFilterPool(filter.getParentFilterPool());
|
||||
setExpandedState(poolRef, true);
|
||||
filterParentInTree = poolRef;
|
||||
|
|
|
@ -403,7 +403,7 @@ public class SystemViewConnectionAdapter
|
|||
{
|
||||
String localUserId = conn.getLocalDefaultUserId();
|
||||
data.setLocalValue(localUserId);
|
||||
String parentUserId = SystemPreferencesManager.getPreferencesManager().getDefaultUserId(conn.getSystemType());
|
||||
String parentUserId = SystemPreferencesManager.getUserId(conn.getSystemType());
|
||||
data.setInheritedValue(parentUserId);
|
||||
data.setIsLocal((localUserId!=null)&&(localUserId.length()>0));
|
||||
//data.printDetails();
|
||||
|
|
|
@ -206,7 +206,7 @@ public class SystemViewFilterReferenceAdapter
|
|||
return parentContainer;
|
||||
// else parent is a filter pool. The parent will be the pool only if
|
||||
// we are in "Show Filter Pools" mode, else it is the subsystem.
|
||||
boolean showFPs = SystemPreferencesManager.getPreferencesManager().getShowFilterPools();
|
||||
boolean showFPs = SystemPreferencesManager.getShowFilterPools();
|
||||
if (showFPs)
|
||||
return parentContainer;
|
||||
else
|
||||
|
@ -748,7 +748,7 @@ public class SystemViewFilterReferenceAdapter
|
|||
{
|
||||
Object parent = ((ISystemFilterReference) element).getParent(); //getParent(element); // will be filter (nested) or filter pool
|
||||
ISystemViewElementAdapter parentAdapter = getAdapter(parent);
|
||||
boolean showFPs = SystemPreferencesManager.getPreferencesManager().getShowFilterPools();
|
||||
boolean showFPs = SystemPreferencesManager.getShowFilterPools();
|
||||
if (parent instanceof ISystemFilterPoolReference) // not a nested filter
|
||||
{
|
||||
if (!showFPs) // not showing the real parent in GUI?
|
||||
|
|
|
@ -777,11 +777,11 @@ public class SystemViewPart
|
|||
public void systemPreferenceChanged(ISystemPreferenceChangeEvent event)
|
||||
{
|
||||
if ((event.getType() == ISystemPreferenceChangeEvents.EVENT_QUALIFYCONNECTIONNAMES) && (qualifyConnectionNamesAction != null))
|
||||
qualifyConnectionNamesAction.setChecked(SystemPreferencesManager.getPreferencesManager().getQualifyConnectionNames());
|
||||
qualifyConnectionNamesAction.setChecked(SystemPreferencesManager.getQualifyConnectionNames());
|
||||
else if ((event.getType() == ISystemPreferenceChangeEvents.EVENT_SHOWFILTERPOOLS) && (showFilterPoolsAction != null))
|
||||
showFilterPoolsAction.setChecked(SystemPreferencesManager.getPreferencesManager().getShowFilterPools());
|
||||
showFilterPoolsAction.setChecked(SystemPreferencesManager.getShowFilterPools());
|
||||
else if ((event.getType() == ISystemPreferenceChangeEvents.EVENT_RESTORESTATE) && (restoreStateAction != null))
|
||||
restoreStateAction.setChecked(SystemPreferencesManager.getPreferencesManager().getRememberState());
|
||||
restoreStateAction.setChecked(SystemPreferencesManager.getRememberState());
|
||||
|
||||
//else if ((event.getType() == ISystemPreferenceChangeEvents.EVENT_SHOWFILTERSTRINGS) &&
|
||||
// (showFilterStringsAction != null))
|
||||
|
@ -934,7 +934,7 @@ public class SystemViewPart
|
|||
public void saveState(IMemento memento)
|
||||
{
|
||||
//System.out.println("INSIDE SAVESTATE");
|
||||
if (!SystemPreferencesManager.getPreferencesManager().getRememberState())
|
||||
if (!SystemPreferencesManager.getRememberState())
|
||||
return;
|
||||
if (systemView == null)
|
||||
{
|
||||
|
@ -960,7 +960,7 @@ public class SystemViewPart
|
|||
// We do this to ensure the states match on restore. If they don't we will be in trouble
|
||||
// restoring expansion state and hence will abandon it.
|
||||
|
||||
memento.putString(TAG_SHOWFILTERPOOLS, SystemPreferencesManager.getPreferencesManager().getShowFilterPools() ? "t" : "f"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
memento.putString(TAG_SHOWFILTERPOOLS, SystemPreferencesManager.getShowFilterPools() ? "t" : "f"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
//memento.putString(TAG_SHOWFILTERSTRINGS, SystemPreferencesManager.getPreferencesManager().getShowFilterStrings() ? "t" : "f");
|
||||
|
||||
String inputMemento = memento.getString("factoryID"); // see IWorkbenchWindow ... this is only clue I can figure out! //$NON-NLS-1$
|
||||
|
@ -1522,7 +1522,7 @@ public class SystemViewPart
|
|||
{
|
||||
IMemento memento = _memento;
|
||||
//System.out.println("SYSTEMVIEWPART: restoreState");
|
||||
if (!SystemPreferencesManager.getPreferencesManager().getRememberState())
|
||||
if (!SystemPreferencesManager.getRememberState())
|
||||
return Status.CANCEL_STATUS;
|
||||
|
||||
// restore the show filter pools and show filter strings settings as they were when this was saved
|
||||
|
@ -1548,7 +1548,7 @@ public class SystemViewPart
|
|||
if (savedValue != null)
|
||||
showFilterPools = savedValue.equals("t"); //$NON-NLS-1$
|
||||
else
|
||||
showFilterPools = SystemPreferencesManager.getPreferencesManager().getShowFilterPools();
|
||||
showFilterPools = SystemPreferencesManager.getShowFilterPools();
|
||||
savedValue = memento.getString(TAG_SHOWFILTERSTRINGS); // historical
|
||||
if (savedValue != null)
|
||||
showFilterStrings = savedValue.equals("t"); //$NON-NLS-1$
|
||||
|
@ -1754,7 +1754,7 @@ public class SystemViewPart
|
|||
if (savedValue != null)
|
||||
showFilterPools = savedValue.equals("t"); //$NON-NLS-1$
|
||||
else
|
||||
showFilterPools = SystemPreferencesManager.getPreferencesManager().getShowFilterPools();
|
||||
showFilterPools = SystemPreferencesManager.getShowFilterPools();
|
||||
|
||||
savedValue = memento.getString(TAG_SHOWFILTERSTRINGS);
|
||||
if (savedValue != null)
|
||||
|
@ -1861,7 +1861,7 @@ public class SystemViewPart
|
|||
{
|
||||
//System.out.println("INSIDE GETADAPTER IN SYSTEMVIEWPART. adaptableObject = "+adaptableObject+", adapterType = "+adapterType.getName());
|
||||
// we don't try to restore these secondary perspectives unless user has elected to do so...
|
||||
if (!SystemPreferencesManager.getPreferencesManager().getRememberState())
|
||||
if (!SystemPreferencesManager.getRememberState())
|
||||
return null;
|
||||
else
|
||||
return this;
|
||||
|
|
|
@ -33,7 +33,6 @@ import org.eclipse.swt.widgets.Shell;
|
|||
*/
|
||||
public class SystemViewRootInputAdapter extends AbstractSystemViewAdapter implements ISystemViewElementAdapter
|
||||
{
|
||||
private SystemPreferencesManager spg;
|
||||
private SystemNewConnectionPromptObject newConnPrompt;
|
||||
private Object[] newConnPromptArray;
|
||||
|
||||
|
@ -168,9 +167,7 @@ public class SystemViewRootInputAdapter extends AbstractSystemViewAdapter implem
|
|||
|
||||
private boolean showNewConnectionPrompt()
|
||||
{
|
||||
if (spg == null)
|
||||
spg = SystemPreferencesManager.getPreferencesManager();
|
||||
return spg.getShowNewConnectionPrompt();
|
||||
return SystemPreferencesManager.getShowNewConnectionPrompt();
|
||||
}
|
||||
|
||||
private SystemNewConnectionPromptObject getNewConnectionPromptObject()
|
||||
|
|
|
@ -183,7 +183,7 @@ public class SystemHistoryCombo extends Composite implements ISystemCombo, Trave
|
|||
{
|
||||
setItems(newItems);
|
||||
selIdx = currentItems.length;
|
||||
SystemPreferencesManager.getPreferencesManager().setWidgetHistory(historyKey, newItems);
|
||||
SystemPreferencesManager.setWidgetHistory(historyKey, newItems);
|
||||
}
|
||||
if (selIdx >= 0)
|
||||
{
|
||||
|
@ -273,7 +273,7 @@ public class SystemHistoryCombo extends Composite implements ISystemCombo, Trave
|
|||
if (historyCombo.getItemCount() == 0)
|
||||
{
|
||||
setItems(items);
|
||||
SystemPreferencesManager.getPreferencesManager().setWidgetHistory(historyKey, items); //d41439
|
||||
SystemPreferencesManager.setWidgetHistory(historyKey, items); //d41439
|
||||
//updateHistory(); d41439
|
||||
}
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ public class SystemHistoryCombo extends Composite implements ISystemCombo, Trave
|
|||
*/
|
||||
public String[] getHistory()
|
||||
{
|
||||
return SystemPreferencesManager.getPreferencesManager().getWidgetHistory(historyKey);
|
||||
return SystemPreferencesManager.getWidgetHistory(historyKey);
|
||||
}
|
||||
/**
|
||||
* Update the history with current entry field setting, but don't refresh contents.
|
||||
|
@ -477,14 +477,14 @@ public class SystemHistoryCombo extends Composite implements ISystemCombo, Trave
|
|||
++idx2;
|
||||
}
|
||||
}
|
||||
SystemPreferencesManager.getPreferencesManager().setWidgetHistory(historyKey, newHistory);
|
||||
SystemPreferencesManager.setWidgetHistory(historyKey, newHistory);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newHistory =new String[1];
|
||||
newHistory[0] = textValue;
|
||||
SystemPreferencesManager.getPreferencesManager().setWidgetHistory(historyKey, newHistory);
|
||||
SystemPreferencesManager.setWidgetHistory(historyKey, newHistory);
|
||||
}
|
||||
if (refresh && (newHistory != null))
|
||||
{
|
||||
|
@ -513,7 +513,7 @@ public class SystemHistoryCombo extends Composite implements ISystemCombo, Trave
|
|||
*/
|
||||
public void setHistory(String[] newHistory)
|
||||
{
|
||||
SystemPreferencesManager.getPreferencesManager().setWidgetHistory(historyKey, newHistory);
|
||||
SystemPreferencesManager.setWidgetHistory(historyKey, newHistory);
|
||||
}
|
||||
|
||||
// -----------------------
|
||||
|
@ -600,7 +600,7 @@ public class SystemHistoryCombo extends Composite implements ISystemCombo, Trave
|
|||
{
|
||||
String value = historyCombo.getText(); // d41471
|
||||
String[] newHistory = dlg.getHistory();
|
||||
SystemPreferencesManager.getPreferencesManager().setWidgetHistory(historyKey, newHistory);
|
||||
SystemPreferencesManager.setWidgetHistory(historyKey, newHistory);
|
||||
setItems(newHistory);
|
||||
historyCombo.setText(value); // Restore the value d41471
|
||||
}
|
||||
|
|
|
@ -254,7 +254,7 @@ public class SystemHostCombo extends Composite implements ISelectionProvider, IS
|
|||
{
|
||||
this.showNewButton = showNewButton;
|
||||
this.showLabel = showLabel;
|
||||
showQualifiedNames = SystemPreferencesManager.getPreferencesManager().getQualifyConnectionNames();
|
||||
showQualifiedNames = SystemPreferencesManager.getQualifyConnectionNames();
|
||||
//prepareComposite(showNewButton ? 3 : 2);
|
||||
prepareComposite(3);
|
||||
|
||||
|
@ -925,7 +925,7 @@ public class SystemHostCombo extends Composite implements ISelectionProvider, IS
|
|||
{
|
||||
// if RENAME, update showQualifiedNames in case it changed
|
||||
if ( type == EVENT_RENAME )
|
||||
showQualifiedNames = SystemPreferencesManager.getPreferencesManager().getQualifyConnectionNames();
|
||||
showQualifiedNames = SystemPreferencesManager.getQualifyConnectionNames();
|
||||
|
||||
refreshConnections();
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.Hashtable;
|
|||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.jface.wizard.IWizardPage;
|
||||
import org.eclipse.rse.core.IRSEPreferenceNames;
|
||||
import org.eclipse.rse.core.IRSESystemType;
|
||||
import org.eclipse.rse.core.SystemBasePlugin;
|
||||
import org.eclipse.rse.core.model.IHost;
|
||||
|
@ -33,7 +34,6 @@ import org.eclipse.rse.model.DummyHost;
|
|||
import org.eclipse.rse.model.SystemStartHere;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
|
||||
import org.eclipse.rse.ui.ISystemPreferencesConstants;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.SystemConnectionForm;
|
||||
import org.eclipse.rse.ui.SystemResources;
|
||||
|
@ -129,7 +129,7 @@ public class RSEDefaultNewConnectionWizardDelegate extends RSENewConnectionWizar
|
|||
|
||||
SystemStartHere.getSystemProfileManager().getDefaultPrivateSystemProfile();
|
||||
|
||||
RSEUIPlugin.getDefault().getShowProfilePageInitially();
|
||||
// RSEUIPlugin.getShowProfilePage();
|
||||
/* DKM - I don't think we should force profiles into the faces of users
|
||||
* we no longer default to "private" so hopefully this would never be
|
||||
* desirable
|
||||
|
@ -177,7 +177,7 @@ public class RSEDefaultNewConnectionWizardDelegate extends RSENewConnectionWizar
|
|||
{
|
||||
if ((lastProfile == null) && (activeProfileNames!=null))
|
||||
{
|
||||
String defaultTeamName = ISystemPreferencesConstants.DEFAULT_TEAMPROFILE;
|
||||
String defaultTeamName = IRSEPreferenceNames.DEFAULT_TEAMPROFILE;
|
||||
for (int idx=0; (lastProfile==null)&&(idx<activeProfileNames.length); idx++)
|
||||
{
|
||||
if (!activeProfileNames[idx].equals(defaultTeamName))
|
||||
|
|
|
@ -209,8 +209,7 @@ public class Host extends RSEModelObject implements IHost
|
|||
// value (the actual user id) the old keyed entry held.
|
||||
if (oldUserId != null)
|
||||
{
|
||||
SystemPreferencesManager prefMgr = getPreferencesManager();
|
||||
prefMgr.clearUserId(previousUserIdKey);
|
||||
SystemPreferencesManager.clearUserId(previousUserIdKey);
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
@ -230,9 +229,8 @@ public class Host extends RSEModelObject implements IHost
|
|||
String newKey = getPreferencesKey(newName, getAliasName());
|
||||
if ((userIdValue != null) && (userIdValue.length()>0))
|
||||
{
|
||||
SystemPreferencesManager prefMgr = getPreferencesManager();
|
||||
prefMgr.clearUserId(previousUserIdKey);
|
||||
prefMgr.setUserId(newKey, userIdValue); // store old value with new preference key
|
||||
SystemPreferencesManager.clearUserId(previousUserIdKey);
|
||||
SystemPreferencesManager.setUserId(newKey, userIdValue); // store old value with new preference key
|
||||
}
|
||||
previousUserIdKey = newKey;
|
||||
}
|
||||
|
@ -278,9 +276,8 @@ public class Host extends RSEModelObject implements IHost
|
|||
String newKey = getPreferencesKey(getSystemProfileName(), newName);
|
||||
if ((userIdValue != null) && (userIdValue.length()>0))
|
||||
{
|
||||
SystemPreferencesManager prefMgr = getPreferencesManager();
|
||||
prefMgr.clearUserId(previousUserIdKey);
|
||||
prefMgr.setUserId(newKey, userIdValue); // store old value with new preference key
|
||||
SystemPreferencesManager.clearUserId(previousUserIdKey);
|
||||
SystemPreferencesManager.setUserId(newKey, userIdValue); // store old value with new preference key
|
||||
}
|
||||
previousUserIdKey = newKey;
|
||||
}
|
||||
|
@ -338,8 +335,7 @@ public class Host extends RSEModelObject implements IHost
|
|||
String key = getPreferencesKey();
|
||||
if (key != null)
|
||||
{
|
||||
SystemPreferencesManager prefMgr = getPreferencesManager();
|
||||
prefMgr.setUserId(key, newId);
|
||||
SystemPreferencesManager.setUserId(key, newId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -363,8 +359,7 @@ public class Host extends RSEModelObject implements IHost
|
|||
String uid = getLocalDefaultUserId();
|
||||
if ((uid == null) || (uid.length()==0))
|
||||
{
|
||||
SystemPreferencesManager prefMgr = getPreferencesManager();
|
||||
uid = prefMgr.getDefaultUserId(getSystemType()); // resolve from preferences
|
||||
uid = SystemPreferencesManager.getUserId(getSystemType()); // resolve from preferences
|
||||
if ((uid != null) && ucId)
|
||||
uid = uid.toUpperCase();
|
||||
}
|
||||
|
@ -379,8 +374,7 @@ public class Host extends RSEModelObject implements IHost
|
|||
String uid = null;
|
||||
if ((key!=null) && (key.length()>0))
|
||||
{
|
||||
SystemPreferencesManager prefMgr = getPreferencesManager();
|
||||
uid = prefMgr.getUserId(key); // resolve from preferences
|
||||
uid = SystemPreferencesManager.getUserId(key); // resolve from preferences
|
||||
}
|
||||
return uid;
|
||||
}
|
||||
|
@ -403,17 +397,9 @@ public class Host extends RSEModelObject implements IHost
|
|||
public void clearLocalDefaultUserId()
|
||||
{
|
||||
if (previousUserIdKey!=null)
|
||||
getPreferencesManager().clearUserId(previousUserIdKey);
|
||||
SystemPreferencesManager.clearUserId(previousUserIdKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to return preference manager
|
||||
*/
|
||||
protected static SystemPreferencesManager getPreferencesManager()
|
||||
{
|
||||
return SystemPreferencesManager.getPreferencesManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to compute a unique name for a given subsystem instance
|
||||
*/
|
||||
|
|
|
@ -211,6 +211,7 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool
|
|||
addHost(conn); // only record internally if saved successfully
|
||||
conn.setHostPool(this);
|
||||
conn.setAliasName(aliasName);
|
||||
conn.setSystemType(systemType);
|
||||
// if default userID is null, and location is in the connection we should retrieve it and use it as the initial value.
|
||||
if (defaultUserId == null && defaultUserIdLocation == IRSEUserIdConstants.USERID_LOCATION_HOST) {
|
||||
defaultUserId = conn.getDefaultUserId();
|
||||
|
@ -256,13 +257,12 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool
|
|||
if (defaultUserIdLocation != IRSEUserIdConstants.USERID_LOCATION_HOST)
|
||||
{
|
||||
conn.setDefaultUserId(null); // clear what was there, to ensure inheritance
|
||||
SystemPreferencesManager prefMgr = SystemPreferencesManager.getPreferencesManager();
|
||||
boolean forceToUpperCase = conn.getForceUserIdToUpperCase();
|
||||
if (forceToUpperCase && (defaultUserId != null))
|
||||
defaultUserId = defaultUserId.toUpperCase();
|
||||
if (defaultUserIdLocation == IRSEUserIdConstants.USERID_LOCATION_DEFAULT_SYSTEMTYPE)
|
||||
{
|
||||
prefMgr.setDefaultUserId(systemType, defaultUserId);
|
||||
SystemPreferencesManager.setDefaultUserId(systemType, defaultUserId);
|
||||
}
|
||||
//else if (defaultUserIdLocation == IRSEUserIdConstants.USERID_LOCATION_DEFAULT_OVERALL)
|
||||
//{
|
||||
|
|
|
@ -20,13 +20,13 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.rse.core.IRSEPreferenceNames;
|
||||
import org.eclipse.rse.core.RSECorePlugin;
|
||||
import org.eclipse.rse.core.SystemBasePlugin;
|
||||
import org.eclipse.rse.core.SystemPreferencesManager;
|
||||
import org.eclipse.rse.core.model.ISystemProfile;
|
||||
import org.eclipse.rse.core.model.ISystemProfileManager;
|
||||
import org.eclipse.rse.model.SystemStartHere;
|
||||
import org.eclipse.rse.ui.ISystemPreferencesConstants;
|
||||
import org.eclipse.rse.ui.RSEUIPlugin;
|
||||
import org.eclipse.rse.ui.validators.ISystemValidator;
|
||||
import org.eclipse.rse.ui.validators.ValidatorProfileName;
|
||||
|
@ -104,7 +104,7 @@ public class SystemProfileManager implements ISystemProfileManager {
|
|||
|
||||
ISystemProfile newProfile = internalCreateSystemProfileAndFolder(name);
|
||||
if (makeActive) {
|
||||
SystemPreferencesManager.getPreferencesManager().addActiveProfile(name);
|
||||
SystemPreferencesManager.addActiveProfile(name);
|
||||
((SystemProfile) newProfile).setActive(makeActive);
|
||||
}
|
||||
RSEUIPlugin.getThePersistenceManager().commit(this);
|
||||
|
@ -117,8 +117,8 @@ public class SystemProfileManager implements ISystemProfileManager {
|
|||
public void makeSystemProfileActive(ISystemProfile profile, boolean makeActive) {
|
||||
boolean wasActive = isSystemProfileActive(profile.getName());
|
||||
if (wasActive && !makeActive)
|
||||
SystemPreferencesManager.getPreferencesManager().deleteActiveProfile(profile.getName());
|
||||
else if (makeActive && !wasActive) SystemPreferencesManager.getPreferencesManager().addActiveProfile(profile.getName());
|
||||
SystemPreferencesManager.deleteActiveProfile(profile.getName());
|
||||
else if (makeActive && !wasActive) SystemPreferencesManager.addActiveProfile(profile.getName());
|
||||
((SystemProfile) profile).setActive(makeActive);
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ public class SystemProfileManager implements ISystemProfileManager {
|
|||
if (!defaultProfileExist) {
|
||||
for (int idx = 0; (!defaultProfileExist) && (idx < profiles.size()); idx++) {
|
||||
ISystemProfile profile = (ISystemProfile) profiles.get(idx);
|
||||
if (!profile.getName().equalsIgnoreCase(ISystemPreferencesConstants.DEFAULT_TEAMPROFILE)) {
|
||||
if (!profile.getName().equalsIgnoreCase(IRSEPreferenceNames.DEFAULT_TEAMPROFILE)) {
|
||||
profile.setDefaultPrivate(true);
|
||||
|
||||
RSEUIPlugin.getThePersistenceManager().commit(SystemStartHere.getSystemProfileManager());
|
||||
|
@ -259,7 +259,7 @@ public class SystemProfileManager implements ISystemProfileManager {
|
|||
boolean isActive = isSystemProfileActive(profile.getName());
|
||||
String oldName = profile.getName();
|
||||
profile.setName(newName);
|
||||
if (isActive) SystemPreferencesManager.getPreferencesManager().renameActiveProfile(oldName, newName);
|
||||
if (isActive) SystemPreferencesManager.renameActiveProfile(oldName, newName);
|
||||
invalidateCache();
|
||||
// FIXME RSEUIPlugin.getThePersistenceManager().save(this);
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ public class SystemProfileManager implements ISystemProfileManager {
|
|||
* if (res != null)
|
||||
* res.getContents().remove(profile);
|
||||
*/
|
||||
if (isActive) SystemPreferencesManager.getPreferencesManager().deleteActiveProfile(oldName);
|
||||
if (isActive) SystemPreferencesManager.deleteActiveProfile(oldName);
|
||||
invalidateCache();
|
||||
if (persist) {
|
||||
RSEUIPlugin.getThePersistenceManager().deleteProfile(oldName);
|
||||
|
@ -322,7 +322,7 @@ public class SystemProfileManager implements ISystemProfileManager {
|
|||
* @see org.eclipse.rse.core.model.ISystemProfileManager#getActiveSystemProfileNames()
|
||||
*/
|
||||
public String[] getActiveSystemProfileNames() {
|
||||
String[] activeProfileNames = SystemPreferencesManager.getPreferencesManager().getActiveProfileNames();
|
||||
String[] activeProfileNames = SystemPreferencesManager.getActiveProfiles();
|
||||
// dy: defect 48355, need to sync this with the actual profile list. If the user
|
||||
// imports old preference settings or does a team sync and a profile is deleted then
|
||||
// it is possible an active profile no longer exists.
|
||||
|
@ -339,7 +339,7 @@ public class SystemProfileManager implements ISystemProfileManager {
|
|||
String activeProfileName = activeProfileNames[activeIdx];
|
||||
if (activeProfileName.equals(defaultProfileName)) {
|
||||
found_private = true;
|
||||
} else if (activeProfileName.equals(ISystemPreferencesConstants.DEFAULT_TEAMPROFILE)) {
|
||||
} else if (activeProfileName.equals(IRSEPreferenceNames.DEFAULT_TEAMPROFILE)) {
|
||||
found_team = true;
|
||||
} else {
|
||||
found = false;
|
||||
|
@ -351,7 +351,7 @@ public class SystemProfileManager implements ISystemProfileManager {
|
|||
|
||||
if (!found) {
|
||||
// The active profile no longer exists so remove it from the active list
|
||||
SystemPreferencesManager.getPreferencesManager().deleteActiveProfile(activeProfileNames[activeIdx]);
|
||||
SystemPreferencesManager.deleteActiveProfile(activeProfileNames[activeIdx]);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
@ -370,9 +370,9 @@ public class SystemProfileManager implements ISystemProfileManager {
|
|||
}
|
||||
if (!matchesBoth && found_private) {
|
||||
if (systemProfiles[systemIdx].isActive() || systemProfiles[systemIdx].isDefaultPrivate()) {
|
||||
SystemPreferencesManager.getPreferencesManager().addActiveProfile(name);
|
||||
SystemPreferencesManager.getPreferencesManager().deleteActiveProfile(RSECorePlugin.getLocalMachineName());
|
||||
activeProfileNames = SystemPreferencesManager.getPreferencesManager().getActiveProfileNames();
|
||||
SystemPreferencesManager.addActiveProfile(name);
|
||||
SystemPreferencesManager.deleteActiveProfile(RSECorePlugin.getLocalMachineName());
|
||||
activeProfileNames = SystemPreferencesManager.getActiveProfiles();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -384,24 +384,24 @@ public class SystemProfileManager implements ISystemProfileManager {
|
|||
// First time user, make sure default is in the active list, the only time it wouldn't
|
||||
// be is if the pref_store.ini was modified (because the user imported old preferences)
|
||||
if (!found_team) {
|
||||
SystemPreferencesManager.getPreferencesManager().addActiveProfile(ISystemPreferencesConstants.DEFAULT_TEAMPROFILE);
|
||||
SystemPreferencesManager.addActiveProfile(IRSEPreferenceNames.DEFAULT_TEAMPROFILE);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (!found_private) {
|
||||
SystemPreferencesManager.getPreferencesManager().addActiveProfile(RSECorePlugin.getLocalMachineName());
|
||||
SystemPreferencesManager.addActiveProfile(RSECorePlugin.getLocalMachineName());
|
||||
changed = true;
|
||||
}
|
||||
} else {
|
||||
ISystemProfile defaultProfile = getDefaultPrivateSystemProfile();
|
||||
if (defaultProfile != null && !found_private) {
|
||||
SystemPreferencesManager.getPreferencesManager().addActiveProfile(defaultProfile.getName());
|
||||
SystemPreferencesManager.addActiveProfile(defaultProfile.getName());
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
activeProfileNames = SystemPreferencesManager.getPreferencesManager().getActiveProfileNames();
|
||||
activeProfileNames = SystemPreferencesManager.getActiveProfiles();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -412,7 +412,7 @@ public class SystemProfileManager implements ISystemProfileManager {
|
|||
* @return the profile names currently selected by the user as "active" profiles
|
||||
*/
|
||||
public Vector getActiveSystemProfileNamesVector() {
|
||||
String[] profileNames = SystemPreferencesManager.getPreferencesManager().getActiveProfileNames();
|
||||
String[] profileNames = SystemPreferencesManager.getActiveProfiles();
|
||||
Vector v = new Vector(profileNames.length);
|
||||
for (int idx = 0; idx < profileNames.length; idx++)
|
||||
v.addElement(profileNames[idx]);
|
||||
|
@ -442,7 +442,7 @@ public class SystemProfileManager implements ISystemProfileManager {
|
|||
* @see org.eclipse.rse.core.model.ISystemProfileManager#getDefaultTeamSystemProfile()
|
||||
*/
|
||||
public ISystemProfile getDefaultTeamSystemProfile() {
|
||||
return getSystemProfile(ISystemPreferencesConstants.DEFAULT_TEAMPROFILE);
|
||||
return getSystemProfile(IRSEPreferenceNames.DEFAULT_TEAMPROFILE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -681,14 +681,14 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven
|
|||
*/
|
||||
public boolean getQualifiedHostNames()
|
||||
{
|
||||
return SystemPreferencesManager.getPreferencesManager().getQualifyConnectionNames();
|
||||
return SystemPreferencesManager.getQualifyConnectionNames();
|
||||
}
|
||||
/**
|
||||
* Set if connection names are to be qualified by profile name
|
||||
*/
|
||||
public void setQualifiedHostNames(boolean set)
|
||||
{
|
||||
SystemPreferencesManager.getPreferencesManager().setQualifyConnectionNames(set);
|
||||
SystemPreferencesManager.setQualifyConnectionNames(set);
|
||||
IHost[] conns = getHosts();
|
||||
if (conns != null)
|
||||
{
|
||||
|
@ -697,7 +697,7 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven
|
|||
fireEvent(new SystemResourceChangeEvent(conns[idx], ISystemResourceChangeEvents.EVENT_RENAME, this));
|
||||
}
|
||||
}
|
||||
if (SystemPreferencesManager.getPreferencesManager().getShowFilterPools())
|
||||
if (SystemPreferencesManager.getShowFilterPools())
|
||||
{
|
||||
fireEvent(new SystemResourceChangeEvent(this, ISystemResourceChangeEvents.EVENT_REFRESH, this));
|
||||
}
|
||||
|
@ -892,7 +892,7 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven
|
|||
ssf.renameSubSystemProfile(ss, oldName, newName);
|
||||
}
|
||||
}
|
||||
SystemPreferencesManager.getPreferencesManager().setConnectionNamesOrder(); // update preferences order list
|
||||
SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list
|
||||
boolean namesQualifed = getQualifiedHostNames();
|
||||
if (namesQualifed)
|
||||
setQualifiedHostNames(namesQualifed); // causes refresh events to be fired
|
||||
|
@ -1072,7 +1072,7 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven
|
|||
}
|
||||
// last step... physically blow away the profile...
|
||||
getSystemProfileManager().deleteSystemProfile(profile, true);
|
||||
SystemPreferencesManager.getPreferencesManager().setConnectionNamesOrder(); // update preferences order list
|
||||
SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list
|
||||
if (connections.length > 0) // defect 42112
|
||||
fireEvent(new org.eclipse.rse.model.SystemResourceChangeEvent(connections, ISystemResourceChangeEvents.EVENT_DELETE_MANY, this));
|
||||
|
||||
|
@ -1166,7 +1166,7 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven
|
|||
SystemResourceChangeEvent event = new org.eclipse.rse.model.SystemResourceChangeEvent(affectedConnections, ISystemResourceChangeEvents.EVENT_ADD_MANY, this);
|
||||
fireEvent(event);
|
||||
}
|
||||
SystemPreferencesManager.getPreferencesManager().setConnectionNamesOrder(); // update preferences order list
|
||||
SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list
|
||||
|
||||
fireModelChangeEvent(SYSTEM_RESOURCE_CHANGED, SYSTEM_RESOURCETYPE_PROFILE, profile, null);
|
||||
}
|
||||
|
@ -2250,7 +2250,7 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven
|
|||
|
||||
}
|
||||
RSEUIPlugin.getThePersistenceManager().commit(conn);
|
||||
SystemPreferencesManager.getPreferencesManager().setConnectionNamesOrder(); // update preferences order list
|
||||
SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list
|
||||
|
||||
|
||||
return conn;
|
||||
|
@ -2555,7 +2555,7 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven
|
|||
((ISubSystemConfiguration) affectedSubSystemFactories.elementAt(idx)).deleteSubSystemsByConnection(conn);
|
||||
}
|
||||
conn.getHostPool().deleteHost(conn); // delete from memory and from disk.
|
||||
SystemPreferencesManager.getPreferencesManager().setConnectionNamesOrder(); // update preferences order list
|
||||
SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list
|
||||
fireModelChangeEvent(SYSTEM_RESOURCE_REMOVED, SYSTEM_RESOURCETYPE_CONNECTION, conn, null);
|
||||
}
|
||||
|
||||
|
@ -2580,7 +2580,7 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven
|
|||
for (int idx = 0; idx < affectedSubSystemFactories.size(); idx++)
|
||||
((ISubSystemConfiguration) affectedSubSystemFactories.elementAt(idx)).renameSubSystemsByConnection(conn, newName);
|
||||
conn.getHostPool().renameHost(conn, newName); // rename in memory and disk
|
||||
SystemPreferencesManager.getPreferencesManager().setConnectionNamesOrder(); // update preferences order list
|
||||
SystemPreferencesManager.setConnectionNamesOrder(); // update preferences order list
|
||||
fireModelChangeEvent(SYSTEM_RESOURCE_RENAMED, SYSTEM_RESOURCETYPE_CONNECTION, conn, oldName);
|
||||
}
|
||||
|
||||
|
@ -2601,7 +2601,7 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven
|
|||
{
|
||||
ISystemHostPool pool = getHostPool(profileName);
|
||||
pool.moveHosts(conns, delta);
|
||||
SystemPreferencesManager.getPreferencesManager().setConnectionNamesOrder();
|
||||
SystemPreferencesManager.setConnectionNamesOrder();
|
||||
//fireEvent(new SystemResourceChangeEvent(pool.getSystemConnections(),ISystemResourceChangeEvent.EVENT_MOVE_MANY,this));
|
||||
SystemResourceChangeEvent event = new SystemResourceChangeEvent(conns, ISystemResourceChangeEvents.EVENT_MOVE_MANY, this);
|
||||
event.setPosition(delta);
|
||||
|
|
|
@ -255,9 +255,8 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
|||
String newKey = getPreferencesKey(newName, getHostAliasName());
|
||||
if ((userIdValue != null) && (userIdValue.length()>0))
|
||||
{
|
||||
SystemPreferencesManager prefMgr = getPreferencesManager();
|
||||
prefMgr.clearUserId(previousUserIdKey);
|
||||
prefMgr.setUserId(newKey, userIdValue); // store old value with new preference key
|
||||
SystemPreferencesManager.clearUserId(previousUserIdKey);
|
||||
SystemPreferencesManager.setUserId(newKey, userIdValue); // store old value with new preference key
|
||||
}
|
||||
previousUserIdKey = newKey;
|
||||
|
||||
|
@ -304,9 +303,8 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
|||
String newKey = getPreferencesKey(getSystemProfileName(), newName);
|
||||
if ((userIdValue != null) && (userIdValue.length()>0))
|
||||
{
|
||||
SystemPreferencesManager prefMgr = getPreferencesManager();
|
||||
prefMgr.clearUserId(previousUserIdKey);
|
||||
prefMgr.setUserId(newKey, userIdValue); // store old value with new preference key
|
||||
SystemPreferencesManager.clearUserId(previousUserIdKey);
|
||||
SystemPreferencesManager.setUserId(newKey, userIdValue); // store old value with new preference key
|
||||
}
|
||||
previousUserIdKey = newKey;
|
||||
|
||||
|
@ -341,8 +339,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
|||
// value (the actual user id) the old keyed entry held.
|
||||
if (oldUserId != null)
|
||||
{
|
||||
SystemPreferencesManager prefMgr = getPreferencesManager();
|
||||
prefMgr.clearUserId(previousUserIdKey);
|
||||
SystemPreferencesManager.clearUserId(previousUserIdKey);
|
||||
}
|
||||
// delete the connection-private filter pool, if it exists:
|
||||
ISystemFilterPool privatePool = getConnectionPrivateFilterPool(false); // false => don't create if not found
|
||||
|
@ -384,14 +381,6 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
|||
return uid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to return preference manager
|
||||
*/
|
||||
protected SystemPreferencesManager getPreferencesManager()
|
||||
{
|
||||
return SystemPreferencesManager.getPreferencesManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to compute a unique name for a given subsystem instance
|
||||
*/
|
||||
|
@ -419,8 +408,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
|||
String uid = null;
|
||||
if ((key!=null) && (key.length()>0))
|
||||
{
|
||||
SystemPreferencesManager prefMgr = getPreferencesManager();
|
||||
uid = prefMgr.getUserId(key); // resolve from preferences
|
||||
uid = SystemPreferencesManager.getUserId(key); // resolve from preferences
|
||||
}
|
||||
return uid;
|
||||
}
|
||||
|
@ -456,7 +444,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
|
|||
public void clearLocalUserId()
|
||||
{
|
||||
if (previousUserIdKey != null)
|
||||
getPreferencesManager().clearUserId(previousUserIdKey);
|
||||
SystemPreferencesManager.clearUserId(previousUserIdKey);
|
||||
IConnectorService system = getConnectorService();
|
||||
if (system != null)
|
||||
system.clearUserIdCache();
|
||||
|
|
|
@ -585,7 +585,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
|
|||
*/
|
||||
public boolean showFilterPools()
|
||||
{
|
||||
return SystemPreferencesManager.getPreferencesManager().getShowFilterPools();
|
||||
return SystemPreferencesManager.getShowFilterPools();
|
||||
}
|
||||
/*
|
||||
* If we support filters, should we show filter strings in the remote system explorer?
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -17,6 +17,7 @@ import org.eclipse.rse.tests.core.connection.RSEConnectionTestSuite;
|
|||
import org.eclipse.rse.tests.core.registries.RSERegistriesTestSuite;
|
||||
import org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder;
|
||||
import org.eclipse.rse.tests.internal.RSEInternalFrameworkTestSuite;
|
||||
import org.eclipse.rse.tests.preferences.RSEPreferencesTestSuite;
|
||||
import org.eclipse.rse.tests.subsystems.files.RSEFileSubsystemTestSuite;
|
||||
import org.eclipse.rse.tests.subsystems.testsubsystem.RSETestSubsystemTestSuite;
|
||||
|
||||
|
@ -56,7 +57,8 @@ public class RSECombinedTestSuite extends DelegatingTestSuiteHolder {
|
|||
suite.addTest(RSEConnectionTestSuite.suite());
|
||||
suite.addTest(RSEFileSubsystemTestSuite.suite());
|
||||
suite.addTest(RSETestSubsystemTestSuite.suite());
|
||||
|
||||
suite.addTest(RSEPreferencesTestSuite.suite());
|
||||
|
||||
return suite;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
/* ******************************************************************************
|
||||
* Copyright (c) 2006 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
|
||||
*
|
||||
* Contributors:
|
||||
* David Dykstal (IBM) - initial API and implementation.
|
||||
* David McKnight (IBM) - initial API and implementation.
|
||||
* Kushal Munir (IBM) - initial API and implementation.
|
||||
* ******************************************************************************/
|
||||
|
||||
package org.eclipse.rse.tests.preferences;
|
||||
|
||||
import org.eclipse.rse.core.IRSECoreRegistry;
|
||||
import org.eclipse.rse.core.IRSESystemType;
|
||||
import org.eclipse.rse.core.RSECorePlugin;
|
||||
import org.eclipse.rse.core.SystemPreferencesManager;
|
||||
import org.eclipse.rse.tests.core.RSECoreTestCase;
|
||||
|
||||
/**
|
||||
* Tests for {@link SystemPreferencesManager}.
|
||||
*/
|
||||
public class PreferencesTest extends RSECoreTestCase {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
|
||||
*/
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
|
||||
*/
|
||||
protected void tearDown() throws Exception {
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public void testActiveProfiles() {
|
||||
SystemPreferencesManager.addActiveProfile("bogus01"); //$NON-NLS-1$
|
||||
SystemPreferencesManager.addActiveProfile("bogus02"); //$NON-NLS-1$
|
||||
String[] profiles = SystemPreferencesManager.getActiveProfiles();
|
||||
assertTrue(profiles.length >= 2);
|
||||
assertEquals("bogus02", profiles[SystemPreferencesManager.getActiveProfilePosition("bogus02")]); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
assertEquals("bogus01", profiles[SystemPreferencesManager.getActiveProfilePosition("bogus01")]); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
SystemPreferencesManager.renameActiveProfile("bogus02", "bogus99"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
profiles = SystemPreferencesManager.getActiveProfiles();
|
||||
assertEquals("bogus99", profiles[SystemPreferencesManager.getActiveProfilePosition("bogus99")]); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
SystemPreferencesManager.deleteActiveProfile("bogus01"); //$NON-NLS-1$
|
||||
SystemPreferencesManager.deleteActiveProfile("bogus99"); //$NON-NLS-1$
|
||||
assertEquals(-1, SystemPreferencesManager.getActiveProfilePosition("bogus02")); //$NON-NLS-1$
|
||||
assertEquals(-1, SystemPreferencesManager.getActiveProfilePosition("bogus01")); //$NON-NLS-1$
|
||||
assertEquals(-1, SystemPreferencesManager.getActiveProfilePosition("bogus99")); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public void testUserIds() {
|
||||
SystemPreferencesManager.setUserId("a.b.c", "bogusUser"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
assertEquals("bogusUser", SystemPreferencesManager.getUserId("a.b.c")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
SystemPreferencesManager.clearUserId("a.b.c"); //$NON-NLS-1$
|
||||
assertNull(SystemPreferencesManager.getUserId("a.b.c")); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public void testDefaultUserIds() {
|
||||
IRSECoreRegistry registry = RSECorePlugin.getDefault().getRegistry();
|
||||
IRSESystemType systemType = registry.getSystemType("Local"); //$NON-NLS-1$
|
||||
String oldValue = SystemPreferencesManager.getDefaultUserId(systemType);
|
||||
SystemPreferencesManager.setDefaultUserId(systemType, "bogus1"); //$NON-NLS-1$
|
||||
assertEquals("bogus1", SystemPreferencesManager.getDefaultUserId(systemType)); //$NON-NLS-1$
|
||||
SystemPreferencesManager.setDefaultUserId("Local", "bogus2"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
assertEquals("bogus2", SystemPreferencesManager.getDefaultUserId(systemType)); //$NON-NLS-1$
|
||||
SystemPreferencesManager.setDefaultUserId(systemType, oldValue);
|
||||
assertEquals(oldValue, SystemPreferencesManager.getDefaultUserId(systemType));
|
||||
}
|
||||
|
||||
public void testShowLocalConnection() {
|
||||
assertTrue(SystemPreferencesManager.getShowLocalConnection());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006 Wind River Systems, Inc. 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:
|
||||
* Martin Oberhuber (Wind River) - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.rse.tests.preferences;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
import org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder;
|
||||
|
||||
public class RSEPreferencesTestSuite extends DelegatingTestSuiteHolder {
|
||||
/**
|
||||
* Standard Java application main method. Allows to launch the test
|
||||
* suite from outside as part of nightly runs, headless runs or other.
|
||||
* <p><b>Note:</b> Use only <code>junit.textui.TestRunner</code> here as
|
||||
* it is explicitly supposed to output the test output to the shell the
|
||||
* test suite has been launched from.
|
||||
* <p>
|
||||
* @param args The standard Java application command line parameters passed in.
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
junit.textui.TestRunner.run(suite());
|
||||
}
|
||||
|
||||
/**
|
||||
* Combine all test into a suite and returns the test suite instance.
|
||||
* <p>
|
||||
* <b>Note: This method must be always called <i><code>suite</code></i> ! Otherwise
|
||||
* the JUnit plug-in test launcher will fail to detect this class!</b>
|
||||
* <p>
|
||||
* @return The test suite instance.
|
||||
*/
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite("RSE Preferences Test Suite"); //$NON-NLS-1$
|
||||
// add the single test suites to the overall one here.
|
||||
suite.addTestSuite(PreferencesTest.class);
|
||||
return suite;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getTestSuite()
|
||||
*/
|
||||
public TestSuite getTestSuite() {
|
||||
return (TestSuite)RSEPreferencesTestSuite.suite();
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue