;
- * @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
*/
@@ -645,6 +219,19 @@ public class SystemPreferencesManager {
savePreferences();
}
+ /**
+ * 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
@@ -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);
@@ -816,6 +403,38 @@ public class SystemPreferencesManager {
store.setValue(key, makeString(newHistory));
}
+ /**
+ * 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.
*/
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 7f2a7fb35cf..2d71c7ee9ed 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 641bb195ff9..2f4b099770d 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 c428b0bead2..12166be1197 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 c99009a073b..3c157f45415 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 090b686ce3f..91d880d49d2 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 62f34118626..7717cadb546 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 81b4da240a3..ef62a6e500b 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
*
* 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
*
* 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.
*
- * @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.
*
- * @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.
*
- * @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 f3dc600ef98..d6f9ea02b9b 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)&&(idx0))
{
- 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 46ce6b94146..45a6bcf0956 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
*
* TODO PROBLEM: CAN'T RE-ORDER FOLDERS SO CAN WE SUPPORT THIS ACTION?
* @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 3b9a0d59012..9545f5795fe 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;
@@ -60,23 +60,6 @@ public class SystemProfileManager implements ISystemProfileManager {
return singleton;
}
- /**
- * @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
*/
@@ -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 a48a0cbba57..49e50aba365 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 a0d4d975dc2..e55b98e85c8 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 e48a97b35d6..23cafc3ea96 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
* 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.
*
RETURNS false BY DEFAULT
- * @see #getCompileManager()
- * @see #createCompileManager()
*/
public boolean supportsCompileActions()
{
@@ -1154,8 +1146,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration
*
if {@link #supportsFilters()}, creates a {@link org.eclipse.rse.core.filters.ISystemFilterPoolReferenceManager} for the
* subsystem to manage references to filter pools
* 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.}.
* calls {@link #initializeSubSystem(ISubSystem, ISystemNewConnectionWizardPage[])} so subclasses can
* do their thing to initialize the subsystem.
* 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 e091fcc96e8..e8704afc722 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() {