Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Dykstal2007-02-18 19:26:35 +0000
committerDavid Dykstal2007-02-18 19:26:35 +0000
commit0afcc3b31a2d48ebbfafb82e28f784edd7bd2e0e (patch)
tree904253fe41c0bc40e74f9982bacc9cb5cb7689a7
parent81d2c5fae06dbf2cd96e27af52136906b6c9eb5e (diff)
downloadorg.eclipse.tm-0afcc3b31a2d48ebbfafb82e28f784edd7bd2e0e.tar.gz
org.eclipse.tm-0afcc3b31a2d48ebbfafb82e28f784edd7bd2e0e.tar.xz
org.eclipse.tm-0afcc3b31a2d48ebbfafb82e28f784edd7bd2e0e.zip
[168870][refactor] stage 4, created RSEPreferencesManager and moved SystemPreferencesManager from core to ui package.
-rw-r--r--rse/plugins/org.eclipse.rse.core/plugin.xml6
-rw-r--r--rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSEPreferenceNames.java34
-rw-r--r--rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/PasswordPersistenceManager.java17
-rw-r--r--rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSECorePlugin.java20
-rw-r--r--rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSEHostUtil.java24
-rw-r--r--rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSEPreferencesManager.java491
-rw-r--r--rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/SystemResourceConstants.java6
-rw-r--r--rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/internal/RSEPreferenceInitializer.java21
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemQualifiedRemoteFolderCombo.java6
-rw-r--r--rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemRemoteFolderCombo.java4
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/PreferencesMapper.java194
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewColumnManager.java6
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewPart.java5
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewConnectionAdapter.java9
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterReferenceAdapter.java6
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPart.java4
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewRootInputAdapter.java6
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSESystemTypeAdapter.java13
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java3
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemConnectionForm.java11
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPreferencesManager.java (renamed from rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPreferencesManager.java)493
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceRestoreStateAction.java6
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceShowFilterPoolsAction.java4
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPromptDialog.java8
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/RemoteSystemsPreferencePage.java18
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTypeFieldEditor.java11
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHistoryCombo.java8
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHostCombo.java32
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/RSEDefaultNewConnectionWizardDelegate.java9
-rw-r--r--rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/Host.java25
-rw-r--r--rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemHostPool.java11
-rw-r--r--rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemProfileManager.java71
-rw-r--r--rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRegistry.java5
-rw-r--r--rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystem.java19
-rw-r--r--rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystemConfiguration.java21
-rw-r--r--rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/preferences/PreferencesTest.java55
36 files changed, 997 insertions, 685 deletions
diff --git a/rse/plugins/org.eclipse.rse.core/plugin.xml b/rse/plugins/org.eclipse.rse.core/plugin.xml
index e970efccb..b3bf6c944 100644
--- a/rse/plugins/org.eclipse.rse.core/plugin.xml
+++ b/rse/plugins/org.eclipse.rse.core/plugin.xml
@@ -27,5 +27,11 @@
id="org.eclipse.rse.persistence.PropertyFileProvider"
name="Property File Persistence Provider"/>
</extension>
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.eclipse.rse.core.internal.RSEPreferenceInitializer">
+ </initializer>
+ </extension>
</plugin>
diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSEPreferenceNames.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSEPreferenceNames.java
index e0f497935..61a26349b 100644
--- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSEPreferenceNames.java
+++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSEPreferenceNames.java
@@ -1,11 +1,12 @@
/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2006, 2007 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:
* Kushal Munir (IBM) - Initial API and implementation.
+ * David Dykstal (IBM) - updated with comments, removed keys that are not to be used globally
********************************************************************************/
package org.eclipse.rse.core;
@@ -13,22 +14,25 @@ package org.eclipse.rse.core;
* These constants define the set of preference names that the RSE core uses.
*/
public interface IRSEPreferenceNames {
- /*
- * core preference keys
+ /**
+ * The key for the value that specifies that queries should be "deferred", that is, run
+ * when needed and in the background, as nodes are asked for their children.
+ */
+ public static final String USE_DEFERRED_QUERIES = "useDeferredQueries"; //$NON-NLS-1$
+ /**
+ * The key for the default system type. Used when a system type is needed but not declared
+ * when creating new connections (hosts) and for password determination.
*/
- 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$
+ /**
+ * The key for an hash table, encoded as a string, that contains user ids as values
+ * keyed by some key - usually a system type, a connection name, or a combination of
+ * a connection name and subsystem.
+ */
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
+ /**
+ * The key for the string containing the list of active user profiles in alphabetical order.
+ * As profiles are activated, deactivated, or renamed this string must be modified.
*/
- 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$
+ public static final String ACTIVEUSERPROFILES = "activeuserprofiles"; //$NON-NLS-1$
}
diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/PasswordPersistenceManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/PasswordPersistenceManager.java
index 4ac867918..4b8f38aec 100644
--- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/PasswordPersistenceManager.java
+++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/PasswordPersistenceManager.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2002, 2007 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
@@ -11,7 +11,8 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - moved from core package in the UI plugin
+ * - updated to use new RSEPreferencesManager
********************************************************************************/
package org.eclipse.rse.core;
@@ -27,7 +28,6 @@ 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.core.runtime.Preferences;
import org.eclipse.rse.core.model.SystemSignonInformation;
@@ -410,8 +410,8 @@ public class PasswordPersistenceManager {
// uid matches, check if hosts are the same
if (khostname.startsWith(phostname) || phostname.startsWith(khostname))
{
- String qkhost = RSEHostUtil.getQualifiedHostName(khostname);
- String qphost = RSEHostUtil.getQualifiedHostName(phostname);
+ String qkhost = RSECorePlugin.getQualifiedHostName(khostname);
+ String qphost = RSECorePlugin.getQualifiedHostName(phostname);
if (qkhost.equals(qphost))
{
password = (String)passwords.get(key);
@@ -460,8 +460,8 @@ public class PasswordPersistenceManager {
// uid matches, check if hosts are the same
if (khostname.startsWith(phostname) || phostname.startsWith(khostname))
{
- String qkhost = RSEHostUtil.getQualifiedHostName(khostname);
- String qphost = RSEHostUtil.getQualifiedHostName(phostname);
+ String qkhost = RSECorePlugin.getQualifiedHostName(khostname);
+ String qphost = RSECorePlugin.getQualifiedHostName(phostname);
if (qkhost.equals(qphost))
{
password = (String)passwords.get(key);
@@ -545,8 +545,7 @@ public class PasswordPersistenceManager {
{
if (DEFAULT_SYSTEM_TYPE.equals(systemType))
{
- Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
- systemType = store.getString(IRSEPreferenceNames.SYSTEMTYPE);
+ systemType = RSEPreferencesManager.getSystemType();
}
// First find the correct provider
diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSECorePlugin.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSECorePlugin.java
index c131183e9..35bc7ecb0 100644
--- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSECorePlugin.java
+++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSECorePlugin.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2006, 2007 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
@@ -11,7 +11,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - added utility method for finding qualifiedHostNames
********************************************************************************/
package org.eclipse.rse.core;
@@ -55,7 +55,7 @@ public class RSECorePlugin extends Plugin {
public static IRSEPersistenceManager getThePersistenceManager() {
return getDefault().getPersistenceManager();
}
-
+
/**
* @return the IP host name of this machine
*/
@@ -83,6 +83,18 @@ public class RSECorePlugin extends Plugin {
}
/**
+ * 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;
+ }
+ }
+
+ /**
* The constructor. This may be called only by plugin activation.
*/
public RSECorePlugin() {
@@ -151,7 +163,7 @@ public class RSECorePlugin extends Plugin {
public IRSECoreRegistry getRegistry() {
return RSECoreRegistry.getDefault();
}
-
+
/**
* Returns an instance of the logger being used by the core. All core services, or extensions to
* core services, should use this logger to log any messages. The RSE logger provides run-time
diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSEHostUtil.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSEHostUtil.java
deleted file mode 100644
index ec0dbd6bb..000000000
--- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSEHostUtil.java
+++ /dev/null
@@ -1,24 +0,0 @@
-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;
- }
- }
-}
diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSEPreferencesManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSEPreferencesManager.java
new file mode 100644
index 000000000..e78efc104
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSEPreferencesManager.java
@@ -0,0 +1,491 @@
+/********************************************************************************
+ * Copyright (c) 2007 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
+ ********************************************************************************/
+package org.eclipse.rse.core;
+
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.SortedSet;
+import java.util.StringTokenizer;
+import java.util.TreeSet;
+
+import org.eclipse.core.runtime.Preferences;
+
+public class RSEPreferencesManager {
+
+ /**
+ * Used as a suffix when combined with the system type name to produce the key for the enabled value.
+ */
+ private static final String ST_ENABLED = "systemType.enabled"; //$NON-NLS-1$
+ /**
+ * Used as a suffix when combined with the system type name to produce the key for the default user id value.
+ */
+ private static final String ST_DEFAULT_USERID = "systemType.defaultUserId"; //$NON-NLS-1$
+ /**
+ * The default value for using deferred queries. Value is <code>true</code>.
+ */
+ private static final boolean DEFAULT_USE_DEFERRED_QUERIES = true;
+ /**
+ * The default value for the name of the team profile. Value is "Team".
+ */
+ private static final String DEFAULT_TEAMPROFILE = "Team"; //$NON-NLS-1$
+ /**
+ * The default value for the list of active user profiles. Value is "Team".
+ */
+ private static final String DEFAULT_ACTIVEUSERPROFILES = "Team"; //$NON-NLS-1$
+ /**
+ * The default value for the default system type. Value is "".
+ */
+ private static final String DEFAULT_SYSTEMTYPE = ""; //$NON-NLS-1$
+
+ /**
+ * @return the Hashtable where the key is a string identifying a particular object, and
+ * the value is the user ID for that object.
+ * @see #setUserId(String, String)
+ */
+ private static Hashtable getUserIds() {
+ Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
+ Hashtable userIds = null;
+ String value = store.getString(IRSEPreferenceNames.USERIDPERKEY);
+ if (value != null) {
+ userIds = parseString(value);
+ } else {
+ userIds = new Hashtable();
+ }
+ return userIds;
+ }
+
+ /**
+ * Store the user ids that are saved keyed by some key.
+ * @param userIds A Hashtable of userids.
+ * @see #setUserId(String, String)
+ */
+ private static void setUserIds(Hashtable userIds) {
+ Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
+ String userIdsString = makeString(userIds);
+ store.setValue(IRSEPreferenceNames.USERIDPERKEY, userIdsString);
+ savePreferences();
+ }
+
+ /**
+ * Retrieves a user id given a key.
+ * @param key the key from which to get the particular user id.
+ * @return user ID for the given key or null if the key was not found.
+ * @see #setUserId(String, String)
+ */
+ public static String getUserId(String key) {
+ String uid = null;
+ Hashtable userIds = getUserIds();
+ uid = (String) userIds.get(key);
+ return uid;
+ }
+
+ /**
+ * Clears the user ID for the given key.
+ * @param key the key for the user id.
+ * @see #setUserId(String, String)
+ */
+ public static void clearUserId(String key) {
+ Hashtable userIds = getUserIds();
+ if (userIds.containsKey(key)) {
+ userIds.remove(key);
+ setUserIds(userIds);
+ }
+ }
+
+ /**
+ * Sets the user Id for this key.
+ * The key typically designates a scope for this userid so that a hierarchy
+ * of user ids can be maintained for inheritance.
+ * For example, hosts have greater scope than subsystems.
+ * A key would typically be <profile-name>.<host-name>,
+ * or <profile-name>.<host-type>,
+ * or <profile-name>.<host-name>.<subsystem-name>.
+ * @param key the key used to find the userId
+ * @param userId the userId to retrieve by this key.
+ */
+ public static void setUserId(String key, String userId) {
+ if ((key != null) && (userId != null)) {
+ Hashtable userIds = getUserIds();
+ String storedUserId = (String) userIds.get(key);
+ if (storedUserId == null || !storedUserId.equals(userId)) { // don't bother updating if its already there
+ userIds.put(key, userId);
+ setUserIds(userIds);
+ }
+ }
+ }
+
+ /**
+ * Gets the default user id for a given system type.
+ * @param systemType the systemtype for which to retrieve the default user id
+ * @return The default user id
+ */
+ public static String getDefaultUserId(IRSESystemType systemType) {
+ Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
+ String key = getSystemTypePreferencesKey(systemType, RSEPreferencesManager.ST_DEFAULT_USERID);
+ if (!store.contains(key)) {
+ store.setDefault(key, System.getProperty("user.name")); //$NON-NLS-1$
+ }
+ String result = store.getString(key);
+ return result;
+ }
+
+ /**
+ * Sets the default userId for the given system type.
+ * @param systemTypeName the name of the system type
+ * @param userId the default user id for this system type.
+ * This may be null to "unset" the default.
+ */
+ public static void setDefaultUserId(String systemTypeName, String userId) {
+ IRSESystemType systemType = RSECorePlugin.getDefault().getRegistry().getSystemType(systemTypeName);
+ if (systemType != null) {
+ setDefaultUserId(systemType, userId);
+ }
+ }
+
+ /**
+ * Sets the default userId for the given system type.
+ * @param systemType the system type for which to set the default
+ * @param userId the default user id for this system type.
+ * This may be null to "unset" the default.
+ */
+ public static void setDefaultUserId(IRSESystemType systemType, String userId) {
+ Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
+ String key = getSystemTypePreferencesKey(systemType, RSEPreferencesManager.ST_DEFAULT_USERID);
+ store.setValue(key, userId);
+ savePreferences();
+ }
+
+ /**
+ * Gets the system type values table for editing. This is a synthesized preference
+ * that is handled as a single value. Rows are separated by semi-colons.
+ * Each row is of the format <systemTypeName>=<enabled>+<defaultUserId>;
+ * @return the table of system types formatted as a single string
+ */
+ public static String getSystemTypeValues() {
+ IRSESystemType[] systemTypes = RSECorePlugin.getDefault().getRegistry().getSystemTypes();
+ StringBuffer buffer = new StringBuffer(100);
+ for (int i = 0; i < systemTypes.length; i++) {
+ IRSESystemType systemType = systemTypes[i];
+ buffer.append(systemType.getName());
+ buffer.append('=');
+ buffer.append(getIsSystemTypeEnabled(systemType));
+ buffer.append('+');
+ buffer.append(getDefaultUserId(systemType));
+ buffer.append(';');
+ }
+ String result = buffer.toString();
+ return result;
+ }
+
+ /**
+ * Sets the default user id and enabled state for all system types.
+ * @param systemTypeValues a tabled encoded as a string that contains
+ * entries for each system type. See {@link #getSystemTypeValues()} for the
+ * table format.
+ */
+ public static void setSystemTypeValues(String systemTypeValues) {
+ IRSECoreRegistry registry = RSECorePlugin.getDefault().getRegistry();
+ Hashtable table = parseString(systemTypeValues);
+ Enumeration e = table.keys();
+ while (e.hasMoreElements()) {
+ String key = (String) e.nextElement();
+ String compoundValue = (String) table.get(key);
+ String[] values = compoundValue.split("\\+"); //$NON-NLS-1$
+ String isEnabled = values[0];
+ String defaultUserId = values[1];
+ IRSESystemType systemType = registry.getSystemType(key);
+ setIsSystemTypeEnabled(systemType, isEnabled.equals("true")); //$NON-NLS-1$
+ setDefaultUserId(systemType, defaultUserId);
+ }
+ }
+
+ /**
+ * @return the system type to default when no explicit system type is available.
+ */
+ public static String getSystemType() {
+ Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
+ String result = store.getString(IRSEPreferenceNames.SYSTEMTYPE);
+ return result;
+ }
+
+ /**
+ * Sets the system type to default when no explicit system type is available.
+ * @param systemType the string giving the system type name.
+ */
+ public static void setSystemType(String systemType) {
+ Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
+ store.setValue(IRSEPreferenceNames.SYSTEMTYPE, systemType);
+ savePreferences();
+ }
+
+ /**
+ * Sets if a system type is enabled.
+ * @param systemType the system type to be enabled on this machine.
+ * @param isEnabled the enabled state
+ */
+ public static void setIsSystemTypeEnabled(IRSESystemType systemType, boolean isEnabled) {
+ Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
+ String key = getSystemTypePreferencesKey(systemType, RSEPreferencesManager.ST_ENABLED);
+ if (!store.contains(key)) {
+ store.setDefault(key, true);
+ }
+ store.setValue(key, isEnabled);
+ savePreferences();
+ }
+
+ /**
+ * Gets the enabled state for a particular system type.
+ * @param systemType the system type
+ * @return the enabled state of that type
+ */
+ public static boolean getIsSystemTypeEnabled(IRSESystemType systemType) {
+ Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
+ String key = getSystemTypePreferencesKey(systemType, RSEPreferencesManager.ST_ENABLED);
+ if (!store.contains(key)) {
+ store.setDefault(key, true);
+ }
+ boolean result = store.getBoolean(key);
+ return result;
+ }
+
+ private static String getSystemTypePreferencesKey(IRSESystemType systemType, String preference) {
+ String key = systemType.getName() + "." + preference; //$NON-NLS-1$
+ return key;
+ }
+
+ /**
+ * @return the names of the profiles the user has elected to make active.
+ */
+ public static String[] getActiveProfiles() {
+ Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
+ String value = store.getString(IRSEPreferenceNames.ACTIVEUSERPROFILES);
+ String[] result = parseStrings(value);
+ return result;
+ }
+
+ /**
+ * Sets the names of the profiles the user has elected to make "active".
+ * The caller must also save the preferences when completing.
+ * @see SystemPreferencesManager#savePreferences()
+ * @param newProfileNames an array of profile names considered to be active.
+ */
+ private static void setActiveProfiles(String[] newProfileNames) {
+ Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
+ store.setValue(IRSEPreferenceNames.ACTIVEUSERPROFILES, makeString(newProfileNames));
+ savePreferences();
+ }
+
+ /**
+ * Add a name to the active profile list.
+ * A name already in the list is not added again.
+ * The list remains sorted in the natural order.
+ * @param newName a new active profile name
+ */
+ public static void addActiveProfile(String newName) {
+ SortedSet names = new TreeSet(Arrays.asList(getActiveProfiles()));
+ names.add(newName);
+ String[] newNames = new String[names.size()];
+ names.toArray(newNames);
+ RSEPreferencesManager.setActiveProfiles(newNames);
+ savePreferences();
+ }
+
+ /**
+ * Delete one of the active profile names in the list of names stored in the registry.
+ * @param oldName the name of the profile to remove from the active profiles list.
+ */
+ public static void deleteActiveProfile(String oldName) {
+ String[] names = getActiveProfiles();
+ int matchPos = -1;
+ for (int idx = 0; (matchPos == -1) && (idx < names.length); idx++) {
+ if (names[idx].equalsIgnoreCase(oldName)) {
+ matchPos = idx;
+ names[idx] = null;
+ }
+ }
+ if (matchPos >= 0) {
+ RSEPreferencesManager.setActiveProfiles(names);
+ savePreferences();
+ }
+ }
+
+ /**
+ * @param profileName the name of the profile to search for in the list of active profiles.
+ * @return the zero-based position of a give profile name in the active list
+ */
+ public static int getActiveProfilePosition(String profileName) {
+ String[] names = getActiveProfiles();
+ int matchPos = -1;
+ for (int idx = 0; (matchPos == -1) && (idx < names.length); idx++) {
+ if (names[idx].equalsIgnoreCase(profileName)) matchPos = idx;
+ }
+ return matchPos;
+ }
+
+ /**
+ * Renames one of the active profile names in the list of names stored in the registry.
+ * This is usually employed after renaming a profile to ensure that the active names
+ * list stays in synch with the actual profile names. The active state of the profiles
+ * cannot be kept in the profiles themselves since that can vary from workspace to workspace
+ * for profiles that are shared in a team.
+ * @param oldName the old name of the profile
+ * @param newName the new name of the profile
+ */
+ public static void renameActiveProfile(String oldName, String newName) {
+ // update active profile name list
+ String[] names = getActiveProfiles();
+ int matchPos = -1;
+ for (int idx = 0; (matchPos == -1) && (idx < names.length); idx++) {
+ if (names[idx].equalsIgnoreCase(oldName)) {
+ matchPos = idx;
+ names[idx] = newName;
+ }
+ }
+ if (matchPos >= 0) {
+ RSEPreferencesManager.setActiveProfiles(names);
+ savePreferences();
+ }
+ }
+
+ public static void initDefaults() {
+ String defaultProfileNames = RSEPreferencesManager.DEFAULT_ACTIVEUSERPROFILES;
+ String userProfileName = getDefaultPrivateSystemProfileName();
+ defaultProfileNames += ";" + userProfileName; //$NON-NLS-1$
+ Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
+ store.setDefault(IRSEPreferenceNames.SYSTEMTYPE, RSEPreferencesManager.DEFAULT_SYSTEMTYPE);
+ store.setDefault(IRSEPreferenceNames.ACTIVEUSERPROFILES, defaultProfileNames);
+ store.setDefault(IRSEPreferenceNames.USE_DEFERRED_QUERIES, RSEPreferencesManager.DEFAULT_USE_DEFERRED_QUERIES);
+ savePreferences();
+ }
+
+ /**
+ * Save the preference store.
+ */
+ private static void savePreferences() {
+ RSECorePlugin.getDefault().savePluginPreferences();
+ }
+
+ /**
+ * @return The name of the default private system profile. This
+ * is typically the short name of the host machine or the name of the
+ * user account.
+ */
+ public static String getDefaultPrivateSystemProfileName() {
+ String name = RSECorePlugin.getLocalMachineName();
+ if (name != null) {
+ int i = name.indexOf('.');
+ if (i > 0) {
+ name = name.substring(0, i);
+ }
+ }
+ if (name == null) {
+ name = System.getProperty("user.name"); //$NON-NLS-1$
+ }
+ return name;
+ }
+
+ /**
+ * @return the name of the default team system profile.
+ */
+ public static String getDefaultTeamProfileName() {
+ String name = RSEPreferencesManager.DEFAULT_TEAMPROFILE;
+ return name;
+ }
+
+ /**
+ * Convert table of key-value pairs into a single string. Each (name, value) pair is
+ * encoded as "name=value;" thus no keys or values in the string may
+ * contain semi-colons or equal signs.
+ * @param table a Hashtable to convert
+ * @return the string containing the converted table
+ */
+ private static String makeString(Hashtable table) {
+ Enumeration keys = table.keys();
+ StringBuffer sb = new StringBuffer(20 * table.size());
+ while (keys.hasMoreElements()) {
+ String key = (String) keys.nextElement();
+ String value = (String) table.get(key);
+ if ((value != null) && (value.length() > 0)) {
+ sb.append(key);
+ sb.append('=');
+ sb.append(value);
+ sb.append(';');
+ }
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Make a single string out of an array of strings. A semi-colon is
+ * used as a delimiter between the separate values. No value in the
+ * array can contain a semi-colon.
+ * @param values the array of strings to condense into a single one
+ * @return the condensed string
+ */
+ private static String makeString(String[] values) {
+ StringBuffer allValues = new StringBuffer(20 * values.length);
+ for (int idx = 0; idx < values.length; idx++) {
+ if (values[idx] != null) {
+ if (idx > 0) {
+ allValues = allValues.append(';');
+ }
+ allValues.append(values[idx]);
+ }
+ }
+ return allValues.toString();
+ }
+
+ /**
+ * Parse out list of multiple values into a string array per value.
+ * This is the inverse of the {@link #makeString(String[])} operation.
+ * @param allvalues the string holding the condensed value
+ * @return the reconstituted array of strings.
+ */
+ private static String[] parseStrings(String allvalues) {
+ if (allvalues == null) return new String[0];
+ String[] tokens = allvalues.split(";"); //$NON-NLS-1$
+ return tokens;
+ }
+
+ /**
+ * Parse out list of key-value pairs into a hashtable. This is the inverse of the
+ * {@link SystemPreferencesManager#makeString(Hashtable)} operation.
+ * @param allValues the string containing the key-value pairs. If empty or null returns
+ * and empty Hashtable.
+ * @return the reconstituted Hashtable
+ */
+ private static Hashtable parseString(String allValues) {
+ Hashtable keyValues = new Hashtable(10);
+ if (allValues != null) {
+ StringTokenizer tokens = new StringTokenizer(allValues, "=;"); //$NON-NLS-1$
+ 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;
+ }
+
+ /*
+ * Having this method private disables instance creation.
+ */
+ private RSEPreferencesManager() {
+ }
+
+}
diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/SystemResourceConstants.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/SystemResourceConstants.java
index 4f6000ddd..0ac1af568 100644
--- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/SystemResourceConstants.java
+++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/SystemResourceConstants.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2002, 2007 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
@@ -11,7 +11,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - removed RESOURCE_TEAMPROFILE_NAME
********************************************************************************/
package org.eclipse.rse.core;
@@ -30,6 +30,4 @@ public interface SystemResourceConstants
public static final String RESOURCE_TYPE_FILTERS_FOLDER_NAME = "TypeFilters"; //$NON-NLS-1$
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 = IRSEPreferenceNames.DEFAULT_TEAMPROFILE;
} \ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/internal/RSEPreferenceInitializer.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/internal/RSEPreferenceInitializer.java
new file mode 100644
index 000000000..7ea8edc69
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/internal/RSEPreferenceInitializer.java
@@ -0,0 +1,21 @@
+/********************************************************************************
+ * Copyright (c) 2007 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
+ ********************************************************************************/
+package org.eclipse.rse.core.internal;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.rse.core.RSEPreferencesManager;
+
+public class RSEPreferenceInitializer extends AbstractPreferenceInitializer {
+
+ public void initializeDefaultPreferences() {
+ RSEPreferencesManager.initDefaults();
+ }
+
+}
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemQualifiedRemoteFolderCombo.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemQualifiedRemoteFolderCombo.java
index 8338783ef..1337065ce 100644
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemQualifiedRemoteFolderCombo.java
+++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemQualifiedRemoteFolderCombo.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2000, 2007 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
@@ -11,14 +11,13 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
********************************************************************************/
package org.eclipse.rse.files.ui.widgets;
import java.util.Hashtable;
import java.util.ResourceBundle;
-import org.eclipse.rse.core.SystemPreferencesManager;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.model.ISystemRegistry;
@@ -32,6 +31,7 @@ import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.ISystemPreferencesConstants;
import org.eclipse.rse.ui.RSEUIPlugin;
+import org.eclipse.rse.ui.SystemPreferencesManager;
import org.eclipse.rse.ui.SystemWidgetHelpers;
import org.eclipse.rse.ui.widgets.ISystemCombo;
import org.eclipse.rse.ui.widgets.SystemHistoryCombo;
diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemRemoteFolderCombo.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemRemoteFolderCombo.java
index 8f041a14a..e94190619 100644
--- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemRemoteFolderCombo.java
+++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemRemoteFolderCombo.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2000, 2007 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
@@ -20,7 +20,6 @@ import java.util.ResourceBundle;
import java.util.Vector;
import org.eclipse.rse.core.SystemBasePlugin;
-import org.eclipse.rse.core.SystemPreferencesManager;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.files.ui.actions.SystemSelectRemoteFolderAction;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
@@ -28,6 +27,7 @@ import org.eclipse.rse.subsystems.files.core.SystemFileResources;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
import org.eclipse.rse.ui.ISystemPreferencesConstants;
+import org.eclipse.rse.ui.SystemPreferencesManager;
import org.eclipse.rse.ui.SystemWidgetHelpers;
import org.eclipse.rse.ui.widgets.ISystemCombo;
import org.eclipse.rse.ui.widgets.SystemHistoryCombo;
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/PreferencesMapper.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/PreferencesMapper.java
new file mode 100644
index 000000000..587825b15
--- /dev/null
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/PreferencesMapper.java
@@ -0,0 +1,194 @@
+/********************************************************************************
+ * Copyright (c) 2007 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
+ ********************************************************************************/
+package org.eclipse.rse.internal.ui;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+
+public class PreferencesMapper implements IPreferenceStore {
+
+ private Preferences preferences = null;
+ private boolean listening = true;
+ private Map listeners = new HashMap();
+
+ private class MyPropertyChangeListener implements org.eclipse.core.runtime.Preferences.IPropertyChangeListener {
+
+ private IPropertyChangeListener containedListener = null;
+
+ public MyPropertyChangeListener(IPropertyChangeListener containedListener) {
+ this.containedListener = containedListener;
+ }
+
+ public void propertyChange(org.eclipse.core.runtime.Preferences.PropertyChangeEvent event) {
+ if (listening) {
+ String property = event.getProperty();
+ Object oldValue = event.getOldValue();
+ Object newValue = event.getNewValue();
+ PropertyChangeEvent newEvent = new PropertyChangeEvent(this, property, oldValue, newValue);
+ containedListener.propertyChange(newEvent);
+ }
+ }
+
+ }
+
+ public PreferencesMapper(Preferences preferences) {
+ this.preferences = preferences;
+ }
+
+ public void addPropertyChangeListener(IPropertyChangeListener listener) {
+ if (!listeners.containsKey(listener)) {
+ MyPropertyChangeListener l = new MyPropertyChangeListener(listener);
+ listeners.put(listener, l);
+ preferences.addPropertyChangeListener(l);
+ }
+ }
+
+ public boolean contains(String name) {
+ return preferences.contains(name);
+ }
+
+ public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
+ for (Iterator z = listeners.keySet().iterator(); z.hasNext();) {
+ IPropertyChangeListener listener = (IPropertyChangeListener) z.next();
+ PropertyChangeEvent e = new PropertyChangeEvent(this, name, oldValue, newValue);
+ listener.propertyChange(e);
+ }
+ }
+
+ public boolean getBoolean(String name) {
+ return preferences.getBoolean(name);
+ }
+
+ public boolean getDefaultBoolean(String name) {
+ return preferences.getDefaultBoolean(name);
+ }
+
+ public double getDefaultDouble(String name) {
+ return preferences.getDefaultDouble(name);
+ }
+
+ public float getDefaultFloat(String name) {
+ return preferences.getDefaultFloat(name);
+ }
+
+ public int getDefaultInt(String name) {
+ return preferences.getDefaultInt(name);
+ }
+
+ public long getDefaultLong(String name) {
+ return preferences.getDefaultLong(name);
+ }
+
+ public String getDefaultString(String name) {
+ return preferences.getDefaultString(name);
+ }
+
+ public double getDouble(String name) {
+ return preferences.getDouble(name);
+ }
+
+ public float getFloat(String name) {
+ return preferences.getFloat(name);
+ }
+
+ public int getInt(String name) {
+ return preferences.getInt(name);
+ }
+
+ public long getLong(String name) {
+ return preferences.getLong(name);
+ }
+
+ public String getString(String name) {
+ return null;
+ }
+
+ public boolean isDefault(String name) {
+ return preferences.isDefault(name);
+ }
+
+ public boolean needsSaving() {
+ return preferences.needsSaving();
+ }
+
+ public void putValue(String name, String value) {
+ listening = false;
+ preferences.setValue(name, value);
+ listening = true;
+ }
+
+ public void removePropertyChangeListener(IPropertyChangeListener listener) {
+ Object candidate = listeners.get(listener);
+ if (candidate instanceof MyPropertyChangeListener) {
+ MyPropertyChangeListener l = (MyPropertyChangeListener) candidate;
+ preferences.removePropertyChangeListener(l);
+ }
+ listeners.remove(listener);
+ }
+
+ public void setDefault(String name, double value) {
+ preferences.setDefault(name, value);
+ }
+
+ public void setDefault(String name, float value) {
+ preferences.setDefault(name, value);
+ }
+
+ public void setDefault(String name, int value) {
+ preferences.setDefault(name, value);
+ }
+
+ public void setDefault(String name, long value) {
+ preferences.setDefault(name, value);
+ }
+
+ public void setDefault(String name, String defaultObject) {
+ preferences.setDefault(name, defaultObject);
+ }
+
+ public void setDefault(String name, boolean value) {
+ preferences.setDefault(name, value);
+ }
+
+ public void setToDefault(String name) {
+ preferences.setToDefault(name);
+ }
+
+ public void setValue(String name, double value) {
+ preferences.setValue(name, value);
+ }
+
+ public void setValue(String name, float value) {
+ preferences.setValue(name, value);
+ }
+
+ public void setValue(String name, int value) {
+ preferences.setValue(name, value);
+ }
+
+ public void setValue(String name, long value) {
+ preferences.setValue(name, value);
+ }
+
+ public void setValue(String name, String value) {
+ preferences.setValue(name, value);
+ }
+
+ public void setValue(String name, boolean value) {
+ preferences.setValue(name, value);
+ }
+
+}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewColumnManager.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewColumnManager.java
index 6c430f48e..d7579ae4d 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewColumnManager.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewColumnManager.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2004, 2007 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
@@ -11,14 +11,14 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
********************************************************************************/
package org.eclipse.rse.internal.ui.view;
import java.util.HashMap;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.rse.core.SystemPreferencesManager;
+import org.eclipse.rse.ui.SystemPreferencesManager;
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewPart.java
index c67875155..76aaac588 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewPart.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemTableViewPart.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2002, 2007 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
@@ -12,6 +12,7 @@
*
* Contributors:
* Michael Berger (IBM) - 146339 Added refresh action graphic.
+ * David Dykstal (IBM) - moved SystemsPreferencesManager to a new package
********************************************************************************/
package org.eclipse.rse.internal.ui.view;
@@ -42,7 +43,6 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.window.Window;
-import org.eclipse.rse.core.SystemPreferencesManager;
import org.eclipse.rse.core.filters.ISystemFilterReference;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemContainer;
@@ -60,6 +60,7 @@ import org.eclipse.rse.model.SystemResourceChangeEvent;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemIconConstants;
import org.eclipse.rse.ui.RSEUIPlugin;
+import org.eclipse.rse.ui.SystemPreferencesManager;
import org.eclipse.rse.ui.SystemPropertyResources;
import org.eclipse.rse.ui.SystemResources;
import org.eclipse.rse.ui.SystemWidgetHelpers;
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewConnectionAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewConnectionAdapter.java
index 8c588752a..936c76f81 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewConnectionAdapter.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewConnectionAdapter.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2002, 2007 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
@@ -11,7 +11,8 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
+ * - created and used RSEPreferencesManager
********************************************************************************/
package org.eclipse.rse.internal.ui.view;
@@ -25,7 +26,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.IRSEUserIdConstants;
import org.eclipse.rse.core.RSECorePlugin;
-import org.eclipse.rse.core.SystemPreferencesManager;
+import org.eclipse.rse.core.RSEPreferencesManager;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.core.subsystems.ISubSystem;
@@ -409,7 +410,7 @@ public class SystemViewConnectionAdapter
{
String localUserId = conn.getLocalDefaultUserId();
data.setLocalValue(localUserId);
- String parentUserId = SystemPreferencesManager.getUserId(conn.getSystemType());
+ String parentUserId = RSEPreferencesManager.getUserId(conn.getSystemType());
data.setInheritedValue(parentUserId);
data.setIsLocal((localUserId!=null)&&(localUserId.length()>0));
//data.printDetails();
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterReferenceAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterReferenceAdapter.java
index bd35e1bef..6d6127736 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterReferenceAdapter.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewFilterReferenceAdapter.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2002, 2007 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
@@ -11,7 +11,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - moved SystemsPreferencesManager to a new package
********************************************************************************/
package org.eclipse.rse.internal.ui.view;
@@ -27,7 +27,6 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.rse.core.SystemBasePlugin;
-import org.eclipse.rse.core.SystemPreferencesManager;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterContainerReference;
import org.eclipse.rse.core.filters.ISystemFilterPool;
@@ -53,6 +52,7 @@ import org.eclipse.rse.ui.ISystemIconConstants;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;
import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.SystemPreferencesManager;
import org.eclipse.rse.ui.validators.ISystemValidator;
import org.eclipse.rse.ui.validators.ValidatorFilterName;
import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPart.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPart.java
index c1cb6e336..b9f70e877 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPart.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewPart.java
@@ -11,7 +11,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
********************************************************************************/
package org.eclipse.rse.internal.ui.view;
@@ -44,7 +44,6 @@ import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.rse.core.SystemBasePlugin;
-import org.eclipse.rse.core.SystemPreferencesManager;
import org.eclipse.rse.core.filters.ISystemFilterPoolReference;
import org.eclipse.rse.core.filters.ISystemFilterReference;
import org.eclipse.rse.core.filters.ISystemFilterStringReference;
@@ -63,6 +62,7 @@ import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemIconConstants;
import org.eclipse.rse.ui.ISystemPreferencesConstants;
import org.eclipse.rse.ui.RSEUIPlugin;
+import org.eclipse.rse.ui.SystemPreferencesManager;
import org.eclipse.rse.ui.SystemResources;
import org.eclipse.rse.ui.SystemWidgetHelpers;
import org.eclipse.rse.ui.actions.SystemCascadingPreferencesAction;
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewRootInputAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewRootInputAdapter.java
index f2aaca475..02396b7fb 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewRootInputAdapter.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewRootInputAdapter.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2002, 2007 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
@@ -11,7 +11,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - moved SystemsPreferencesManager to a new package
********************************************************************************/
package org.eclipse.rse.internal.ui.view;
@@ -20,10 +20,10 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.rse.core.SystemPreferencesManager;
import org.eclipse.rse.core.model.ISystemRegistry;
import org.eclipse.rse.internal.model.SystemNewConnectionPromptObject;
import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.SystemPreferencesManager;
import org.eclipse.rse.ui.SystemResources;
import org.eclipse.rse.ui.validators.ISystemValidator;
import org.eclipse.rse.ui.view.AbstractSystemViewAdapter;
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSESystemTypeAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSESystemTypeAdapter.java
index 4669360fe..72bbbe72f 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSESystemTypeAdapter.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSESystemTypeAdapter.java
@@ -11,7 +11,8 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
+ * - created and used RSEPreferencesManager
********************************************************************************/
package org.eclipse.rse.ui;
@@ -24,7 +25,7 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.IRSESystemTypeConstants;
-import org.eclipse.rse.core.SystemPreferencesManager;
+import org.eclipse.rse.core.RSEPreferencesManager;
import org.osgi.framework.Bundle;
/**
@@ -180,7 +181,7 @@ public class RSESystemTypeAdapter extends RSEAdapter implements IRSESystemTypeCo
boolean result = false;
IRSESystemType systemType = getSystemType(object);
if ( systemType != null) {
- result = SystemPreferencesManager.getIsSystemTypeEnabled(systemType);
+ result = RSEPreferencesManager.getIsSystemTypeEnabled(systemType);
}
return result;
}
@@ -193,7 +194,7 @@ public class RSESystemTypeAdapter extends RSEAdapter implements IRSESystemTypeCo
public void setIsEnabled(Object object, boolean isEnabled) {
IRSESystemType systemType = getSystemType(object);
if ( systemType != null) {
- SystemPreferencesManager.setIsSystemTypeEnabled(systemType, isEnabled);
+ RSEPreferencesManager.setIsSystemTypeEnabled(systemType, isEnabled);
}
}
@@ -207,7 +208,7 @@ public class RSESystemTypeAdapter extends RSEAdapter implements IRSESystemTypeCo
String result = null;
IRSESystemType systemType = getSystemType(object);
if ( systemType != null) {
- result = SystemPreferencesManager.getDefaultUserId(systemType);
+ result = RSEPreferencesManager.getDefaultUserId(systemType);
}
return result;
}
@@ -220,7 +221,7 @@ public class RSESystemTypeAdapter extends RSEAdapter implements IRSESystemTypeCo
public void setDefaultUserId(Object object, String defaultUserId) {
IRSESystemType systemType = getSystemType(object);
if ( systemType != null) {
- SystemPreferencesManager.setDefaultUserId(systemType, defaultUserId);
+ RSEPreferencesManager.setDefaultUserId(systemType, defaultUserId);
}
}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java
index 5ac59b127..3f5291651 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/RSEUIPlugin.java
@@ -11,7 +11,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - moved methods to SystemPreferencesManager
********************************************************************************/
package org.eclipse.rse.ui;
@@ -29,7 +29,6 @@ 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;
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemConnectionForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemConnectionForm.java
index f73eb7751..b59906532 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemConnectionForm.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemConnectionForm.java
@@ -11,7 +11,8 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
+ * - created and used RSEPreferencesManager
********************************************************************************/
package org.eclipse.rse.ui;
@@ -29,8 +30,8 @@ import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.IRSEUserIdConstants;
import org.eclipse.rse.core.RSECorePlugin;
+import org.eclipse.rse.core.RSEPreferencesManager;
import org.eclipse.rse.core.SystemBasePlugin;
-import org.eclipse.rse.core.SystemPreferencesManager;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemProfile;
import org.eclipse.rse.core.model.ISystemRegistry;
@@ -698,7 +699,7 @@ public class SystemConnectionForm
if (!updateMode && (defaultSystemType==null))
{
- defaultSystemType = SystemPreferencesManager.getSystemType();
+ defaultSystemType = RSEPreferencesManager.getSystemType();
if ((defaultSystemType == null) || (defaultSystemType.length() == 0))
defaultSystemType = lastSystemType;
if ((defaultSystemType == null) || (defaultSystemType.length() == 0))
@@ -990,7 +991,7 @@ public class SystemConnectionForm
{
if (defaultSystemType == null)
{
- defaultSystemType = SystemPreferencesManager.getSystemType();
+ defaultSystemType = RSEPreferencesManager.getSystemType();
if ((defaultSystemType == null) || (defaultSystemType.length()==0))
defaultSystemType = lastSystemType;
}
@@ -1059,7 +1060,7 @@ public class SystemConnectionForm
// ---------------
// default user id
// ---------------
- String parentUserId = SystemPreferencesManager.getUserId(systemType);
+ String parentUserId = RSEPreferencesManager.getUserId(systemType);
if (textUserId!=null)
{
textUserId.setInheritedText(parentUserId);
diff --git a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPreferencesManager.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPreferencesManager.java
index 8a3808496..33f729099 100644
--- a/rse/plugins/org.eclipse.rse.ui/systems/org/eclipse/rse/core/SystemPreferencesManager.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPreferencesManager.java
@@ -11,24 +11,18 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - moved SystemPreferencesManager to a this package, was in
+ * the org.eclipse.rse.core package of the UI plugin.
********************************************************************************/
-package org.eclipse.rse.core;
-
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.SortedSet;
-import java.util.StringTokenizer;
-import java.util.TreeSet;
+package org.eclipse.rse.ui;
+
import java.util.Vector;
import org.eclipse.core.runtime.Preferences;
+import org.eclipse.rse.core.IRSEPreferenceNames;
+import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemRegistry;
-import org.eclipse.rse.internal.model.SystemProfileManager;
-import org.eclipse.rse.ui.ISystemPreferencesConstants;
-import org.eclipse.rse.ui.RSEUIPlugin;
/**
* A utility class that encapsulates all global preferences for the remote system framework
@@ -51,15 +45,14 @@ public class SystemPreferencesManager {
* system properties.
*/
private static boolean showLocalConnection;
- private static boolean showProfilePage;
- private static boolean showNewConnectionPrompt;
+ private static boolean showProfilePage; // This is not a persistent preference
+ private static boolean showNewConnectionPrompt; // This is not a persistent preference
private static void migrateCorePreferences() {
String[] keys = {
IRSEPreferenceNames.ACTIVEUSERPROFILES,
IRSEPreferenceNames.SYSTEMTYPE,
IRSEPreferenceNames.USE_DEFERRED_QUERIES,
- IRSEPreferenceNames.USERIDKEYS,
IRSEPreferenceNames.USERIDPERKEY
};
for (int i = 0; i < keys.length; i++) {
@@ -70,119 +63,21 @@ public class SystemPreferencesManager {
private static void migrateCorePreference(String preferenceName) {
String name = ISystemPreferencesConstants.ROOT + preferenceName;
Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
- if (store.contains(name)) {
+ if (store.contains(name) && !store.isDefault(name)) {
String value = store.getString(name);
- String defaultValue = store.getDefaultString(name);
store.setToDefault(name);
store.setDefault(name, "*migrated*"); //$NON-NLS-1$
store = RSECorePlugin.getDefault().getPluginPreferences();
- store.setDefault(preferenceName, defaultValue);
store.setValue(preferenceName, value);
}
}
/**
- * Determines if a string (the needle) is present in an array of strings (the haystack)
- * @param haystack an array of strings to search
- * @param needle the string for which to search
- * @return true if the needle was found
- */
- private static boolean find(String[] haystack, String needle) {
- for (int idx = 0; idx < haystack.length; idx++) {
- if (haystack[idx].equals(needle)) return true;
- }
- return false;
- }
-
- /**
- * Convert table of key-value pairs into a single string. Each (name, value) pair is
- * encoded as "name=value;" thus no keys or values in the string may
- * contain semi-colons or equal signs.
- * @param table a Hashtable to convert
- * @return the string containing the converted table
- */
- private static String makeString(Hashtable table) {
- Enumeration keys = table.keys();
- StringBuffer sb = new StringBuffer(20 * table.size());
- while (keys.hasMoreElements()) {
- String key = (String) keys.nextElement();
- String value = (String) table.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 key-value pairs into a hashtable. This is the inverse of the
- * {@link #makeString(Hashtable)} operation.
- * @param allValues the string containing the key-value pairs. If empty or null returns
- * and empty Hashtable.
- * @return the reconstituted Hashtable
- */
- private static Hashtable parseString(String allValues) {
- Hashtable keyValues = new Hashtable(10);
- if (allValues != null) {
- StringTokenizer tokens = new StringTokenizer(allValues, "=;"); //$NON-NLS-1$
- 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;
- }
-
- /**
- * Make a single string out of an array of strings. A semi-colon is
- * used as a delimiter between the separate values. No value in the
- * array can contain a semi-colon.
- * @param values the array of strings to condense into a single one
- * @return the condensed string
- */
- private static String makeString(String[] values) {
- StringBuffer allValues = new StringBuffer(20 * values.length);
- for (int idx = 0; idx < values.length; idx++) {
- if (values[idx] != null) {
- if (idx > 0) {
- allValues = allValues.append(';');
- }
- allValues.append(values[idx]);
- }
- }
- return allValues.toString();
- }
-
- /**
- * Parse out list of multiple values into a string array per value.
- * This is the inverse of the {@link #makeString(String[])} operation.
- * @param allvalues the string holding the condensed value
- * @return the reconstituted array of strings.
- */
- private static String[] parseStrings(String allvalues) {
- if (allvalues == null) return new String[0];
- String[] tokens = allvalues.split(";"); //$NON-NLS-1$
- return tokens;
- }
-
- /**
* Initialize our preference store with our defaults.
* This is called once at plugin startup.
*/
public static void initDefaults() {
migrateCorePreferences();
- initDefaultsCore();
initDefaultsUI();
initDefaultsComm();
savePreferences();
@@ -211,17 +106,6 @@ public class SystemPreferencesManager {
return value;
}
- private static void initDefaultsCore() {
- String defaultProfileNames = IRSEPreferenceNames.DEFAULT_ACTIVEUSERPROFILES;
- String userProfileName = SystemProfileManager.getDefaultPrivateSystemProfileName();
- defaultProfileNames += ";" + userProfileName; //$NON-NLS-1$
- Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
- store.setDefault(IRSEPreferenceNames.SYSTEMTYPE, IRSEPreferenceNames.DEFAULT_SYSTEMTYPE);
- store.setDefault(IRSEPreferenceNames.ACTIVEUSERPROFILES, defaultProfileNames);
- store.setDefault(IRSEPreferenceNames.USE_DEFERRED_QUERIES, IRSEPreferenceNames.DEFAULT_USE_DEFERRED_QUERIES);
- savePreferences();
- }
-
/**
* Set default communications preferences
*/
@@ -242,316 +126,6 @@ public class SystemPreferencesManager {
}
/**
- * @return the Hashtable where the key is a string identifying a particular object, and
- * the value is the user ID for that object.
- * @see #setUserId(String, String)
- */
- private static Hashtable getUserIds() {
- Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
- Hashtable userIds = null;
- String value = store.getString(IRSEPreferenceNames.USERIDPERKEY);
- if (value != null) {
- userIds = parseString(value);
- } else {
- userIds = new Hashtable();
- }
- return userIds;
- }
-
- /**
- * Store the user ids that are saved keyed by some key.
- * @param userIds A Hashtable of userids.
- * @see #setUserId(String, String)
- */
- private static void setUserIds(Hashtable userIds) {
- Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
- String userIdsString = makeString(userIds);
- store.setValue(IRSEPreferenceNames.USERIDPERKEY, userIdsString);
- savePreferences();
- }
-
- /**
- * Retrieves a user id given a key.
- * @param key the key from which to get the particular user id.
- * @return user ID for the given key or null if the key was not found.
- * @see #setUserId(String, String)
- */
- public static String getUserId(String key) {
- String uid = null;
- Hashtable userIds = getUserIds();
- uid = (String) userIds.get(key);
- return uid;
- }
-
- /**
- * Clears the user ID for the given key.
- * @param key the key for the user id.
- * @see #setUserId(String, String)
- */
- public static void clearUserId(String key) {
- Hashtable userIds = getUserIds();
- if (userIds.containsKey(key)) {
- userIds.remove(key);
- setUserIds(userIds);
- }
- }
-
- /**
- * Sets the user Id for this key.
- * The key typically designates a scope for this userid so that a hierarchy
- * of user ids can be maintained for inheritance.
- * For example, hosts have greater scope than subsystems.
- * A key would typically be <profile-name>.<host-name>,
- * or <profile-name>.<host-type>,
- * or <profile-name>.<host-name>.<subsystem-name>.
- * @param key the key used to find the userId
- * @param userId the userId to retrieve by this key.
- */
- public static void setUserId(String key, String userId) {
- if ((key != null) && (userId != null)) {
- Hashtable userIds = getUserIds();
- String storedUserId = (String) userIds.get(key);
- if (storedUserId == null || !storedUserId.equals(userId)) { // don't bother updating if its already there
- userIds.put(key, userId);
- setUserIds(userIds);
- }
- }
- }
-
- /**
- * Gets the default user id for a given system type.
- * @param systemType the systemtype for which to retrieve the default user id
- * @return The default user id
- */
- public static String getDefaultUserId(IRSESystemType systemType) {
- Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
- String key = getSystemTypePreferencesKey(systemType, IRSEPreferenceNames.ST_DEFAULT_USERID);
- if (!store.contains(key)) {
- store.setDefault(key, System.getProperty("user.name")); //$NON-NLS-1$
- }
- String result = store.getString(key);
- return result;
- }
-
- /**
- * Sets the default userId for the given system type.
- * @param systemTypeName the name of the system type
- * @param userId the default user id for this system type.
- * This may be null to "unset" the default.
- */
- public static void setDefaultUserId(String systemTypeName, String userId) {
- IRSESystemType systemType = RSECorePlugin.getDefault().getRegistry().getSystemType(systemTypeName);
- if (systemType != null) {
- setDefaultUserId(systemType, userId);
- }
- }
-
- /**
- * Sets the default userId for the given system type.
- * @param systemType the system type for which to set the default
- * @param userId the default user id for this system type.
- * This may be null to "unset" the default.
- */
- public static void setDefaultUserId(IRSESystemType systemType, String userId) {
- Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
- String key = getSystemTypePreferencesKey(systemType, IRSEPreferenceNames.ST_DEFAULT_USERID);
- store.setValue(key, userId);
- savePreferences();
- }
-
- /**
- * Gets the system type values table for editing. This is a synthesized preference
- * that is handled as a single value. Rows are separated by semi-colons.
- * Each row is of the format <systemTypeName>=<enabled>+<defaultUserId>;
- * @return the table of system types formatted as a single string
- */
- public static String getSystemTypeValues() {
- IRSESystemType[] systemTypes = RSECorePlugin.getDefault().getRegistry().getSystemTypes();
- StringBuffer buffer = new StringBuffer(100);
- for (int i = 0; i < systemTypes.length; i++) {
- IRSESystemType systemType = systemTypes[i];
- buffer.append(systemType.getName());
- buffer.append('=');
- buffer.append(getIsSystemTypeEnabled(systemType));
- buffer.append('+');
- buffer.append(getDefaultUserId(systemType));
- buffer.append(';');
- }
- String result = buffer.toString();
- return result;
- }
-
- /**
- * @return the system type to default when no explicit system type is available.
- */
- public static String getSystemType() {
- Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
- String result = store.getString(IRSEPreferenceNames.SYSTEMTYPE);
- return result;
- }
-
- /**
- * Sets the system type to default when no explicit system type is available.
- * @param systemType the string giving the system type name.
- */
- public static void setSystemType(String systemType) {
- Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
- store.setValue(IRSEPreferenceNames.SYSTEMTYPE, systemType);
- savePreferences();
- }
-
- /**
- * Sets the default user id and enabled state for all system types.
- * @param systemTypeValues a tabled encoded as a string that contains
- * entries for each system type. See {@link #getSystemTypeValues()} for the
- * table format.
- */
- public static void setSystemTypeValues(String systemTypeValues) {
- IRSECoreRegistry registry = RSECorePlugin.getDefault().getRegistry();
- Hashtable table = parseString(systemTypeValues);
- Enumeration e = table.keys();
- while (e.hasMoreElements()) {
- String key = (String) e.nextElement();
- String compoundValue = (String) table.get(key);
- String[] values = compoundValue.split("\\+"); //$NON-NLS-1$
- String isEnabled = values[0];
- String defaultUserId = values[1];
- IRSESystemType systemType = registry.getSystemType(key);
- setIsSystemTypeEnabled(systemType, isEnabled.equals("true")); //$NON-NLS-1$
- setDefaultUserId(systemType, defaultUserId);
- }
- }
-
- /**
- * Sets if a system type is enabled.
- * @param systemType the system type to be enabled on this machine.
- * @param isEnabled the enabled state
- */
- public static void setIsSystemTypeEnabled(IRSESystemType systemType, boolean isEnabled) {
- Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
- String key = getSystemTypePreferencesKey(systemType, IRSEPreferenceNames.ST_ENABLED);
- if (!store.contains(key)) {
- store.setDefault(key, true);
- }
- store.setValue(key, isEnabled);
- savePreferences();
- }
-
- /**
- * Gets the enabled state for a particular system type.
- * @param systemType the system type
- * @return the enabled state of that type
- */
- public static boolean getIsSystemTypeEnabled(IRSESystemType systemType) {
- Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
- String key = getSystemTypePreferencesKey(systemType, IRSEPreferenceNames.ST_ENABLED);
- if (!store.contains(key)) {
- store.setDefault(key, true);
- }
- boolean result = store.getBoolean(key);
- return result;
- }
-
- private static String getSystemTypePreferencesKey(IRSESystemType systemType, String preference) {
- String key = systemType.getName() + "." + preference; //$NON-NLS-1$
- return key;
- }
-
- /**
- * @return the names of the profiles the user has elected to make active.
- */
- public static String[] getActiveProfiles() {
- Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
- String value = store.getString(IRSEPreferenceNames.ACTIVEUSERPROFILES);
- String[] result = parseStrings(value);
- return result;
- }
-
- /**
- * Sets the names of the profiles the user has elected to make "active".
- * The caller must also save the preferences when completing.
- * @see #savePreferences()
- * @param newProfileNames an array of profile names considered to be active.
- */
- private static void setActiveProfiles(String[] newProfileNames) {
- Preferences store = RSECorePlugin.getDefault().getPluginPreferences();
- store.setValue(IRSEPreferenceNames.ACTIVEUSERPROFILES, makeString(newProfileNames));
- savePreferences();
- }
-
- /**
- * Add a name to the active profile list.
- * A name already in the list is not added again.
- * The list remains sorted in the natural order.
- * @param newName a new active profile name
- */
- public static void addActiveProfile(String newName) {
- SortedSet names = new TreeSet(Arrays.asList(getActiveProfiles()));
- names.add(newName);
- String[] newNames = new String[names.size()];
- names.toArray(newNames);
- SystemPreferencesManager.setActiveProfiles(newNames);
- savePreferences();
- }
-
- /**
- * Delete one of the active profile names in the list of names stored in the registry.
- * @param oldName the name of the profile to remove from the active profiles list.
- */
- public static void deleteActiveProfile(String oldName) {
- String[] names = getActiveProfiles();
- int matchPos = -1;
- for (int idx = 0; (matchPos == -1) && (idx < names.length); idx++) {
- if (names[idx].equalsIgnoreCase(oldName)) {
- matchPos = idx;
- names[idx] = null;
- }
- }
- if (matchPos >= 0) {
- SystemPreferencesManager.setActiveProfiles(names);
- savePreferences();
- }
- }
-
- /**
- * @param profileName the name of the profile to search for in the list of active profiles.
- * @return the zero-based position of a give profile name in the active list
- */
- public static int getActiveProfilePosition(String profileName) {
- String[] names = getActiveProfiles();
- int matchPos = -1;
- for (int idx = 0; (matchPos == -1) && (idx < names.length); idx++) {
- if (names[idx].equalsIgnoreCase(profileName)) matchPos = idx;
- }
- return matchPos;
- }
-
- /**
- * Renames one of the active profile names in the list of names stored in the registry.
- * This is usually employed after renaming a profile to ensure that the active names
- * list stays in synch with the actual profile names. The active state of the profiles
- * cannot be kept in the profiles themselves since that can vary from workspace to workspace
- * for profiles that are shared in a team.
- * @param oldName the old name of the profile
- * @param newName the new name of the profile
- */
- public static void renameActiveProfile(String oldName, String newName) {
- // update active profile name list
- String[] names = getActiveProfiles();
- int matchPos = -1;
- for (int idx = 0; (matchPos == -1) && (idx < names.length); idx++) {
- if (names[idx].equalsIgnoreCase(oldName)) {
- matchPos = idx;
- names[idx] = newName;
- }
- }
- if (matchPos >= 0) {
- SystemPreferencesManager.setActiveProfiles(names);
- savePreferences();
- }
- }
-
- /**
* @return true if the user has elected to show user defined actions cascaded by profile
*/
public static boolean getCascadeUserActions() {
@@ -646,6 +220,19 @@ public class SystemPreferencesManager {
}
/**
+ * Determines if a string (the needle) is present in an array of strings (the haystack)
+ * @param haystack an array of strings to search
+ * @param needle the string for which to search
+ * @return true if the needle was found
+ */
+ private static boolean find(String[] haystack, String needle) {
+ for (int idx = 0; idx < haystack.length; idx++) {
+ if (haystack[idx].equals(needle)) return true;
+ }
+ return false;
+ }
+
+ /**
* Resolves differences between two ordered name lists.
* Used when there are differences between the actual list of names and
* a restored ordered list of names.
@@ -654,11 +241,11 @@ public class SystemPreferencesManager {
Vector finalList = new Vector();
// step 1: include all names from preferences list which do exist in reality...
for (int idx = 0; idx < ordered.length; idx++) {
- if (find(reality, ordered[idx])) finalList.addElement(ordered[idx]);
+ if (SystemPreferencesManager.find(reality, ordered[idx])) finalList.addElement(ordered[idx]);
}
// step 2: add all names in reality which do not exist in preferences list...
for (int idx = 0; idx < reality.length; idx++) {
- if (!find(ordered, reality[idx])) finalList.addElement(reality[idx]);
+ if (!SystemPreferencesManager.find(ordered, reality[idx])) finalList.addElement(reality[idx]);
}
String[] resolved = new String[finalList.size()];
finalList.toArray(resolved);
@@ -817,6 +404,38 @@ public class SystemPreferencesManager {
}
/**
+ * Make a single string out of an array of strings. A semi-colon is
+ * used as a delimiter between the separate values. No value in the
+ * array can contain a semi-colon.
+ * @param values the array of strings to condense into a single one
+ * @return the condensed string
+ */
+ private static String makeString(String[] values) {
+ StringBuffer allValues = new StringBuffer(20 * values.length);
+ for (int idx = 0; idx < values.length; idx++) {
+ if (values[idx] != null) {
+ if (idx > 0) {
+ allValues = allValues.append(';');
+ }
+ allValues.append(values[idx]);
+ }
+ }
+ return allValues.toString();
+ }
+
+ /**
+ * Parse out list of multiple values into a string array per value.
+ * This is the inverse of the {@link #makeString(String[])} operation.
+ * @param allvalues the string holding the condensed value
+ * @return the reconstituted array of strings.
+ */
+ private static String[] parseStrings(String allvalues) {
+ if (allvalues == null) return new String[0];
+ String[] tokens = allvalues.split(";"); //$NON-NLS-1$
+ return tokens;
+ }
+
+ /**
* Save the preference stores.
*/
public static void savePreferences() {
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceRestoreStateAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceRestoreStateAction.java
index 7f2a7fb35..2d71c7ee9 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceRestoreStateAction.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceRestoreStateAction.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2002, 2007 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
@@ -11,14 +11,14 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
********************************************************************************/
package org.eclipse.rse.ui.actions;
-import org.eclipse.rse.core.SystemPreferencesManager;
import org.eclipse.rse.core.model.ISystemPreferenceChangeEvents;
import org.eclipse.rse.internal.model.SystemPreferenceChangeEvent;
import org.eclipse.rse.ui.RSEUIPlugin;
+import org.eclipse.rse.ui.SystemPreferencesManager;
import org.eclipse.rse.ui.SystemResources;
import org.eclipse.swt.widgets.Shell;
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceShowFilterPoolsAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceShowFilterPoolsAction.java
index 641bb195f..2f4b09977 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceShowFilterPoolsAction.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemPreferenceShowFilterPoolsAction.java
@@ -11,14 +11,14 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
********************************************************************************/
package org.eclipse.rse.ui.actions;
-import org.eclipse.rse.core.SystemPreferencesManager;
import org.eclipse.rse.core.model.ISystemPreferenceChangeEvents;
import org.eclipse.rse.internal.model.SystemPreferenceChangeEvent;
import org.eclipse.rse.ui.RSEUIPlugin;
+import org.eclipse.rse.ui.SystemPreferencesManager;
import org.eclipse.rse.ui.SystemResources;
import org.eclipse.swt.widgets.Shell;
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPromptDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPromptDialog.java
index c428b0bea..12166be11 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPromptDialog.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPromptDialog.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2002, 2007 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
@@ -11,12 +11,12 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
********************************************************************************/
package org.eclipse.rse.ui.dialogs;
-import org.eclipse.rse.core.SystemPreferencesManager;
+import org.eclipse.rse.core.RSEPreferencesManager;
import org.eclipse.rse.core.subsystems.IConnectorService;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemMessages;
@@ -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.getUserId(connectorService.getHostType());
+ userId = RSEPreferencesManager.getUserId(connectorService.getHostType());
}
if (textUserId != null && userId != null) {
textUserId.setText(userId);
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/RemoteSystemsPreferencePage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/RemoteSystemsPreferencePage.java
index c99009a07..3c157f454 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/RemoteSystemsPreferencePage.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/RemoteSystemsPreferencePage.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2006, 2007 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
@@ -11,22 +11,25 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
+ * - created and used PreferencesMapper
********************************************************************************/
package org.eclipse.rse.ui.propertypages;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.PropertyChangeEvent;
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.ui.PreferencesMapper;
import org.eclipse.rse.ui.ISystemPreferencesConstants;
import org.eclipse.rse.ui.Mnemonics;
import org.eclipse.rse.ui.RSEUIPlugin;
+import org.eclipse.rse.ui.SystemPreferencesManager;
import org.eclipse.rse.ui.SystemResources;
import org.eclipse.rse.ui.SystemWidgetHelpers;
import org.eclipse.swt.SWT;
@@ -86,7 +89,9 @@ public class RemoteSystemsPreferencePage
*/
protected void createFieldEditors()
{
- // DEFAULT SYSTEM TYPE
+ IPreferenceStore coreStore = new PreferencesMapper(RSECorePlugin.getDefault().getPluginPreferences());
+
+ // DEFAULT SYSTEM TYPE
SystemComboBoxFieldEditor systemTypeEditor = new SystemComboBoxFieldEditor(
IRSEPreferenceNames.SYSTEMTYPE,
SystemResources.RESID_PREF_SYSTEMTYPE_PREFIX_LABEL,
@@ -94,6 +99,7 @@ public class RemoteSystemsPreferencePage
true, // readonly
getFieldEditorParent()
);
+ systemTypeEditor.setPreferenceStore(coreStore);
systemTypeEditor.setToolTipText(SystemResources.RESID_PREF_SYSTEMTYPE_PREFIX_TOOLTIP);
addField(systemTypeEditor);
@@ -166,8 +172,8 @@ public class RemoteSystemsPreferencePage
useDeferredQueryEditor = new SystemBooleanFieldEditor(
IRSEPreferenceNames.USE_DEFERRED_QUERIES,
SystemResources.RESID_PREF_USEDEFERREDQUERIES_PREFIX_LABEL,
- getFieldEditorParent())
- ;
+ getFieldEditorParent());
+ useDeferredQueryEditor.setPreferenceStore(coreStore);
useDeferredQueryEditor.setEnabled(false); // disable this because we want it always to be true
addField(useDeferredQueryEditor);
useDeferredQueryEditor.setToolTipText(SystemResources.RESID_PREF_USEDEFERREDQUERIES_PREFIX_TOOLTIP);
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTypeFieldEditor.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTypeFieldEditor.java
index 090b686ce..91d880d49 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTypeFieldEditor.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SystemTypeFieldEditor.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2006, 2007 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
@@ -11,7 +11,8 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
+ * - created and used RSEPreferencesManager
********************************************************************************/
@@ -37,7 +38,7 @@ 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.RSEPreferencesManager;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.ui.RSESystemTypeAdapter;
import org.eclipse.rse.ui.RSEUIPlugin;
@@ -151,7 +152,7 @@ public class SystemTypeFieldEditor extends FieldEditor
if (systemTypes == null)
systemTypes = getSystemTypes(false);
- String value = SystemPreferencesManager.getSystemTypeValues();
+ String value = RSEPreferencesManager.getSystemTypeValues();
keyValues = null;
if ((value == null) || (value.length() == 0))
@@ -185,7 +186,7 @@ public class SystemTypeFieldEditor extends FieldEditor
String s = createString(keyValues);
if (s != null) {
- SystemPreferencesManager.setSystemTypeValues(s);
+ RSEPreferencesManager.setSystemTypeValues(s);
}
}
}
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHistoryCombo.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHistoryCombo.java
index 62f341186..7717cadb5 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHistoryCombo.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHistoryCombo.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2000, 2007 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
@@ -11,11 +11,11 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
********************************************************************************/
package org.eclipse.rse.ui.widgets;
-import org.eclipse.rse.core.SystemPreferencesManager;
+import org.eclipse.rse.ui.SystemPreferencesManager;
import org.eclipse.rse.ui.SystemResources;
import org.eclipse.rse.ui.dialogs.SystemWorkWithHistoryDialog;
import org.eclipse.swt.SWT;
@@ -521,7 +521,7 @@ public class SystemHistoryCombo extends Composite implements ISystemCombo, Trave
// -----------------------
/**
* Prepares this composite control and sets the default layout data.
- * @param Number of columns the new group will contain.
+ * @param numColumns Number of columns the new group will contain.
*/
protected Composite prepareComposite(int numColumns)
{
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHostCombo.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHostCombo.java
index 81b4da240..ef62a6e50 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHostCombo.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemHostCombo.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2000, 2007 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
@@ -11,7 +11,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
********************************************************************************/
package org.eclipse.rse.ui.widgets;
@@ -21,13 +21,13 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.rse.core.SystemPreferencesManager;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.subsystems.ISubSystemConfiguration;
import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy;
import org.eclipse.rse.model.ISystemResourceChangeEvent;
import org.eclipse.rse.model.ISystemResourceChangeEvents;
import org.eclipse.rse.ui.RSEUIPlugin;
+import org.eclipse.rse.ui.SystemPreferencesManager;
import org.eclipse.rse.ui.SystemResources;
import org.eclipse.rse.ui.SystemWidgetHelpers;
import org.eclipse.rse.ui.actions.SystemNewConnectionAction;
@@ -585,7 +585,7 @@ public class SystemHostCombo extends Composite implements ISelectionProvider, IS
// -----------------------
/**
* Prepares this composite control and sets the default layout data.
- * @param Number of columns the new group will contain.
+ * @param numColumns Number of columns the new group will contain.
*/
protected Composite prepareComposite(int numColumns)
{
@@ -658,7 +658,7 @@ public class SystemHostCombo extends Composite implements ISelectionProvider, IS
* <p>
* This fills the combination with the names of all the active connections of the given
* system type.
- * @param connectionCombo composite to populate
+ * @param combo composite to populate
* @param systemType the system type to restrict the connection list to. Pass null or * for all system types
* @param defaultConnection the default system connection to preselect.
* @param preSelectIfNoMatch true if we should preselect the first item if the given connection is not found
@@ -676,7 +676,7 @@ public class SystemHostCombo extends Composite implements ISelectionProvider, IS
* <p>
* This fills the combination with the names of all the active connections of the given
* system type.
- * @param connectionCombo composite to populate
+ * @param combo composite to populate
* @param systemType the system type to restrict the connection list to. Pass null or * for all system types
* @param defaultConnection the default system connection to preselect.
* @param preSelectIfNoMatch true if we should preselect the first item if the given connection is not found
@@ -744,7 +744,7 @@ public class SystemHostCombo extends Composite implements ISelectionProvider, IS
/**
* Populates a readonly connection combobox instance with system connections for the given
* array of system types.
- * @param connectionCombo composite to populate
+ * @param combo composite to populate
* @param systemTypes the system types to restrict the connection list to. Pass null or * for all system types
* @param defaultConnection the default system connection to preselect.
*/
@@ -766,8 +766,8 @@ public class SystemHostCombo extends Composite implements ISelectionProvider, IS
* Populates a readonly connection combobox instance with system connections which have subsystems
* owned by the given subsystem factory.
* <p>
- * @param connectionCombo composite to populate
- * @param subsystemFactory the subsystem factory to restrict the connection list to.
+ * @param combo composite to populate
+ * @param ssFactory the subsystem factory to restrict the connection list to.
* @param defaultConnection the default system connection to preselect.
* @return true if given default connection was found and selected
*/
@@ -780,9 +780,9 @@ public class SystemHostCombo extends Composite implements ISelectionProvider, IS
* Populates a readonly connection combobox instance with system connections which have subsystems
* owned by a subsystem factory of the given subsystem factory id.
* <p>
- * @param connectionCombo composite to populate
+ * @param combo composite to populate
* @param defaultConnection the default system connection to preselect.
- * @param subsystemFactoryId the subsystem factory id to restrict the connection list by.
+ * @param ssFactoryId the subsystem factory id to restrict the connection list by.
* @return true if given default connection was found and selected
*/
protected boolean populateConnectionCombo(Combo combo, String ssFactoryId, IHost defaultConnection)
@@ -795,9 +795,9 @@ public class SystemHostCombo extends Composite implements ISelectionProvider, IS
* Populates a readonly connection combobox instance with system connections which have subsystems
* owned by a subsystem factory of the given subsystem factory category.
* <p>
- * @param connectionCombo composite to populate
+ * @param combo composite to populate
* @param defaultConnection the default system connection to preselect.
- * @param subsystemFactoryCategory the subsystem factory category to restrict the connection list by.
+ * @param ssFactoryCategory the subsystem factory category to restrict the connection list by.
* @return true if given default connection was found and selected
*/
protected boolean populateConnectionCombo(Combo combo, IHost defaultConnection, String ssFactoryCategory)
@@ -837,9 +837,9 @@ public class SystemHostCombo extends Composite implements ISelectionProvider, IS
/**
* Do string variable substitution. Using you are replacing %1 (say) with a string
- * @param message containing substitution variable. Eg "Connect failed with return code &1"
- * @param substitution variable. Eg "%1"
- * @param substitution data. Eg "001"
+ * @param msg message containing substitution variable. Eg "Connect failed with return code &1"
+ * @param subOld substitution variable. Eg "%1"
+ * @param subNew substitution data. Eg "001"
* @return message with all occurrences of variable substituted with data.
*/
protected static String sub(String msg, String subOld, String subNew)
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/RSEDefaultNewConnectionWizardDelegate.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/RSEDefaultNewConnectionWizardDelegate.java
index f3dc600ef..d6f9ea02b 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/RSEDefaultNewConnectionWizardDelegate.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/RSEDefaultNewConnectionWizardDelegate.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2000, 2007 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
@@ -11,7 +11,8 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
+ * - created and used RSEPreferencesManager
********************************************************************************/
package org.eclipse.rse.ui.wizards;
@@ -20,8 +21,8 @@ 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.RSEPreferencesManager;
import org.eclipse.rse.core.SystemBasePlugin;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemNewConnectionWizardPage;
@@ -177,7 +178,7 @@ public class RSEDefaultNewConnectionWizardDelegate extends RSENewConnectionWizar
{
if ((lastProfile == null) && (activeProfileNames!=null))
{
- String defaultTeamName = IRSEPreferenceNames.DEFAULT_TEAMPROFILE;
+ String defaultTeamName = RSEPreferencesManager.getDefaultTeamProfileName();
for (int idx=0; (lastProfile==null)&&(idx<activeProfileNames.length); idx++)
{
if (!activeProfileNames[idx].equals(defaultTeamName))
diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/Host.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/Host.java
index 21bec27c5..96cdeae0c 100644
--- a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/Host.java
+++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/Host.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2006, 2007 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
@@ -11,7 +11,8 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - using new API from RSECorePlugin, RSEPreferencesManager
+ * - moved SystemsPreferencesManager to a new plugin
********************************************************************************/
package org.eclipse.rse.internal.model;
@@ -20,7 +21,7 @@ import java.util.Locale;
import org.eclipse.core.runtime.Platform;
import org.eclipse.rse.core.IRSESystemType;
-import org.eclipse.rse.core.SystemPreferencesManager;
+import org.eclipse.rse.core.RSEPreferencesManager;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemHostPool;
import org.eclipse.rse.core.model.ISystemProfile;
@@ -209,7 +210,7 @@ public class Host extends RSEModelObject implements IHost
// value (the actual user id) the old keyed entry held.
if (oldUserId != null)
{
- SystemPreferencesManager.clearUserId(previousUserIdKey);
+ RSEPreferencesManager.clearUserId(previousUserIdKey);
}
}
/**
@@ -229,8 +230,8 @@ public class Host extends RSEModelObject implements IHost
String newKey = getPreferencesKey(newName, getAliasName());
if ((userIdValue != null) && (userIdValue.length()>0))
{
- SystemPreferencesManager.clearUserId(previousUserIdKey);
- SystemPreferencesManager.setUserId(newKey, userIdValue); // store old value with new preference key
+ RSEPreferencesManager.clearUserId(previousUserIdKey);
+ RSEPreferencesManager.setUserId(newKey, userIdValue); // store old value with new preference key
}
previousUserIdKey = newKey;
}
@@ -276,8 +277,8 @@ public class Host extends RSEModelObject implements IHost
String newKey = getPreferencesKey(getSystemProfileName(), newName);
if ((userIdValue != null) && (userIdValue.length()>0))
{
- SystemPreferencesManager.clearUserId(previousUserIdKey);
- SystemPreferencesManager.setUserId(newKey, userIdValue); // store old value with new preference key
+ RSEPreferencesManager.clearUserId(previousUserIdKey);
+ RSEPreferencesManager.setUserId(newKey, userIdValue); // store old value with new preference key
}
previousUserIdKey = newKey;
}
@@ -335,7 +336,7 @@ public class Host extends RSEModelObject implements IHost
String key = getPreferencesKey();
if (key != null)
{
- SystemPreferencesManager.setUserId(key, newId);
+ RSEPreferencesManager.setUserId(key, newId);
}
}
}
@@ -359,7 +360,7 @@ public class Host extends RSEModelObject implements IHost
String uid = getLocalDefaultUserId();
if ((uid == null) || (uid.length()==0))
{
- uid = SystemPreferencesManager.getUserId(getSystemType()); // resolve from preferences
+ uid = RSEPreferencesManager.getUserId(getSystemType()); // resolve from preferences
if ((uid != null) && ucId)
uid = uid.toUpperCase();
}
@@ -374,7 +375,7 @@ public class Host extends RSEModelObject implements IHost
String uid = null;
if ((key!=null) && (key.length()>0))
{
- uid = SystemPreferencesManager.getUserId(key); // resolve from preferences
+ uid = RSEPreferencesManager.getUserId(key); // resolve from preferences
}
return uid;
}
@@ -397,7 +398,7 @@ public class Host extends RSEModelObject implements IHost
public void clearLocalDefaultUserId()
{
if (previousUserIdKey!=null)
- SystemPreferencesManager.clearUserId(previousUserIdKey);
+ RSEPreferencesManager.clearUserId(previousUserIdKey);
}
/**
diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemHostPool.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemHostPool.java
index 46ce6b941..45a6bcf09 100644
--- a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemHostPool.java
+++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemHostPool.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2002, 2007 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
@@ -11,7 +11,8 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - created and used RSEPReferencesManager
+ * - moved SystemsPreferencesManager to a new plugin
********************************************************************************/
package org.eclipse.rse.internal.model;
@@ -21,7 +22,7 @@ import java.util.Iterator;
import java.util.List;
import org.eclipse.rse.core.IRSEUserIdConstants;
-import org.eclipse.rse.core.SystemPreferencesManager;
+import org.eclipse.rse.core.RSEPreferencesManager;
import org.eclipse.rse.core.model.IHost;
import org.eclipse.rse.core.model.ISystemHostPool;
import org.eclipse.rse.core.model.ISystemProfile;
@@ -262,7 +263,7 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool
defaultUserId = defaultUserId.toUpperCase();
if (defaultUserIdLocation == IRSEUserIdConstants.USERID_LOCATION_DEFAULT_SYSTEMTYPE)
{
- SystemPreferencesManager.setDefaultUserId(systemType, defaultUserId);
+ RSEPreferencesManager.setDefaultUserId(systemType, defaultUserId);
}
//else if (defaultUserIdLocation == IRSEUserIdConstants.USERID_LOCATION_DEFAULT_OVERALL)
//{
@@ -439,7 +440,7 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool
* </ul>
* <b>TODO PROBLEM: CAN'T RE-ORDER FOLDERS SO CAN WE SUPPORT THIS ACTION?</b>
* @param conns Array of SystemConnections to move.
- * @param newPosition new zero-based position for the connection
+ * @param delta the amount by which to move the connections
*/
public void moveHosts(IHost conns[], int delta)
{
diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemProfileManager.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemProfileManager.java
index 3b9a0d590..9545f5795 100644
--- a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemProfileManager.java
+++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/internal/model/SystemProfileManager.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2006, 2007 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
@@ -11,7 +11,8 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - created and used RSEPreferencesManager
+ * - moved SystemPreferencesManager to a new plugin
********************************************************************************/
package org.eclipse.rse.internal.model;
@@ -20,10 +21,9 @@ 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.RSEPreferencesManager;
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;
@@ -61,23 +61,6 @@ public class SystemProfileManager implements ISystemProfileManager {
}
/**
- * @return the name of the default private system profile.
- */
- public static String getDefaultPrivateSystemProfileName() {
- String name = RSECorePlugin.getLocalMachineName();
- if (name != null) {
- int i = name.indexOf('.');
- if (i > 0) {
- name = name.substring(0, i);
- }
- }
- if (name == null) {
- name = System.getProperty("user.name"); //$NON-NLS-1$
- }
- return name;
- }
-
- /**
* Clear the default after a team sychronization say
*/
public static void clearDefault() {
@@ -104,7 +87,7 @@ public class SystemProfileManager implements ISystemProfileManager {
ISystemProfile newProfile = internalCreateSystemProfileAndFolder(name);
if (makeActive) {
- SystemPreferencesManager.addActiveProfile(name);
+ RSEPreferencesManager.addActiveProfile(name);
((SystemProfile) newProfile).setActive(makeActive);
}
RSEUIPlugin.getThePersistenceManager().commit(this);
@@ -117,8 +100,8 @@ public class SystemProfileManager implements ISystemProfileManager {
public void makeSystemProfileActive(ISystemProfile profile, boolean makeActive) {
boolean wasActive = isSystemProfileActive(profile.getName());
if (wasActive && !makeActive)
- SystemPreferencesManager.deleteActiveProfile(profile.getName());
- else if (makeActive && !wasActive) SystemPreferencesManager.addActiveProfile(profile.getName());
+ RSEPreferencesManager.deleteActiveProfile(profile.getName());
+ else if (makeActive && !wasActive) RSEPreferencesManager.addActiveProfile(profile.getName());
((SystemProfile) profile).setActive(makeActive);
}
@@ -128,7 +111,7 @@ public class SystemProfileManager implements ISystemProfileManager {
private ISystemProfile internalCreateSystemProfile(String name) {
ISystemProfile profile = new SystemProfile();
initialize(profile, name);
- profile.setDefaultPrivate(name.equalsIgnoreCase(getDefaultPrivateSystemProfileName()));
+ profile.setDefaultPrivate(name.equalsIgnoreCase(RSEPreferencesManager.getDefaultPrivateSystemProfileName()));
return profile;
}
@@ -172,7 +155,7 @@ public class SystemProfileManager implements ISystemProfileManager {
// when creating connections.
for (int idx = 0; (!defaultProfileExist) && (idx < profiles.size()); idx++) {
ISystemProfile profile = (ISystemProfile) profiles.get(idx);
- String initProfileName = getDefaultPrivateSystemProfileName();
+ String initProfileName = RSEPreferencesManager.getDefaultPrivateSystemProfileName();
if (profile.getName().equalsIgnoreCase(initProfileName)) {
profile.setDefaultPrivate(true);
defaultProfileExist = true;
@@ -183,7 +166,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(IRSEPreferenceNames.DEFAULT_TEAMPROFILE)) {
+ if (!profile.getName().equalsIgnoreCase(RSEPreferencesManager.getDefaultTeamProfileName())) {
profile.setDefaultPrivate(true);
RSEUIPlugin.getThePersistenceManager().commit(SystemStartHere.getSystemProfileManager());
@@ -259,7 +242,7 @@ public class SystemProfileManager implements ISystemProfileManager {
boolean isActive = isSystemProfileActive(profile.getName());
String oldName = profile.getName();
profile.setName(newName);
- if (isActive) SystemPreferencesManager.renameActiveProfile(oldName, newName);
+ if (isActive) RSEPreferencesManager.renameActiveProfile(oldName, newName);
invalidateCache();
// FIXME RSEUIPlugin.getThePersistenceManager().save(this);
}
@@ -278,7 +261,7 @@ public class SystemProfileManager implements ISystemProfileManager {
* if (res != null)
* res.getContents().remove(profile);
*/
- if (isActive) SystemPreferencesManager.deleteActiveProfile(oldName);
+ if (isActive) RSEPreferencesManager.deleteActiveProfile(oldName);
invalidateCache();
if (persist) {
RSEUIPlugin.getThePersistenceManager().deleteProfile(oldName);
@@ -322,7 +305,7 @@ public class SystemProfileManager implements ISystemProfileManager {
* @see org.eclipse.rse.core.model.ISystemProfileManager#getActiveSystemProfileNames()
*/
public String[] getActiveSystemProfileNames() {
- String[] activeProfileNames = SystemPreferencesManager.getActiveProfiles();
+ String[] activeProfileNames = RSEPreferencesManager.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.
@@ -332,14 +315,14 @@ public class SystemProfileManager implements ISystemProfileManager {
boolean found_team = false;
boolean found_private = false;
boolean changed = false;
- String defaultProfileName = getDefaultPrivateSystemProfileName();
+ String defaultProfileName = RSEPreferencesManager.getDefaultPrivateSystemProfileName();
for (int activeIdx = 0; activeIdx < activeProfileNames.length; activeIdx++) {
// skip Team and Private profiles
String activeProfileName = activeProfileNames[activeIdx];
if (activeProfileName.equals(defaultProfileName)) {
found_private = true;
- } else if (activeProfileName.equals(IRSEPreferenceNames.DEFAULT_TEAMPROFILE)) {
+ } else if (activeProfileName.equals(RSEPreferencesManager.getDefaultTeamProfileName())) {
found_team = true;
} else {
found = false;
@@ -351,7 +334,7 @@ public class SystemProfileManager implements ISystemProfileManager {
if (!found) {
// The active profile no longer exists so remove it from the active list
- SystemPreferencesManager.deleteActiveProfile(activeProfileNames[activeIdx]);
+ RSEPreferencesManager.deleteActiveProfile(activeProfileNames[activeIdx]);
changed = true;
}
}
@@ -370,9 +353,9 @@ public class SystemProfileManager implements ISystemProfileManager {
}
if (!matchesBoth && found_private) {
if (systemProfiles[systemIdx].isActive() || systemProfiles[systemIdx].isDefaultPrivate()) {
- SystemPreferencesManager.addActiveProfile(name);
- SystemPreferencesManager.deleteActiveProfile(RSECorePlugin.getLocalMachineName());
- activeProfileNames = SystemPreferencesManager.getActiveProfiles();
+ RSEPreferencesManager.addActiveProfile(name);
+ RSEPreferencesManager.deleteActiveProfile(RSECorePlugin.getLocalMachineName());
+ activeProfileNames = RSEPreferencesManager.getActiveProfiles();
}
}
}
@@ -384,24 +367,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.addActiveProfile(IRSEPreferenceNames.DEFAULT_TEAMPROFILE);
+ RSEPreferencesManager.addActiveProfile(RSEPreferencesManager.getDefaultTeamProfileName());
changed = true;
}
if (!found_private) {
- SystemPreferencesManager.addActiveProfile(RSECorePlugin.getLocalMachineName());
+ RSEPreferencesManager.addActiveProfile(RSECorePlugin.getLocalMachineName());
changed = true;
}
} else {
ISystemProfile defaultProfile = getDefaultPrivateSystemProfile();
if (defaultProfile != null && !found_private) {
- SystemPreferencesManager.addActiveProfile(defaultProfile.getName());
+ RSEPreferencesManager.addActiveProfile(defaultProfile.getName());
changed = true;
}
}
if (changed) {
- activeProfileNames = SystemPreferencesManager.getActiveProfiles();
+ activeProfileNames = RSEPreferencesManager.getActiveProfiles();
}
}
@@ -412,7 +395,7 @@ public class SystemProfileManager implements ISystemProfileManager {
* @return the profile names currently selected by the user as "active" profiles
*/
public Vector getActiveSystemProfileNamesVector() {
- String[] profileNames = SystemPreferencesManager.getActiveProfiles();
+ String[] profileNames = RSEPreferencesManager.getActiveProfiles();
Vector v = new Vector(profileNames.length);
for (int idx = 0; idx < profileNames.length; idx++)
v.addElement(profileNames[idx]);
@@ -435,14 +418,14 @@ public class SystemProfileManager implements ISystemProfileManager {
* @see org.eclipse.rse.core.model.ISystemProfileManager#getDefaultPrivateSystemProfile()
*/
public ISystemProfile getDefaultPrivateSystemProfile() {
- return getSystemProfile(getDefaultPrivateSystemProfileName());
+ return getSystemProfile(RSEPreferencesManager.getDefaultPrivateSystemProfileName());
}
/* (non-Javadoc)
* @see org.eclipse.rse.core.model.ISystemProfileManager#getDefaultTeamSystemProfile()
*/
public ISystemProfile getDefaultTeamSystemProfile() {
- return getSystemProfile(IRSEPreferenceNames.DEFAULT_TEAMPROFILE);
+ return getSystemProfile(RSEPreferencesManager.getDefaultTeamProfileName());
}
/**
@@ -531,7 +514,7 @@ public class SystemProfileManager implements ISystemProfileManager {
public List getProfiles() {
if (_profiles == null) {
ISystemProfile profile = new SystemProfile();
- String initProfileName = getDefaultPrivateSystemProfileName();
+ String initProfileName = RSEPreferencesManager.getDefaultPrivateSystemProfileName();
profile.setName(initProfileName);
profile.setDefaultPrivate(true);
_profiles = new ArrayList();
diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRegistry.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRegistry.java
index a48a0cbba..49e50aba3 100644
--- a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRegistry.java
+++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRegistry.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2006 IBM Corporation and Wind River Systems, Inc. All rights reserved.
+ * Copyright (c) 2006, 2007 IBM Corporation and Wind River Systems, Inc. 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
@@ -12,6 +12,7 @@
*
* Contributors:
* Michael Scharf (Wind River) - patch for an NPE in getSubSystemConfigurations()
+ * David Dykstal (IBM) - moved SystemsPreferencesManager to a new package
********************************************************************************/
package org.eclipse.rse.model;
@@ -33,7 +34,6 @@ import org.eclipse.rse.core.IRSEUserIdConstants;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.SystemAdapterHelpers;
import org.eclipse.rse.core.SystemBasePlugin;
-import org.eclipse.rse.core.SystemPreferencesManager;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager;
@@ -82,6 +82,7 @@ import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSESystemTypeAdapter;
import org.eclipse.rse.ui.RSEUIPlugin;
+import org.eclipse.rse.ui.SystemPreferencesManager;
import org.eclipse.rse.ui.messages.SystemMessageDialog;
import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter;
import org.eclipse.rse.ui.view.ISystemViewInputProvider;
diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystem.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystem.java
index a0d4d975d..e55b98e85 100644
--- a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystem.java
+++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystem.java
@@ -12,7 +12,8 @@
*
* Contributors:
* Martin Oberhuber (Wind River) - 141803: Fix cpu usage 100% while connecting
- *
+ * David Dykstal (IBM) - 168870: moved SystemPreferencesManager to a new package
+ * David Dykstal (IBM) - 168870: created and used RSEPreferencesManager
********************************************************************************/
package org.eclipse.rse.core.subsystems;
@@ -31,8 +32,8 @@ import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.rse.core.RSEPreferencesManager;
import org.eclipse.rse.core.SystemBasePlugin;
-import org.eclipse.rse.core.SystemPreferencesManager;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterPool;
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
@@ -255,8 +256,8 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
String newKey = getPreferencesKey(newName, getHostAliasName());
if ((userIdValue != null) && (userIdValue.length()>0))
{
- SystemPreferencesManager.clearUserId(previousUserIdKey);
- SystemPreferencesManager.setUserId(newKey, userIdValue); // store old value with new preference key
+ RSEPreferencesManager.clearUserId(previousUserIdKey);
+ RSEPreferencesManager.setUserId(newKey, userIdValue); // store old value with new preference key
}
previousUserIdKey = newKey;
@@ -303,8 +304,8 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
String newKey = getPreferencesKey(getSystemProfileName(), newName);
if ((userIdValue != null) && (userIdValue.length()>0))
{
- SystemPreferencesManager.clearUserId(previousUserIdKey);
- SystemPreferencesManager.setUserId(newKey, userIdValue); // store old value with new preference key
+ RSEPreferencesManager.clearUserId(previousUserIdKey);
+ RSEPreferencesManager.setUserId(newKey, userIdValue); // store old value with new preference key
}
previousUserIdKey = newKey;
@@ -339,7 +340,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
// value (the actual user id) the old keyed entry held.
if (oldUserId != null)
{
- SystemPreferencesManager.clearUserId(previousUserIdKey);
+ RSEPreferencesManager.clearUserId(previousUserIdKey);
}
// delete the connection-private filter pool, if it exists:
ISystemFilterPool privatePool = getConnectionPrivateFilterPool(false); // false => don't create if not found
@@ -408,7 +409,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
String uid = null;
if ((key!=null) && (key.length()>0))
{
- uid = SystemPreferencesManager.getUserId(key); // resolve from preferences
+ uid = RSEPreferencesManager.getUserId(key); // resolve from preferences
}
return uid;
}
@@ -444,7 +445,7 @@ public abstract class SubSystem extends RSEModelObject implements IAdaptable, IS
public void clearLocalUserId()
{
if (previousUserIdKey != null)
- SystemPreferencesManager.clearUserId(previousUserIdKey);
+ RSEPreferencesManager.clearUserId(previousUserIdKey);
IConnectorService system = getConnectorService();
if (system != null)
system.clearUserIdCache();
diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystemConfiguration.java
index e48a97b35..23cafc3ea 100644
--- a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystemConfiguration.java
+++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/core/subsystems/SubSystemConfiguration.java
@@ -1,5 +1,5 @@
/********************************************************************************
- * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2002, 2007 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
@@ -11,7 +11,7 @@
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
*
* Contributors:
- * {Name} (company) - description of contribution.
+ * David Dykstal (IBM) - 168870: moved SystemPreferencesManager to a new package
********************************************************************************/
package org.eclipse.rse.core.subsystems;
@@ -31,7 +31,6 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.rse.core.IRSESystemType;
import org.eclipse.rse.core.SystemBasePlugin;
-import org.eclipse.rse.core.SystemPreferencesManager;
import org.eclipse.rse.core.filters.ISystemFilter;
import org.eclipse.rse.core.filters.ISystemFilterContainer;
import org.eclipse.rse.core.filters.ISystemFilterContainerReference;
@@ -60,7 +59,7 @@ import org.eclipse.rse.model.SystemStartHere;
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
import org.eclipse.rse.ui.ISystemMessages;
import org.eclipse.rse.ui.RSEUIPlugin;
-import org.eclipse.rse.ui.SystemMenuManager;
+import org.eclipse.rse.ui.SystemPreferencesManager;
import org.eclipse.rse.ui.SystemPropertyResources;
import org.eclipse.rse.ui.SystemResources;
import org.eclipse.rse.ui.filters.actions.SystemNewFilterAction;
@@ -311,8 +310,6 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
* <p>RETURNS false BY DEFAULT
*
* @see #supportsUserDefinedActions(ISelection)
- * @see #getActionSubSystem(ISubSystem)
- * @see #createActionSubSystem()
*/
public boolean supportsUserDefinedActions()
{
@@ -325,9 +322,6 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
* calls supportsUserDefinedActions() by default. It is called when decided whether or not to show
* the User Actions menu for the current selection, if supportsUserDefinedActions() returns true.
*
- * @see #getActionSubSystem(ISubSystem)
- * @see #createActionSubSystem()
- * @see #addCommonRemoteActions(SystemMenuManager, IStructuredSelection, Shell, String, ISubSystem)
*/
public boolean supportsUserDefinedActions(ISelection selection)
{
@@ -384,8 +378,6 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
* By returning true, user sees a "Work with->Compile Commands..." action item in the popup menu for this
* subsystem. The action is supplied by the framework, but is populated using overridable methods in this subsystem.
* <p>RETURNS false BY DEFAULT
- * @see #getCompileManager()
- * @see #createCompileManager()
*/
public boolean supportsCompileActions()
{
@@ -1154,8 +1146,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
* <li>if {@link #supportsFilters()}, creates a {@link org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager} for the
* subsystem to manage references to filter pools
* <li>if (@link #supportsServerLaunchProperties()}, calls {@link #createServerLauncher(IConnectorService)}, to create
- * the server launcher instance to associate with this subsystem. This can be subsequently
- * retrieved via calling subsystem's {@link ISubSystem#getRemoteServerLauncher()}.
+ * the server launcher instance to associate with this subsystem.}.
* <li>calls {@link #initializeSubSystem(ISubSystem, ISystemNewConnectionWizardPage[])} so subclasses can
* do their thing to initialize the subsystem.
* <li>finally, saves the subsystem to disk.
@@ -1519,7 +1510,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
}
/**
* Update the port for the given subsystem instance.
- * Shortcut to {@link #updateSubSystem(Shell, ISubSystem, boolean, String, boolean, int)}
+ * Shortcut to {@link #updateSubSystem(ISubSystem, boolean, String, boolean, int)}
*/
public void setSubSystemPort(ISubSystem subsystem, int port)
{
@@ -1527,7 +1518,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
}
/**
* Update the user ID for the given subsystem instance.
- * Shortcut to {@link #updateSubSystem(Shell, ISubSystem, boolean, String, boolean, int)}
+ * Shortcut to {@link #updateSubSystem(ISubSystem, boolean, String, boolean, int)}
*/
public void setSubSystemUserId(ISubSystem subsystem, String userId)
{
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/preferences/PreferencesTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/preferences/PreferencesTest.java
index e091fcc96..e8704afc7 100644
--- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/preferences/PreferencesTest.java
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/preferences/PreferencesTest.java
@@ -1,5 +1,5 @@
/* ******************************************************************************
- * Copyright (c) 2006 IBM Corporation. All rights reserved.
+ * Copyright (c) 2006, 2007 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
@@ -8,6 +8,8 @@
* David Dykstal (IBM) - initial API and implementation.
* David McKnight (IBM) - initial API and implementation.
* Kushal Munir (IBM) - initial API and implementation.
+ * David Dykstal (IBM) - moved SystemPreferencesManager to a new package
+ * - created and used RSEPreferencesManager
* ******************************************************************************/
package org.eclipse.rse.tests.preferences;
@@ -15,8 +17,9 @@ 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.core.RSEPreferencesManager;
import org.eclipse.rse.tests.core.RSECoreTestCase;
+import org.eclipse.rse.ui.SystemPreferencesManager;
/**
* Tests for {@link SystemPreferencesManager}.
@@ -38,39 +41,39 @@ public class PreferencesTest extends RSECoreTestCase {
}
public void testActiveProfiles() {
- SystemPreferencesManager.addActiveProfile("bogus01"); //$NON-NLS-1$
- SystemPreferencesManager.addActiveProfile("bogus02"); //$NON-NLS-1$
- String[] profiles = SystemPreferencesManager.getActiveProfiles();
+ RSEPreferencesManager.addActiveProfile("bogus01"); //$NON-NLS-1$
+ RSEPreferencesManager.addActiveProfile("bogus02"); //$NON-NLS-1$
+ String[] profiles = RSEPreferencesManager.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$
+ assertEquals("bogus02", profiles[RSEPreferencesManager.getActiveProfilePosition("bogus02")]); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("bogus01", profiles[RSEPreferencesManager.getActiveProfilePosition("bogus01")]); //$NON-NLS-1$ //$NON-NLS-2$
+ RSEPreferencesManager.renameActiveProfile("bogus02", "bogus99"); //$NON-NLS-1$ //$NON-NLS-2$
+ profiles = RSEPreferencesManager.getActiveProfiles();
+ assertEquals("bogus99", profiles[RSEPreferencesManager.getActiveProfilePosition("bogus99")]); //$NON-NLS-1$ //$NON-NLS-2$
+ RSEPreferencesManager.deleteActiveProfile("bogus01"); //$NON-NLS-1$
+ RSEPreferencesManager.deleteActiveProfile("bogus99"); //$NON-NLS-1$
+ assertEquals(-1, RSEPreferencesManager.getActiveProfilePosition("bogus02")); //$NON-NLS-1$
+ assertEquals(-1, RSEPreferencesManager.getActiveProfilePosition("bogus01")); //$NON-NLS-1$
+ assertEquals(-1, RSEPreferencesManager.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$
+ RSEPreferencesManager.setUserId("a.b.c", "bogusUser"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("bogusUser", RSEPreferencesManager.getUserId("a.b.c")); //$NON-NLS-1$ //$NON-NLS-2$
+ RSEPreferencesManager.clearUserId("a.b.c"); //$NON-NLS-1$
+ assertNull(RSEPreferencesManager.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));
+ String oldValue = RSEPreferencesManager.getDefaultUserId(systemType);
+ RSEPreferencesManager.setDefaultUserId(systemType, "bogus1"); //$NON-NLS-1$
+ assertEquals("bogus1", RSEPreferencesManager.getDefaultUserId(systemType)); //$NON-NLS-1$
+ RSEPreferencesManager.setDefaultUserId("Local", "bogus2"); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("bogus2", RSEPreferencesManager.getDefaultUserId(systemType)); //$NON-NLS-1$
+ RSEPreferencesManager.setDefaultUserId(systemType, oldValue);
+ assertEquals(oldValue, RSEPreferencesManager.getDefaultUserId(systemType));
}
public void testShowLocalConnection() {

Back to the top