diff --git a/discovery/org.eclipse.rse.discovery/src/org/eclipse/rse/internal/discovery/ServiceDiscoveryWizard.java b/discovery/org.eclipse.rse.discovery/src/org/eclipse/rse/internal/discovery/ServiceDiscoveryWizard.java index ce46d21a402..afe34f9cea6 100644 --- a/discovery/org.eclipse.rse.discovery/src/org/eclipse/rse/internal/discovery/ServiceDiscoveryWizard.java +++ b/discovery/org.eclipse.rse.discovery/src/org/eclipse/rse/internal/discovery/ServiceDiscoveryWizard.java @@ -1,12 +1,13 @@ /******************************************************************************** - * Copyright (c) 2006, 2007 Symbian Software Ltd. All rights reserved. + * Copyright (c) 2006, 2007 Symbian Software Ltd. and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Javier Montalvo Orus (Symbian) - initial API and implementation - * Javier Montalvo Orus (Symbian) - [plan] Improve Discovery and Autodetect in RSE + * Javier Montalvo Orus (Symbian) - initial API and implementation + * Javier Montalvo Orus (Symbian) - [plan] Improve Discovery and Autodetect in RSE + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.discovery; @@ -21,6 +22,8 @@ import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.Platform; import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.jface.wizard.Wizard; +import org.eclipse.rse.core.IRSESystemType; +import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.IPropertySet; import org.eclipse.rse.core.model.ISystemRegistry; @@ -101,7 +104,8 @@ public class ServiceDiscoveryWizard extends Wizard { IHost conn = null; try { - conn = registry.createHost("Discovery", "Discovery@" + hostName, hostName, "Discovered services in "+hostName);//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$; + IRSESystemType discoveryType = RSECorePlugin.getDefault().getRegistry().getSystemTypeById("org.eclipse.rse.systemtype.discovery"); //$NON-NLS-1$ + conn = registry.createHost(discoveryType, "Discovery@" + hostName, hostName, "Discovered services in "+hostName);//$NON-NLS-1$ //$NON-NLS-2$ } catch (Exception e) { RSEUIPlugin.getTheSystemRegistry().deleteHost(conn); return false; diff --git a/rse/plugins/org.eclipse.rse.core/.settings/org.eclipse.core.resources.prefs b/rse/plugins/org.eclipse.rse.core/.settings/org.eclipse.core.resources.prefs index 7ea1ba44fb9..a426e828d12 100644 --- a/rse/plugins/org.eclipse.rse.core/.settings/org.eclipse.core.resources.prefs +++ b/rse/plugins/org.eclipse.rse.core/.settings/org.eclipse.core.resources.prefs @@ -1,3 +1,3 @@ -#Fri Mar 30 16:58:07 EST 2007 +#Wed Apr 25 15:35:14 CEST 2007 eclipse.preferences.version=1 -encoding//src/org/eclipse/rse/internal/persistence/messages.properties=8859_1 +encoding//src/org/eclipse/rse/internal/core/messages.properties=8859_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 1df140072af..a71ac9d5029 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, 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -13,6 +13,7 @@ * Contributors: * David Dykstal (IBM) - moved from core package in the UI plugin * - updated to use new RSEPreferencesManager + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.core; @@ -29,6 +30,8 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.Platform; import org.eclipse.rse.core.model.SystemSignonInformation; +import org.eclipse.rse.internal.core.RSECoreMessages; +import org.osgi.framework.Bundle; /** @@ -39,7 +42,6 @@ import org.eclipse.rse.core.model.SystemSignonInformation; */ public class PasswordPersistenceManager { - // Keys used for using the Platform authorization methods // The server url is generic so we can lookup all registered user IDs / passwords // to display to the user in the password information preference page @@ -54,7 +56,7 @@ public class PasswordPersistenceManager { // Default System Type, on a lookup if the specified system type and hostname is not found // then the call will automatically lookup the default system type and hostname - public static final String DEFAULT_SYSTEM_TYPE = "DEFAULT"; //$NON-NLS-1$ + public static final IRSESystemType DEFAULT_SYSTEM_TYPE = new DefaultSystemType(); // Default user name public static final String DEFAULT_USER_NAME = "DEFAULT_USER"; //$NON-NLS-1$ @@ -71,16 +73,50 @@ public class PasswordPersistenceManager { * Instance variables */ private RegisteredSystemType[] systemTypes; + + /** + * Default System Type + */ + private static class DefaultSystemType implements IRSESystemType + { + private DefaultSystemType() { + } + public Bundle getDefiningBundle() { + return null; + } + public String getDescription() { + return getLabel(); + } + public String getId() { + //TODO consider a space character at the beginning to ensure uniqueness + return "DEFAULT"; //$NON-NLS-1$ + } + public String getLabel() { + return RSECoreMessages.DefaultSystemType_Label; + } + public String getName() { + return getId(); + } + public String getProperty(String key) { + return null; + } + public String[] getSubsystemConfigurationIds() { + return null; + } + public Object getAdapter(Class adapter) { + return null; + } + } /** * Inner class used for storing registered system types */ private class RegisteredSystemType { - private String _systemType; + private IRSESystemType _systemType; private boolean _userIDCaseSensitive; - protected RegisteredSystemType(String systemType, boolean caseSensitive) + protected RegisteredSystemType(IRSESystemType systemType, boolean caseSensitive) { _systemType = systemType; _userIDCaseSensitive = caseSensitive; @@ -90,7 +126,7 @@ public class PasswordPersistenceManager { * Returns the system type. * @return the system type. */ - public String getSystemType() { + public IRSESystemType getSystemType() { return _systemType; } @@ -140,7 +176,7 @@ public class PasswordPersistenceManager { systemTypes = new RegisteredSystemType[sysTypes.length]; for (int i = 0; i < sysTypes.length; i++) { - systemTypes[i] = new RegisteredSystemType(sysTypes[i].getName(), true); + systemTypes[i] = new RegisteredSystemType(sysTypes[i], true); } } @@ -155,9 +191,12 @@ public class PasswordPersistenceManager { /** * Remove the entry from the keyring that matches the hostname, userid and - * system type parameters. + * system type parameters. + * @param systemtype the systemType + * @param hname the connection name + * @param userid the user id */ - public void remove(String systemtype, String hname, String userid) + public void remove(IRSESystemType systemtype, String hname, String userid) { String hostname = hname;//RSEUIPlugin.getQualifiedHostName(hname); // Convert userid to upper case if required @@ -172,7 +211,7 @@ public class PasswordPersistenceManager { { if (removePassword(passwords, hostname, userid)) { - savePasswordMap(systemtype, passwords); + savePasswordMap(systemtype.getId(), passwords); } } else @@ -189,7 +228,7 @@ public class PasswordPersistenceManager { * Check if a password entry exists for the specified system type, hostname * and userid. */ - public boolean passwordExists(String systemtype, String hostname, String userid) + public boolean passwordExists(IRSESystemType systemtype, String hostname, String userid) { return passwordExists(systemtype, hostname, userid, true); @@ -204,7 +243,7 @@ public class PasswordPersistenceManager { * @param userid The user ID to check for. * @param checkDefault Whether or not to check for a default system type if the specified system type is not found. */ - public boolean passwordExists(String systemtype, String hname, String userid, boolean checkDefault) + public boolean passwordExists(IRSESystemType systemtype, String hname, String userid, boolean checkDefault) { String hostname = hname;//RSEUIPlugin.getQualifiedHostName(hname); return (find(systemtype, hostname, userid) != null); @@ -242,7 +281,7 @@ public class PasswordPersistenceManager { */ public int add(SystemSignonInformation info, boolean overwrite, boolean updateDefault) { - String systemtype = info.getSystemType(); + IRSESystemType systemtype = info.getSystemType(); // Convert userid to upper case if required if (!isUserIDCaseSensitive(systemtype)) @@ -301,7 +340,7 @@ public class PasswordPersistenceManager { passwords.put(passwordKey, info.getPassword()); - savePasswordMap(systemtype, passwords); + savePasswordMap(systemtype.getId(), passwords); return RC_OK; } @@ -310,33 +349,34 @@ public class PasswordPersistenceManager { /* * Retrieve the password map from the keyring for the specified system type */ - private Map getPasswordMap(String systemType) + private Map getPasswordMap(IRSESystemType systemType) { Map passwords = null; + String systemTypeId = systemType.getId(); try { URL serverURL = new URL(newURL); - passwords = Platform.getAuthorizationInfo(serverURL, systemType, AUTH_SCHEME); + passwords = Platform.getAuthorizationInfo(serverURL, systemTypeId, AUTH_SCHEME); // if no passwords found with new URL, check old URL if (passwords == null) { URL oldServerURL1 = new URL(SERVER_URL + ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString()); - passwords = Platform.getAuthorizationInfo(oldServerURL1, systemType, AUTH_SCHEME); + passwords = Platform.getAuthorizationInfo(oldServerURL1, systemTypeId, AUTH_SCHEME); // passwords found, so migrate to using new URL if (passwords != null) { - savePasswordMap(systemType, passwords); + savePasswordMap(systemTypeId, passwords); } // if still no passwords found, check with even older URL else { URL oldServerURL2 = new URL(SERVER_URL); - passwords = Platform.getAuthorizationInfo(oldServerURL2, systemType, AUTH_SCHEME); + passwords = Platform.getAuthorizationInfo(oldServerURL2, systemTypeId, AUTH_SCHEME); // passwords found, so migrate to using new URL if (passwords != null) { - savePasswordMap(systemType, passwords); + savePasswordMap(systemTypeId, passwords); } } } @@ -351,13 +391,13 @@ public class PasswordPersistenceManager { /* * Retrieve the password map from the keyring for the specified system type */ - private void savePasswordMap(String systemType, Map passwords) + private void savePasswordMap(String systemTypeId, Map passwords) { try { URL serverURL = new URL(newURL); - Platform.flushAuthorizationInfo(serverURL, systemType, AUTH_SCHEME); - Platform.addAuthorizationInfo(serverURL, systemType, AUTH_SCHEME, passwords); + Platform.flushAuthorizationInfo(serverURL, systemTypeId, AUTH_SCHEME); + Platform.addAuthorizationInfo(serverURL, systemTypeId, AUTH_SCHEME, passwords); } catch (MalformedURLException e) { RSECorePlugin.getDefault().getLogger().logError("PasswordPersistenceManager.savePasswordMap", e); //$NON-NLS-1$ @@ -370,7 +410,7 @@ public class PasswordPersistenceManager { /** * Find the persisted password for the specified systemtype, hostname and userid. */ - public SystemSignonInformation find(String systemtype, String hostname, String userid) + public SystemSignonInformation find(IRSESystemType systemtype, String hostname, String userid) { return find(systemtype, hostname, userid, true); } @@ -483,7 +523,7 @@ public class PasswordPersistenceManager { * @param userid The user ID to check for. * @param checkDefault Whether or not to check for a default system type if the specified system type is not found. */ - public SystemSignonInformation find(String systemtype, String hname, String userid, boolean checkDefault) + public SystemSignonInformation find(IRSESystemType systemtype, String hname, String userid, boolean checkDefault) { String hostname = hname;//RSEUIPlugin.getQualifiedHostName(hname); // Convert userid to upper case if required @@ -541,7 +581,7 @@ public class PasswordPersistenceManager { /** * Helper method for determining if system type uses case sensitive user IDs */ - public boolean isUserIDCaseSensitive(String systemType) + public boolean isUserIDCaseSensitive(IRSESystemType systemType) { // First find the correct provider for (int i = 0; i < systemTypes.length; i++) @@ -552,17 +592,18 @@ public class PasswordPersistenceManager { return systemTypes[i].isUserIDCaseSensitive(); } } - + + //Not found: Default system type is case sensitive return true; } /** * Retrieve the list of registered system types */ - public String[] getRegisteredSystemTypes() + public IRSESystemType[] getRegisteredSystemTypes() { // yantzi: artemis 6.2, added default system type to list - String[] types = new String[systemTypes.length + 1]; + IRSESystemType[] types = new IRSESystemType[systemTypes.length + 1]; types[0] = DEFAULT_SYSTEM_TYPE; 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 index a05c477c98c..c846214aee0 100644 --- 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 @@ -1,11 +1,12 @@ /******************************************************************************** - * Copyright (c) 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * David Dykstal (IBM) - initial API and implementation + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.core; @@ -133,19 +134,6 @@ public class RSEPreferencesManager { 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 @@ -162,7 +150,7 @@ public class RSEPreferencesManager { /** * 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 =+; + * Each row is of the format =+; * @return the table of system types formatted as a single string */ public static String getSystemTypeValues() { @@ -170,7 +158,7 @@ public class RSEPreferencesManager { StringBuffer buffer = new StringBuffer(100); for (int i = 0; i < systemTypes.length; i++) { IRSESystemType systemType = systemTypes[i]; - buffer.append(systemType.getName()); + buffer.append(systemType.getId()); buffer.append('='); buffer.append(getIsSystemTypeEnabled(systemType)); buffer.append('+'); @@ -197,7 +185,7 @@ public class RSEPreferencesManager { String[] values = compoundValue.split("\\+"); //$NON-NLS-1$ String isEnabled = values[0]; String defaultUserId = values[1]; - IRSESystemType systemType = registry.getSystemType(key); + IRSESystemType systemType = registry.getSystemTypeById(key); setIsSystemTypeEnabled(systemType, isEnabled.equals("true")); //$NON-NLS-1$ setDefaultUserId(systemType, defaultUserId); } @@ -234,7 +222,7 @@ public class RSEPreferencesManager { } private static String getSystemTypePreferencesKey(IRSESystemType systemType, String preference) { - String key = systemType.getName() + "." + preference; //$NON-NLS-1$ + String key = systemType.getId() + "." + preference; //$NON-NLS-1$ return key; } diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/Host.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/Host.java index 87321d5b76e..fcd664b67ad 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/Host.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/Host.java @@ -17,6 +17,7 @@ * - Moved to package org.eclipse.rse.model for being extendable. * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType * David Dykstal (IBM) - 142806: refactoring persistence framework + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.core.model; @@ -210,10 +211,10 @@ public class Host extends RSEModelObject implements IHost { // defect 43219 if (systemType != null) { //FIXME MOB this should be in IRSESystemType.isForceUC() / IRSESystemType.isUIDCaseSensitive() - String systemTypeName = systemType.getName(); - boolean forceUC = systemTypeName.equals(IRSESystemType.SYSTEMTYPE_ISERIES); - boolean caseSensitiveUID = systemTypeName.equals(IRSESystemType.SYSTEMTYPE_UNIX) || systemTypeName.equals(IRSESystemType.SYSTEMTYPE_LINUX) - || (systemTypeName.equals(IRSESystemType.SYSTEMTYPE_LOCAL) && !System.getProperty("os.name").toLowerCase().startsWith("windows")); //$NON-NLS-1$ //$NON-NLS-2$ + String systemTypeId = systemType.getId(); + boolean forceUC = systemTypeId.equals(IRSESystemType.SYSTEMTYPE_ISERIES_ID); + boolean caseSensitiveUID = systemTypeId.equals(IRSESystemType.SYSTEMTYPE_UNIX_ID) || systemTypeId.equals(IRSESystemType.SYSTEMTYPE_LINUX_ID) + || (systemTypeId.equals(IRSESystemType.SYSTEMTYPE_LOCAL_ID) && !System.getProperty("os.name").toLowerCase().startsWith("windows")); //$NON-NLS-1$ //$NON-NLS-2$ setForceUserIdToUpperCase(forceUC); setUserIdCaseSensitive(caseSensitiveUID); } @@ -264,7 +265,7 @@ public class Host extends RSEModelObject implements IHost { public String getDefaultUserId() { String uid = getLocalDefaultUserId(); if ((uid == null) || (uid.length() == 0)) { - uid = RSEPreferencesManager.getUserId(getSystemType().getName()); // resolve from preferences + uid = RSEPreferencesManager.getUserId(getSystemType().getId()); // resolve from preferences if ((uid != null) && ucId) uid = uid.toUpperCase(); } return uid; @@ -491,15 +492,6 @@ public class Host extends RSEModelObject implements IHost { hostName = newHostName; } - private String getDefaultUserIdGen() { - return defaultUserId; - } - - private void setDefaultUserIdGen(String newDefaultUserId) { - setDirty(!compareStrings(defaultUserId, newDefaultUserId)); - defaultUserId = newDefaultUserId; - } - /* (non-Javadoc) * @see org.eclipse.rse.core.model.IRSEPersistableContainer#commit() */ diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemHostPool.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemHostPool.java index 7218ef98de5..390aba7705e 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemHostPool.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemHostPool.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,13 +11,14 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.core.model; import java.util.List; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.IRSEUserIdConstants; @@ -46,20 +47,49 @@ public interface ISystemHostPool extends IRSEPersistableContainer { */ public IHost[] getHosts(); - /** - * Create a connection. - */ - public IHost createHost(String systemType, String aliasName, String hostName) throws Exception; + /** + * Create a connection object, given only the minimal information. + *

+ * THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU. + * @param systemType system type matching one of the system types + * defined via the systemTypes extension point. + * @param aliasName unique connection name. + * @param hostName ip name of host. + * @return SystemConnection object, or null if it failed to create + * because the aliasName is not unique. All other errors throw an exception. + */ + public IHost createHost(IRSESystemType systemType, String aliasName, String hostName) throws Exception; - /** - * Create a connection. - */ - public IHost createHost(String systemType, String aliasName, String hostName, String description) throws Exception; + /** + * Create a connection object, given all the possible attributes except default userId. + *

+ * THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU. + * @param systemType system type matching one of the system types + * defined via the systemTypes extension point. + * @param aliasName unique connection name. + * @param hostName ip name of host. + * @param description optional description of the connection. Can be null. + * @return SystemConnection object, or null if it failed to create + * because the aliasName is not unique. All other errors throw an exception. + */ + public IHost createHost(IRSESystemType systemType, String aliasName, String hostName, String description) throws Exception; - /** - * Create a connection. - */ - public IHost createHost(String systemType, String aliasName, String hostName, String description, String defaultUserId, int defaultUserIdLocation) throws Exception; + /** + * Create a connection object, given all the possible attributes. + *

+ * The new connection is added to the list and saved to disk. + * @param systemType system type matching one of the system types + * defined via the systemTypes extension point. + * @param aliasName unique connection name. + * @param hostName ip name of host. + * @param description optional description of the connection. Can be null. + * @param defaultUserId userId to use as the default for the subsystems. + * @param defaultUserIdLocation where to set the given default user Id. See IRSEUserIdConstants for values. + * @return SystemConnection object, or null if it failed to create + * because the aliasName is not unique. All other errors throw an exception. + * @see IRSEUserIdConstants + */ + public IHost createHost(IRSESystemType systemType, String aliasName, String hostName, String description, String defaultUserId, int defaultUserIdLocation) throws Exception; /** * Update an existing connection given the new information. @@ -70,8 +100,8 @@ public interface ISystemHostPool extends IRSEPersistableContainer { * *

* @param conn SystemConnection to be updated - * @param systemType system type matching one of the system type names defined via the - * systemType extension point. + * @param systemType system type matching one of the system types + * defined via the systemType extension point. * @param aliasName unique connection name. * @param hostName ip name of host. * @param description optional description of the connection. Can be null. @@ -79,7 +109,7 @@ public interface ISystemHostPool extends IRSEPersistableContainer { * @param defaultUserIdLocation where to set the given default user Id from IRSEUserIdConstants. * @see IRSEUserIdConstants */ - public void updateHost(IHost conn, String systemType, String aliasName, String hostName, String description, String defaultUserId, int defaultUserIdLocation) throws Exception; + public void updateHost(IHost conn, IRSESystemType systemType, String aliasName, String hostName, String description, String defaultUserId, int defaultUserIdLocation) throws Exception; /** * Return a connection given its name. diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemProfile.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemProfile.java index 12c291b6e88..612caadef8d 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemProfile.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemProfile.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -12,10 +12,12 @@ * * Contributors: * David Dykstal (IBM) - 142806: refactoring persistence framework + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.core.model; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.filters.ISystemFilterPool; import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; import org.eclipse.rse.persistence.IRSEPersistenceProvider; @@ -51,9 +53,9 @@ public interface ISystemProfile extends IRSEModelObject { /** * Convenience method for create a new connection within this profile. - * Shortcut for {@link ISystemRegistry#createHost(String,String,String,String)} + * Shortcut for {@link ISystemRegistry#createHost(IRSESystemType,String,String,String)} */ - public IHost createHost(String systemType, String connectionName, String hostName, String description) throws Exception; + public IHost createHost(IRSESystemType systemType, String connectionName, String hostName, String description) throws Exception; /** * @return The value of the Name attribute diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java index 0b2036484d1..1a08072a7bd 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/ISystemRegistry.java @@ -12,6 +12,7 @@ * * Contributors: * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.core.model; @@ -35,6 +36,7 @@ import org.eclipse.rse.core.subsystems.IConnectorService; import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy; +import org.eclipse.rse.internal.core.RSECoreRegistry; /** * Registry or front door for all remote system connections. @@ -118,24 +120,13 @@ public interface ISystemRegistry extends ISchedulingRule { public ISubSystemConfiguration[] getSubSystemConfigurationsByCategory(String factoryCategory); /** - * Return all subsystem factories which support the given system type. If the type is null, - * returns all. + * Return all subsystem factories which support the given system type. + * If the type is null, returns all. + * @param systemType system type to filter + * @param filterDuplicateServiceSubSystemFactories set false by default */ public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(IRSESystemType systemType, boolean filterDuplicateServiceSubSystemFactories); - /** - * Return all subsystem factories which support the given system type. If the type is null, - * returns all. - * - */ - public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(String systemType); - - /** - * Return all subsystem factories which support the given system type. If the type is null, - * returns all. - */ - public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(String systemType, boolean filterDuplicateServiceSubSystemFactories); - // ---------------------------------- // SYSTEMVIEWINPUTPROVIDER METHODS... // ---------------------------------- @@ -368,35 +359,38 @@ public interface ISystemRegistry extends ISchedulingRule { public IHost[] getHosts(); /** - * Return all connections in a given profile name. + * Return all connections in a given profile. */ public IHost[] getHostsByProfile(ISystemProfile profile); /** - * Return all connections in a given profile. + * Return all connections in a given profile name. */ public IHost[] getHostsByProfile(String profileName); /** - * Return all connections for which there exists one or more subsystems owned - * by a given subsystem factory. + * Return all connections for which there exists one or more + * subsystems owned by a given subsystem configuration. * @see #getSubSystemConfiguration(String) */ public IHost[] getHostsBySubSystemConfiguration(ISubSystemConfiguration factory); /** - * Return all connections for which there exists one or more subsystems owned - * by a given subsystem factory, identified by factory Id + * Return all connections for which there exists one or more + * subsystems owned by a given subsystem configuration, + * identified by configuration Id. */ public IHost[] getHostsBySubSystemConfigurationId(String factoryId); /** - * Return all connections for which there exists one or more subsystems owned - * by any a given subsystem factory that is of the given category. + * Return all connections for which there exists one or more + * subsystems owned by any a given subsystem configuration + * that is of the given category. *

- * This looks for a match on the "category" of the subsystem factory's xml declaration - * in its plugin.xml file. Thus, it is effecient as it need not bring to life a - * subsystem factory just to test its parent class type. + * This looks for a match on the "category" of the subsystem + * configuration's xml declaration in its plugin.xml file. + * Thus, it is effecient as it need not bring to life a + * subsystem configuration just to test its parent class type. * * @see org.eclipse.rse.core.model.ISubSystemConfigurationCategories */ @@ -405,21 +399,21 @@ public interface ISystemRegistry extends ISchedulingRule { /** * Returns all connections for all active profiles, for the given system type. * If the specified system type is null, an empty array is returned. + * In order to get an IRSESystemType, use + * RSECorePlugin.getDefault().getRegistry().{@link RSECoreRegistry#getSystemTypeById(String) getSystemTypeById(String)} * * @param systemType The system type instance. * @return The list of connections or an empty array. */ public IHost[] getHostsBySystemType(IRSESystemType systemType); - /** - * Return all connections for all active profiles, for the given system type. - */ - public IHost[] getHostsBySystemType(String systemType); - /** * Return all connections for all active profiles, for the given system types. + * + * In order to get an IRSESystemType, use + * RSECorePlugin.getDefault().getRegistry().{@link RSECoreRegistry#getSystemTypeById(String) getSystemTypeById(String)} */ - public IHost[] getHostsBySystemTypes(String[] systemTypes); + public IHost[] getHostsBySystemTypes(IRSESystemType[] systemTypes); /** * Return a SystemConnection object given a system profile containing it, @@ -428,22 +422,25 @@ public interface ISystemRegistry extends ISchedulingRule { public IHost getHost(ISystemProfile profile, String connectionName); /** - * Return the zero-based position of a SystemConnection object within its profile. + * Return the zero-based position of a SystemConnection object within + * its profile. */ public int getHostPosition(IHost conn); /** - * Return the number of SystemConnection objects within the given profile + * Return the number of SystemConnection objects within the given profile. */ public int getHostCount(String profileName); /** - * Return the number of SystemConnection objects within the given connection's owning profile + * Return the number of SystemConnection objects within the given + * connection's owning profile. */ public int getHostCountWithinProfile(IHost conn); /** - * Return the number of SystemConnection objects within all active profiles + * Return the number of SystemConnection objects within all active + * profiles. */ public int getHostCount(); @@ -464,15 +461,12 @@ public interface ISystemRegistry extends ISchedulingRule { */ public Vector getHostAliasNamesForAllActiveProfiles(); - /** - * Return array of all previously specified hostnames. - */ - public String[] getHostNames(); - /** * Return array of previously specified hostnames for a given system type. + * After careful consideration, it is decided that if the system type is null, + * then no hostnames should be returned. Previously all for all types were returned. */ - public String[] getHostNames(String systemType); + public String[] getHostNames(IRSESystemType systemType); /** * Returns the list of objects on the system clipboard @@ -504,8 +498,8 @@ public interface ISystemRegistry extends ISchedulingRule { * *

* @param profileName Name of the system profile the connection is to be added to. - * @param systemType system type matching one of the system type names defined via the - * systemTypes extension point. + * @param systemType system type matching one of the system types + * defined via the systemTypes extension point. * @param connectionName unique connection name. * @param hostName ip name of host. * @param description optional description of the connection. Can be null. @@ -517,7 +511,7 @@ public interface ISystemRegistry extends ISchedulingRule { * @return SystemConnection object, or null if it failed to create. This is typically * because the connectionName is not unique. Call getLastException() if necessary. */ - public IHost createHost(String profileName, String systemType, String connectionName, String hostName, String description, String defaultUserId, int defaultUserIdLocation, + public IHost createHost(String profileName, IRSESystemType systemType, String connectionName, String hostName, String description, String defaultUserId, int defaultUserIdLocation, ISystemNewConnectionWizardPage[] newConnectionWizardPages) throws Exception; /** @@ -534,15 +528,15 @@ public interface ISystemRegistry extends ISchedulingRule { * *

* @param profileName Name of the system profile the connection is to be added to. - * @param systemType system type matching one of the system type names defined via the - * systemTypes extension point. + * @param systemType system type matching one of the system types + * defined via the systemTypes extension point. * @param connectionName unique connection name. * @param hostName ip name of host. * @param description optional description of the connection. Can be null. * @return SystemConnection object, or null if it failed to create. This is typically * because the connectionName is not unique. Call getLastException() if necessary. */ - public IHost createHost(String profileName, String systemType, String connectionName, String hostName, String description) throws Exception; + public IHost createHost(String profileName, IRSESystemType systemType, String connectionName, String hostName, String description) throws Exception; /** * Create a connection object. This is a very simplified version that defaults to the user's @@ -558,15 +552,15 @@ public interface ISystemRegistry extends ISchedulingRule { *

  • fires an ISystemResourceChangeEvent event of type EVENT_ADD to all registered listeners * *

    - * @param systemType system type matching one of the system type names defined via the - * systemTypes extension point. + * @param systemType system type matching one of the system types + * defined via the systemTypes extension point. * @param connectionName unique connection name. * @param hostAddress ip name of host. * @param description optional description of the connection. Can be null. * @return SystemConnection object, or null if it failed to create. This is typically * because the connectionName is not unique. Call getLastException() if necessary. */ - public IHost createHost(String systemType, String connectionName, String hostAddress, String description) throws Exception; + public IHost createHost(IRSESystemType systemType, String connectionName, String hostAddress, String description) throws Exception; /** * Update an existing host given the new information. @@ -582,8 +576,8 @@ public interface ISystemRegistry extends ISchedulingRule { * *

    * @param host the host to be updated - * @param systemType system type matching one of the system type names defined via the - * systemTypes extension point. + * @param systemType system type matching one of the system types + * defined via the systemTypes extension point. * @param connectionName unique connection name. * @param hostName ip name of host. * @param description optional description of the host. Can be null. @@ -591,7 +585,7 @@ public interface ISystemRegistry extends ISchedulingRule { * @param defaultUserIdLocation one of the constants in {@link org.eclipse.rse.core.IRSEUserIdConstants} * that tells us where to set the user Id */ - public void updateHost(IHost host, String systemType, String connectionName, + public void updateHost(IHost host, IRSESystemType systemType, String connectionName, String hostName, String description, String defaultUserId, int defaultUserIdLocation); @@ -663,11 +657,15 @@ public interface ISystemRegistry extends ISchedulingRule { public IHost copyHost(IProgressMonitor monitor, IHost conn, ISystemProfile targetProfile, String newName) throws Exception; /** - * Move a SystemConnection to another profile. All subsystems are copied, and all connection data is copied. + * Move a SystemConnection to another profile. + * All subsystems are moved, and all connection data is moved. + * This is actually accomplished by doing a copy operation first, + * and if successful deleting the original. * @param monitor Progress monitor to reflect each step of the operation * @param conn The connection to move - * @param targetProfile What profile to move to - * @param newName Unique name to give moved profile + * @param targetProfile What profile to move into + * @param newName Unique name to give copied profile. Typically this is the same as the original name, but + * will be different on name collisions * @return new SystemConnection object */ public IHost moveHost(IProgressMonitor monitor, IHost conn, ISystemProfile targetProfile, String newName) throws Exception; @@ -680,27 +678,34 @@ public interface ISystemRegistry extends ISchedulingRule { public boolean isAnySubSystemSupportsConnect(IHost conn); /** - * Return true if any of the subsystems for the given connection are currently connected + * Return true if any of the subsystems for the given connection are + * currently connected. */ public boolean isAnySubSystemConnected(IHost conn); /** - * Return true if all of the subsystems for the given connection are currently connected + * Return true if all of the subsystems for the given connection are + * currently connected. */ public boolean areAllSubSystemsConnected(IHost conn); /** - * Disconnect all subsystems for the given connection, if they are currently connected. + * Disconnect all subsystems for the given connection, if they are + * currently connected. */ public void disconnectAllSubSystems(IHost conn); /** - * Inform the world when the connection status changes for a subsystem within a connection + * Inform the world when the connection status changes for a subsystem + * within a connection. + * Update properties for the subsystem and its connection. */ public void connectedStatusChange(ISubSystem subsystem, boolean connected, boolean wasConnected); /** - * Inform the world when the connection status changes for a subsystem within a connection + * Inform the world when the connection status changes for a subsystem + * within a connection. + * Update properties for the subsystem and its connection. */ public void connectedStatusChange(ISubSystem subsystem, boolean connected, boolean wasConnected, boolean collapseTree); diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/RSEModelObject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/RSEModelObject.java index fda0be645f2..e3d4754b750 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/RSEModelObject.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/RSEModelObject.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -12,11 +12,12 @@ * * Contributors: * David Dykstal (IBM) - 142806: refactoring persistence framework + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.core.model; -import org.eclipse.rse.internal.core.model.RSEModelResources; +import org.eclipse.rse.internal.core.RSECoreMessages; /** * Provides common support for local RSE model objects @@ -27,7 +28,7 @@ import org.eclipse.rse.internal.core.model.RSEModelResources; public abstract class RSEModelObject extends PropertySetContainer implements IRSEModelObject { public String getDescription() { - return RSEModelResources.RESID_MODELOBJECTS_MODELOBJECT_DESCRIPTION; + return RSECoreMessages.RESID_MODELOBJECTS_MODELOBJECT_DESCRIPTION; } } \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemSignonInformation.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemSignonInformation.java index 02a3ceb0cdc..e6db159b2bd 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemSignonInformation.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemSignonInformation.java @@ -13,10 +13,12 @@ * Contributors: * David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.core.model; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.subsystems.ICredentials; /** @@ -24,14 +26,12 @@ import org.eclipse.rse.core.subsystems.ICredentials; * must be secure and never disclose the password for the remote system in its unencrypted form. * However the encrypted form of the password is not considered secret information and can be * accessed by anyone. - * - * @author yantzi */ public final class SystemSignonInformation implements ICredentials { + private IRSESystemType _systemType; private String _hostname; private String _userId; - private String _systemType; private String _password; /** @@ -43,7 +43,7 @@ public final class SystemSignonInformation implements ICredentials { /** * Constructor for SystemSignonInformation. */ - public SystemSignonInformation(String hostname, String userid, String systemType) { + public SystemSignonInformation(String hostname, String userid, IRSESystemType systemType) { _hostname = hostname;//RSEUIPlugin.getQualifiedHostName(hostname).toUpperCase(); _userId = userid; _systemType = systemType; @@ -52,7 +52,7 @@ public final class SystemSignonInformation implements ICredentials { /** * Constructor for SystemSignonInformation. */ - public SystemSignonInformation(String hostname, String userid, String password, String systemType) { + public SystemSignonInformation(String hostname, String userid, String password, IRSESystemType systemType) { _hostname = hostname;//RSEUIPlugin.getQualifiedHostName(hostname).toUpperCase(); _userId = userid; _password = password; @@ -68,18 +68,16 @@ public final class SystemSignonInformation implements ICredentials { } /** - * Returns the systemType of the remote system - * //FIXME should be replaced by IRSESystemType getSystemType() - * @deprecated - * @return String + * Returns the systemType of the remote system. + * @return the systemType object. */ - public String getSystemType() { + public IRSESystemType getSystemType() { return _systemType; } /** * Returns the userid for the remote system - * @return String + * @return the user ID. */ public String getUserId() { return _userId; @@ -111,7 +109,7 @@ public final class SystemSignonInformation implements ICredentials { * Sets the systemType. * @param systemType The systemType to set */ - public void setSystemType(String systemType) { + public void setSystemType(IRSESystemType systemType) { _systemType = systemType; } diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemStartHere.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemStartHere.java index 3c1a0ab3dea..726c40487c7 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemStartHere.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/model/SystemStartHere.java @@ -12,9 +12,11 @@ * * Contributors: * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.core.model; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; @@ -53,19 +55,21 @@ public class SystemStartHere * SAME AS: getSystemRegistry().getConnectionsBySystemType(systemType) * @param systemType One of the system types defined via system type extension point: *

      - *
    • "iSeries" - *
    • "Windows" - *
    • "z/OS" - *
    • "Unix" - *
    • "Linux" - *
    • "Local" + *
    • "iSeries" ({@link IRSESystemType#SYSTEMTYPE_ISERIES_ID}) + *
    • "Windows" ({@link IRSESystemType#SYSTEMTYPE_WINDOWS_ID}) + *
    • "z/OS" ({@link IRSESystemType#SYSTEMTYPE_ZSERIES_ID}) + *
    • "Unix" ({@link IRSESystemType#SYSTEMTYPE_UNIX_ID}) + *
    • "Linux" ({@link IRSESystemType#SYSTEMTYPE_LINUX_ID}) + *
    • "Local" ({@link IRSESystemType#SYSTEMTYPE_LOCAL_ID}) *
    * @see org.eclipse.rse.core.IRSESystemType * @see org.eclipse.rse.core.model.ISystemRegistry#getHostsBySystemType(String) + * */ - public static IHost[] getConnectionsBySystemType(String systemType) + public static IHost[] getConnectionsBySystemType(String systemTypeId) { - return getSystemRegistry().getHostsBySystemType(systemType); + IRSESystemType systemType = RSECorePlugin.getDefault().getRegistry().getSystemTypeById(systemTypeId); + return getSystemRegistry().getHostsBySystemType(systemType); } /** diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AuthenticatingConnectorService.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AuthenticatingConnectorService.java index 97b76d730ca..e0e712215ce 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AuthenticatingConnectorService.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/AuthenticatingConnectorService.java @@ -7,12 +7,14 @@ * Contributors: * David Dykstal (IBM) - initial API and implementation from AbstractConnectorService. * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.core.subsystems; import java.util.ArrayList; import java.util.List; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.IRSEUserIdConstants; import org.eclipse.rse.core.PasswordPersistenceManager; import org.eclipse.rse.core.RSECorePlugin; @@ -102,7 +104,7 @@ public abstract class AuthenticatingConnectorService extends AbstractConnectorSe ICredentials credentials = credentialsProvider.getCredentials(); boolean cached = (credentials != null && credentials.getPassword() != null); if (!cached && onDisk) { - String systemType = getHostType(); + IRSESystemType systemType = getHost().getSystemType(); String hostName = getHostName(); String userId = getUserId(); if (userId != null) { @@ -149,7 +151,7 @@ public abstract class AuthenticatingConnectorService extends AbstractConnectorSe * @see org.eclipse.rse.core.subsystems.IConnectorService#removePassword() */ public final void removePassword() { - String systemType = getHostType(); + IRSESystemType systemType = getHost().getSystemType(); String hostName = getHostName(); String userId = credentialsProvider.getUserId(); PasswordPersistenceManager.getInstance().remove(systemType, hostName, userId); @@ -255,7 +257,7 @@ public abstract class AuthenticatingConnectorService extends AbstractConnectorSe int whereToUpdate = IRSEUserIdConstants.USERID_LOCATION_HOST; IHost host = subsystem.getHost(); ISystemRegistry sr = RSECorePlugin.getDefault().getSystemRegistry(); - sr.updateHost(host, host.getSystemType().getName(), host.getAliasName(), host.getHostName(), host.getDescription(), userId, whereToUpdate); + sr.updateHost(host, host.getSystemType(), host.getAliasName(), host.getHostName(), host.getDescription(), userId, whereToUpdate); } } diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISubSystemConfiguration.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISubSystemConfiguration.java index 9fc20bd246c..6036cef09dd 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISubSystemConfiguration.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISubSystemConfiguration.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -12,10 +12,12 @@ * * Contributors: * David Dykstal (IBM) - 168870: move core function from UI to core + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.core.subsystems; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.filters.ISystemFilter; import org.eclipse.rse.core.filters.ISystemFilterPool; import org.eclipse.rse.core.filters.ISystemFilterPoolManager; @@ -291,7 +293,7 @@ public interface ISubSystemConfiguration extends ISystemFilterPoolManagerProvide /** * Return the system types this subsystem factory supports. */ - public String[] getSystemTypes(); + public IRSESystemType[] getSystemTypes(); // --------------------------------- // PROFILE METHODS... diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISubSystemConfigurationProxy.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISubSystemConfigurationProxy.java index 27fb83d79b7..d372d0e9c15 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISubSystemConfigurationProxy.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/ISubSystemConfigurationProxy.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -12,12 +12,14 @@ * * Contributors: * David Dykstal (IBM) - 168870: move core function from UI to core -********************************************************************************/ + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType + ********************************************************************************/ package org.eclipse.rse.core.subsystems; import java.net.URL; +import org.eclipse.rse.core.IRSESystemType; import org.osgi.framework.Bundle; /** @@ -65,7 +67,7 @@ public interface ISubSystemConfigurationProxy { * * @return The list of supported system types or an empty list. */ - public String[] getSystemTypes(); + public IRSESystemType[] getSystemTypes(); /** * Return true if this factory supports all system types @@ -108,10 +110,10 @@ public interface ISubSystemConfigurationProxy { // public IConnectorService getSystemObject(); /** - * Test if the given system type matches one or more of the type names declared in the - * systemTypes attribute of this extension. + * Test if the given system type matches one or more of the + * systemTypes attribute of this extension. */ - public boolean appliesToSystemType(String type); + public boolean appliesToSystemType(IRSESystemType type); /** * Reset for a full refresh from disk, such as after a team synch. diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/RemoteServerLauncher.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/RemoteServerLauncher.java index b76f501ead8..49088ec0bd5 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/RemoteServerLauncher.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/subsystems/RemoteServerLauncher.java @@ -13,6 +13,7 @@ * Contributors: * David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.core.subsystems; @@ -23,7 +24,7 @@ import org.eclipse.rse.core.model.IProperty; import org.eclipse.rse.core.model.IPropertySet; import org.eclipse.rse.core.model.IPropertyType; import org.eclipse.rse.core.model.PropertyType; -import org.eclipse.rse.internal.core.model.RSEModelResources; +import org.eclipse.rse.internal.core.RSECoreMessages; import org.eclipse.rse.internal.core.subsystems.ServerLauncher; @@ -140,14 +141,14 @@ public class RemoteServerLauncher extends ServerLauncher implements IRemoteServe try { IProperty launchTypeProperty = set.getProperty(KEY_SERVER_LAUNCH_TYPE_NAME); - launchTypeProperty.setLabel(RSEModelResources.RESID_PROP_SERVERLAUNCHER_MEANS_LABEL); + launchTypeProperty.setLabel(RSECoreMessages.RESID_PROP_SERVERLAUNCHER_MEANS_LABEL); String launchTypeName = launchTypeProperty.getValue(); _serverLaunchType = ServerLaunchType.get(launchTypeName); IProperty daemonPortProperty = set.getProperty(KEY_DAEMON_PORT); boolean daemon = _serverLaunchType == null || _serverLaunchType.getType() == ServerLaunchType.DAEMON; daemonPortProperty.setEnabled(daemon); - daemonPortProperty.setLabel(RSEModelResources.RESID_CONNECTION_DAEMON_PORT_LABEL); + daemonPortProperty.setLabel(RSECoreMessages.RESID_CONNECTION_DAEMON_PORT_LABEL); _daemonPort = Integer.parseInt(daemonPortProperty.getValue()); @@ -156,7 +157,7 @@ public class RemoteServerLauncher extends ServerLauncher implements IRemoteServe { boolean autoDetect = _serverLaunchType == null || _serverLaunchType.getType() == ServerLaunchType.REXEC; autoDetectProperty.setEnabled(autoDetect); - autoDetectProperty.setLabel(RSEModelResources.RESID_SUBSYSTEM_AUTODETECT_LABEL); + autoDetectProperty.setLabel(RSECoreMessages.RESID_SUBSYSTEM_AUTODETECT_LABEL); _autoDetectSSL = Boolean.getBoolean(autoDetectProperty.getValue()); } @@ -164,18 +165,18 @@ public class RemoteServerLauncher extends ServerLauncher implements IRemoteServe boolean usingRexec = _serverLaunchType != null && _serverLaunchType.getType() == ServerLaunchType.REXEC; IProperty rexecPortProperty = set.getProperty(KEY_REXEC_PORT); rexecPortProperty.setEnabled(usingRexec); - rexecPortProperty.setLabel(RSEModelResources.RESID_CONNECTION_PORT_LABEL); + rexecPortProperty.setLabel(RSECoreMessages.RESID_CONNECTION_PORT_LABEL); _rexecPort = Integer.parseInt(rexecPortProperty.getValue()); IProperty serverPathProperty = set.getProperty(KEY_SERVER_PATH); serverPathProperty.setEnabled(usingRexec); - serverPathProperty.setLabel(RSEModelResources.RESID_PROP_SERVERLAUNCHER_PATH); + serverPathProperty.setLabel(RSECoreMessages.RESID_PROP_SERVERLAUNCHER_PATH); _serverPath = serverPathProperty.getValue(); IProperty serverScriptProperty = set.getProperty(KEY_SERVER_SCRIPT); serverScriptProperty.setEnabled(usingRexec); - serverScriptProperty.setLabel(RSEModelResources.RESID_PROP_SERVERLAUNCHER_INVOCATION); + serverScriptProperty.setLabel(RSECoreMessages.RESID_PROP_SERVERLAUNCHER_INVOCATION); _serverScript = serverScriptProperty.getValue(); _hasSetServerLaunchType = true; @@ -199,28 +200,28 @@ public class RemoteServerLauncher extends ServerLauncher implements IRemoteServe if (_serverLaunchType == null) _serverLaunchType = ServerLaunchType.get(ServerLaunchType.DAEMON); IProperty launchTypeProperty = set.addProperty(KEY_SERVER_LAUNCH_TYPE_NAME, _serverLaunchType.getName(), getServerLauncherPropertyType()); - launchTypeProperty.setLabel(RSEModelResources.RESID_PROP_SERVERLAUNCHER_MEANS_LABEL); + launchTypeProperty.setLabel(RSECoreMessages.RESID_PROP_SERVERLAUNCHER_MEANS_LABEL); IProperty daemonPortProperty = set.addProperty(KEY_DAEMON_PORT, ""+_daemonPort, PropertyType.getIntegerPropertyType()); //$NON-NLS-1$ daemonPortProperty.setEnabled(_serverLaunchType.getType() == ServerLaunchType.DAEMON); - daemonPortProperty.setLabel(RSEModelResources.RESID_CONNECTION_DAEMON_PORT_LABEL); + daemonPortProperty.setLabel(RSECoreMessages.RESID_CONNECTION_DAEMON_PORT_LABEL); IProperty rexecPortProperty = set.addProperty(KEY_REXEC_PORT, ""+_rexecPort, PropertyType.getIntegerPropertyType()); //$NON-NLS-1$ boolean usingRexec = _serverLaunchType.getType() == ServerLaunchType.REXEC; rexecPortProperty.setEnabled(usingRexec); - rexecPortProperty.setLabel(RSEModelResources.RESID_CONNECTION_PORT_LABEL); + rexecPortProperty.setLabel(RSECoreMessages.RESID_CONNECTION_PORT_LABEL); IProperty autoDetectSSLProperty = set.addProperty(KEY_AUTODETECT_SSL, ""+_autoDetectSSL, PropertyType.getBooleanPropertyType()); //$NON-NLS-1$ autoDetectSSLProperty.setEnabled(usingRexec); - autoDetectSSLProperty.setLabel(RSEModelResources.RESID_SUBSYSTEM_AUTODETECT_LABEL); + autoDetectSSLProperty.setLabel(RSECoreMessages.RESID_SUBSYSTEM_AUTODETECT_LABEL); IProperty serverPathProperty = set.addProperty(KEY_SERVER_PATH, ""+_serverPath); //$NON-NLS-1$ - serverPathProperty.setLabel(RSEModelResources.RESID_PROP_SERVERLAUNCHER_PATH); + serverPathProperty.setLabel(RSECoreMessages.RESID_PROP_SERVERLAUNCHER_PATH); serverPathProperty.setEnabled(usingRexec); IProperty serverScriptProperty = set.addProperty(KEY_SERVER_SCRIPT, ""+_serverScript); //$NON-NLS-1$ serverScriptProperty.setEnabled(usingRexec); - serverScriptProperty.setLabel(RSEModelResources.RESID_PROP_SERVERLAUNCHER_INVOCATION); + serverScriptProperty.setLabel(RSECoreMessages.RESID_PROP_SERVERLAUNCHER_INVOCATION); } diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/RSEModelResources.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSECoreMessages.java similarity index 57% rename from rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/RSEModelResources.java rename to rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSECoreMessages.java index b0e9389dfbf..7ca785bbe56 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/RSEModelResources.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSECoreMessages.java @@ -1,30 +1,26 @@ /******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * * Contributors: + * David Dykstal (IBM) - initial API and implementation * David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies + * Martin Oberhuber (Wind River) - [184095] combined RSEModelResources and persistence.Messages into this file ********************************************************************************/ - -package org.eclipse.rse.internal.core.model; +package org.eclipse.rse.internal.core; import org.eclipse.osgi.util.NLS; -/** - * This class contains bundle resources for model objects. - */ -public class RSEModelResources extends NLS { - - private static String BUNDLE_NAME = "org.eclipse.rse.internal.core.model.RSEModelResources"; //$NON-NLS-1$ +public class RSECoreMessages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.rse.internal.core.messages"; //$NON-NLS-1$ + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, RSECoreMessages.class); + } + // Model public static String RESID_MODELOBJECTS_MODELOBJECT_DESCRIPTION; public static String RESID_MODELOBJECTS_REFERENCINGOBJECT_DESCRIPTION; public static String RESID_MODELOBJECTS_FILTERSTRING_DESCRIPTION; @@ -41,11 +37,17 @@ public class RSEModelResources extends NLS { public static String RESID_CONNECTION_PORT_LABEL; public static String RESID_SUBSYSTEM_AUTODETECT_LABEL; + // Persistence + public static String PropertyFileProvider_LoadingTaskName; + public static String PropertyFileProvider_SavingTaskName; + public static String PropertyFileProvider_UnexpectedException; + public static String RSEPersistenceManager_DeleteProfileJobName; + public static String SaveRSEDOMJob_SavingProfileJobName; + public static String SerializingProvider_UnexpectedException; - static { - // load message values from bundle file - NLS.initializeMessages(BUNDLE_NAME, RSEModelResources.class); + // Password Persistence Manager + public static String DefaultSystemType_Label; + + private RSECoreMessages() { } - - -} \ No newline at end of file +} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSESystemType.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSESystemType.java index d38deb5ae7d..876d6409d70 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSESystemType.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSESystemType.java @@ -12,6 +12,7 @@ * * Contributors: * Uwe Stieber (Wind River) - Dynamic system type provider extension. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.core; @@ -25,6 +26,7 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.PlatformObject; import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.IRSESystemTypeConstants; +import org.eclipse.rse.core.RSECorePlugin; import org.osgi.framework.Bundle; /** @@ -58,6 +60,13 @@ public class RSESystemType extends PlatformObject implements IRSESystemType { id = element.getAttribute(ATTR_ID); name = element.getAttribute(ATTR_NAME); + if (id==null) { + RSECorePlugin.getDefault().getLogger().logWarning("RSE: System Type \""+name+"\" does not define an ID"); //$NON-NLS-1$ //$NON-NLS-2$ + //Fallback: use the name as ID. When PDE was used to define the + //extension, this should never happen since ID is marked as a + //required attribute. + id = name; + } label = element.getAttribute(ATTR_LABEL); description = element.getAttribute(ATTR_DESCRIPTION); @@ -85,6 +94,27 @@ public class RSESystemType extends PlatformObject implements IRSESystemType { subsystemConfigurationIds = (String[])subsystemConfigs.toArray(new String[subsystemConfigs.size()]); } + /** + * Checks whether two system types are the same. + * + * System types are considered the same if they have the same ID. + */ + public boolean equals(Object obj) { + if (obj instanceof IRSESystemType) { + return id.equals( ((IRSESystemType)obj).getId() ); + } + return false; + } + + /** + * Returns the hashCode for this system type. + * + * The hashCode is the hashCode of its ID. + */ + public int hashCode() { + return id.hashCode(); + } + /** * Loads properties defined for the system type. * @param element the configuration element @@ -114,14 +144,15 @@ public class RSESystemType extends PlatformObject implements IRSESystemType { */ public String getLabel() { // For default RSE system types, the UI label is equal to the - // name. Therefor, fallback to the name if the label is not + // name. Therefore, fallback to the name if the label is not // explicitly set. if (label == null) return getName(); return label; } - /* (non-Javadoc) - * @see org.eclipse.rse.core.IRSESystemType#getName() + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.IRSESystemType#getNameOfSystemTypeDeprecated() */ public String getName() { return name; diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilter.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilter.java index 121ae4001e2..fac3b9a7865 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilter.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilter.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -12,6 +12,7 @@ * * Contributors: * David Dykstal (IBM) - 142806: refactoring persistence framework + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.core.filters; @@ -36,7 +37,7 @@ import org.eclipse.rse.core.filters.SystemFilterSimple; import org.eclipse.rse.core.model.IRSEPersistableContainer; import org.eclipse.rse.core.model.ISystemProfile; import org.eclipse.rse.core.references.IRSEReferencedObject; -import org.eclipse.rse.internal.core.model.RSEModelResources; +import org.eclipse.rse.internal.core.RSECoreMessages; import org.eclipse.rse.internal.references.SystemReferencedObject; @@ -1022,7 +1023,7 @@ public class SystemFilter extends SystemReferencedObject implements ISystemFilte public String getDescription() { - return RSEModelResources.RESID_MODELOBJECTS_FILTER_DESCRIPTION; + return RSECoreMessages.RESID_MODELOBJECTS_FILTER_DESCRIPTION; } /** diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPool.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPool.java index 7df35a7a6aa..6cce211d404 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPool.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterPool.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -13,6 +13,7 @@ * Contributors: * David Dykstal (IBM) - removing implementation of ISystemFilterSavePolicies, ISystemFilterConstants * David Dykstal (IBM) - 142806: refactoring persistence framework + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.core.filters; @@ -35,7 +36,7 @@ import org.eclipse.rse.core.filters.ISystemFilterPoolManagerProvider; import org.eclipse.rse.core.filters.SystemFilterNamingPolicy; import org.eclipse.rse.core.model.IRSEPersistableContainer; import org.eclipse.rse.core.model.ISystemProfile; -import org.eclipse.rse.internal.core.model.RSEModelResources; +import org.eclipse.rse.internal.core.RSECoreMessages; import org.eclipse.rse.internal.references.SystemPersistableReferencedObject; @@ -465,7 +466,7 @@ public class SystemFilterPool extends SystemPersistableReferencedObject public String getDescription() { - return RSEModelResources.RESID_MODELOBJECTS_FILTERPOOL_DESCRIPTION; + return RSECoreMessages.RESID_MODELOBJECTS_FILTERPOOL_DESCRIPTION; } /** diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterString.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterString.java index c84b05da397..7c49640cd32 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterString.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/filters/SystemFilterString.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -12,6 +12,7 @@ * * Contributors: * David Dykstal (IBM) - 142806: refactoring persistence framework + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.core.filters; @@ -25,7 +26,7 @@ import org.eclipse.rse.core.filters.ISystemFilterString; import org.eclipse.rse.core.model.IRSEPersistableContainer; import org.eclipse.rse.core.model.RSEModelObject; import org.eclipse.rse.core.references.IRSEBaseReferencingObject; -import org.eclipse.rse.internal.core.model.RSEModelResources; +import org.eclipse.rse.internal.core.RSECoreMessages; import org.eclipse.rse.internal.references.SystemReferencedObjectHelper; @@ -219,7 +220,7 @@ public class SystemFilterString extends RSEModelObject implements ISystemFilterS public String getDescription() { - return RSEModelResources.RESID_MODELOBJECTS_FILTERSTRING_DESCRIPTION; + return RSECoreMessages.RESID_MODELOBJECTS_FILTERSTRING_DESCRIPTION; } public String getString() diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/RSEModelResources.properties b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/messages.properties similarity index 65% rename from rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/RSEModelResources.properties rename to rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/messages.properties index f20991271f6..6c90e04e95b 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/RSEModelResources.properties +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/messages.properties @@ -1,22 +1,20 @@ -################################################################################ -# 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 -# -# Initial Contributors: -# The following IBM employees contributed to the Remote System Explorer -# component that contains this file: David McKnight, Kushal Munir, -# Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, -# Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. -# +############################################################################### +# Copyright (c) 2000, 2007 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# # Contributors: +# David Dykstal (IBM) - initial API and implementation # David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies -################################################################################ +# Martin Oberhuber (Wind River) - [184095] combined RSEModelResources and persistence.Messages into this file +############################################################################### # NLS_MESSAGEFORMAT_VAR # NLS_ENCODING=UTF-8 +# Model RESID_MODELOBJECTS_MODELOBJECT_DESCRIPTION=An RSE Model Object represents any object in the Remote System Explorer. RESID_MODELOBJECTS_REFERENCINGOBJECT_DESCRIPTION=A Referencing Object encapsulates the operations required of an object which is merely a reference to another object. RESID_MODELOBJECTS_FILTERSTRING_DESCRIPTION=A filter string is a single string in a filter. It describes which files will pass through the filter. @@ -32,3 +30,14 @@ RESID_PROP_SERVERLAUNCHER_PATH=Path to installed server on host RESID_PROP_SERVERLAUNCHER_INVOCATION=Server launch command RESID_CONNECTION_PORT_LABEL=Port RESID_CONNECTION_DAEMON_PORT_LABEL=Daemon Port + +# Persistence +RSEPersistenceManager_DeleteProfileJobName=Delete RSE Profile Job +PropertyFileProvider_SavingTaskName=Saving DOM +PropertyFileProvider_UnexpectedException=Unexpected Exception +PropertyFileProvider_LoadingTaskName=Loading DOM +SaveRSEDOMJob_SavingProfileJobName=Saving RSE Profile {0} +SerializingProvider_UnexpectedException=Unexpected Exception + +# Password Persistence Manager +DefaultSystemType_Label=Default diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemProfile.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemProfile.java index 25d06e9b17f..5968fec141c 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemProfile.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/model/SystemProfile.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -12,6 +12,7 @@ * * Contributors: * David Dykstal (IBM) - 142806: refactoring persistence framework + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.core.model; @@ -22,6 +23,7 @@ import java.util.Vector; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.Platform; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.filters.ISystemFilterPool; import org.eclipse.rse.core.filters.ISystemFilterPoolManager; @@ -32,6 +34,7 @@ import org.eclipse.rse.core.model.ISystemProfileManager; import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.core.model.RSEModelObject; import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; +import org.eclipse.rse.internal.core.RSECoreMessages; import org.eclipse.rse.persistence.IRSEPersistenceProvider; /** @@ -80,7 +83,7 @@ public class SystemProfile extends RSEModelObject implements ISystemProfile, IAd * Convenience method for create a new connection within this profile. * Shortcut for {@link ISystemRegistry#createHost(String,String,String,String)} */ - public IHost createHost(String systemType, String connectionName, String hostName, String description) throws Exception + public IHost createHost(IRSESystemType systemType, String connectionName, String hostName, String description) throws Exception { return RSECorePlugin.getDefault().getSystemRegistry().createHost(getName(), systemType, connectionName, hostName, description); } @@ -174,7 +177,7 @@ public class SystemProfile extends RSEModelObject implements ISystemProfile, IAd public String getDescription() { - return RSEModelResources.RESID_MODELOBJECTS_PROFILE_DESCRIPTION; + return RSECoreMessages.RESID_MODELOBJECTS_PROFILE_DESCRIPTION; } /** diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/ServerLauncher.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/ServerLauncher.java index 19a1e228d69..22a198c3130 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/ServerLauncher.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/ServerLauncher.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2004, 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2004, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -13,6 +13,7 @@ * Contributors: * David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies * David Dykstal (IBM) - 142806: refactoring persistence framework + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.core.subsystems; @@ -24,7 +25,7 @@ import org.eclipse.rse.core.model.IRSEPersistableContainer; import org.eclipse.rse.core.model.RSEModelObject; import org.eclipse.rse.core.subsystems.IConnectorService; import org.eclipse.rse.core.subsystems.IServerLauncherProperties; -import org.eclipse.rse.internal.core.model.RSEModelResources; +import org.eclipse.rse.internal.core.RSECoreMessages; public abstract class ServerLauncher extends RSEModelObject implements IServerLauncherProperties @@ -48,7 +49,7 @@ public abstract class ServerLauncher extends RSEModelObject implements IServerLa public String getDescription() { - return RSEModelResources.RESID_MODELOBJECTS_SERVERLAUNCHER_DESCRIPTION; + return RSECoreMessages.RESID_MODELOBJECTS_SERVERLAUNCHER_DESCRIPTION; } public IConnectorService getConnectorService() diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/SubSystemConfigurationProxy.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/SubSystemConfigurationProxy.java index 147e3f93542..e4d7037b415 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/SubSystemConfigurationProxy.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/subsystems/SubSystemConfigurationProxy.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -14,14 +14,15 @@ * Uwe Stieber (Wind River) - systemTypeIds attribute extension and dynamic association * of system types. * David Dykstal (IBM) - 168870: move core function from UI to core + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.core.subsystems; import java.net.MalformedURLException; import java.net.URL; +import java.util.ArrayList; import java.util.Arrays; -import java.util.LinkedList; import java.util.List; import org.eclipse.core.runtime.IConfigurationElement; @@ -51,7 +52,7 @@ public class SubSystemConfigurationProxy implements ISubSystemConfigurationProxy private String systemTypeIds; // The list of resolved system types supported by this subsystem configuration. - private List resolvedSystemTypes; + private IRSESystemType[] resolvedSystemTypes; // The subsystem configuration vendor private String vendor; @@ -145,35 +146,35 @@ public class SubSystemConfigurationProxy implements ISubSystemConfigurationProxy /* (non-Javadoc) * @see org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy#getSystemTypes() */ - public String[] getSystemTypes() { + public IRSESystemType[] getSystemTypes() { if (resolvedSystemTypes == null) { - resolvedSystemTypes = new LinkedList(); + IRSESystemType[] systemTypes = RSECorePlugin.getDefault().getRegistry().getSystemTypes(); // If the subsystem configuration supports all system types, just add all - // currently registered system types to th resolved list + // currently registered system types to the resolved list if (supportsAllSystemTypes()) { - IRSESystemType[] systemTypes = RSECorePlugin.getDefault().getRegistry().getSystemTypes(); - for (int i = 0; i < systemTypes.length; i++) resolvedSystemTypes.add(systemTypes[i].getName()); + resolvedSystemTypes = systemTypes; } else { // We have to match the given lists of system type ids against // the list of available system types. As the list of system types cannot // change ones it has been initialized, we filter out the not matching ones // here directly. - IRSESystemType[] systemTypes = RSECorePlugin.getDefault().getRegistry().getSystemTypes(); + List systemTypesList = new ArrayList(systemTypes.length); for (int i = 0; i < systemTypes.length; i++) { IRSESystemType systemType = systemTypes[i]; if (isMatchingDeclaredSystemTypes(systemType) - || (systemType.getSubsystemConfigurationIds() != null - && Arrays.asList(systemType.getSubsystemConfigurationIds()).contains(getId()))) { - if (!resolvedSystemTypes.contains(systemType.getName())) { - resolvedSystemTypes.add(systemType.getName()); + || (systemType.getSubsystemConfigurationIds() != null + && Arrays.asList(systemType.getSubsystemConfigurationIds()).contains(getId())) + ) { + if (!systemTypesList.contains(systemType)) { + systemTypesList.add(systemType); } } } + resolvedSystemTypes = (IRSESystemType[])systemTypesList.toArray(new IRSESystemType[systemTypesList.size()]); } } - - return (String[])resolvedSystemTypes.toArray(new String[resolvedSystemTypes.size()]); + return resolvedSystemTypes; } /** @@ -210,7 +211,7 @@ public class SubSystemConfigurationProxy implements ISubSystemConfigurationProxy /** * Return true if this extension's systemTypes attribute matches the given system type name. */ - public boolean appliesToSystemType(String type) { + public boolean appliesToSystemType(IRSESystemType type) { assert type != null; if (systemTypeMatcher.supportsAllSystemTypes()) return true; return Arrays.asList(getSystemTypes()).contains(type); diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/Messages.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/Messages.java deleted file mode 100644 index a33c0db3fcb..00000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/Messages.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2006 IBM Corporation. All rights reserved. - * This program and the accompanying materials are made available under the terms - * of the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * David Dykstal (IBM) - initial API and implementation - ********************************************************************************/ -package org.eclipse.rse.internal.persistence; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.rse.internal.persistence.messages"; //$NON-NLS-1$ - public static String PropertyFileProvider_LoadingTaskName; - public static String PropertyFileProvider_SavingTaskName; - public static String PropertyFileProvider_UnexpectedException; - public static String RSEPersistenceManager_DeleteProfileJobName; - public static String SaveRSEDOMJob_SavingProfileJobName; - public static String SerializingProvider_UnexpectedException; - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } -} diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PropertyFileProvider.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PropertyFileProvider.java index ed92e537bed..323a2a60ca2 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PropertyFileProvider.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/PropertyFileProvider.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,6 +11,7 @@ * Contributors: * David Dykstal (IBM) - removed printlns, printStackTrace and added logging. * David Dykstal (IBM) - [177882] fixed escapeValue for garbling of CJK characters + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.persistence; @@ -45,6 +46,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status; import org.eclipse.rse.core.RSECorePlugin; +import org.eclipse.rse.internal.core.RSECoreMessages; import org.eclipse.rse.logging.Logger; import org.eclipse.rse.persistence.IRSEPersistenceProvider; import org.eclipse.rse.persistence.dom.IRSEDOMConstants; @@ -132,7 +134,7 @@ public class PropertyFileProvider implements IRSEPersistenceProvider { IFolder providerFolder = getProviderFolder(); try { int n = countNodes(dom); - if (monitor != null) monitor.beginTask(Messages.PropertyFileProvider_SavingTaskName, n); + if (monitor != null) monitor.beginTask(RSECoreMessages.PropertyFileProvider_SavingTaskName, n); saveNode(dom, providerFolder, monitor); if (monitor != null) monitor.done(); } catch (Exception e) { @@ -152,7 +154,7 @@ public class PropertyFileProvider implements IRSEPersistenceProvider { try { profileFolder.delete(IResource.FORCE, monitor); } catch (CoreException e) { - result = new Status(IStatus.ERROR, null, 0, Messages.PropertyFileProvider_UnexpectedException, e); + result = new Status(IStatus.ERROR, null, 0, RSECoreMessages.PropertyFileProvider_UnexpectedException, e); } } return result; @@ -538,7 +540,7 @@ public class PropertyFileProvider implements IRSEPersistenceProvider { IFolder profileFolder = getProfileFolder(profileName); if (profileFolder.exists()) { int n = countPropertiesFiles(profileFolder); - if (monitor != null) monitor.beginTask(Messages.PropertyFileProvider_LoadingTaskName, n); + if (monitor != null) monitor.beginTask(RSECoreMessages.PropertyFileProvider_LoadingTaskName, n); dom = (RSEDOM) loadNode(null, profileFolder, monitor); if (monitor != null) monitor.done(); } else { diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/RSEPersistenceManager.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/RSEPersistenceManager.java index 2f95aa4d283..c34f00fe976 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/RSEPersistenceManager.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/RSEPersistenceManager.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -12,6 +12,7 @@ * * Contributors: * David Dykstal (IBM) - 142806: refactoring persistence framework + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.persistence; @@ -37,6 +38,7 @@ import org.eclipse.rse.core.SystemResourceManager; import org.eclipse.rse.core.model.IRSEPersistableContainer; import org.eclipse.rse.core.model.ISystemProfile; import org.eclipse.rse.core.model.ISystemRegistry; +import org.eclipse.rse.internal.core.RSECoreMessages; import org.eclipse.rse.internal.core.model.SystemProfileManager; import org.eclipse.rse.internal.persistence.dom.RSEDOMExporter; import org.eclipse.rse.internal.persistence.dom.RSEDOMImporter; @@ -142,7 +144,7 @@ public class RSEPersistenceManager implements IRSEPersistenceManager { * @see org.eclipse.rse.persistence.IRSEPersistenceManager#deleteProfile(java.lang.String) */ public void deleteProfile(final IRSEPersistenceProvider persistenceProvider, final String profileName) { - Job job = new Job(Messages.RSEPersistenceManager_DeleteProfileJobName) { + Job job = new Job(RSECoreMessages.RSEPersistenceManager_DeleteProfileJobName) { protected IStatus run(IProgressMonitor monitor) { IRSEPersistenceProvider p = persistenceProvider != null ? persistenceProvider : getDefaultPersistenceProvider(); IStatus result = p.deleteProfile(profileName, monitor); diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/SaveRSEDOMJob.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/SaveRSEDOMJob.java index 14af2e80fce..e51a5e4275b 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/SaveRSEDOMJob.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/SaveRSEDOMJob.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,7 +11,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.persistence; @@ -23,6 +23,7 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.rse.core.RSECorePlugin; +import org.eclipse.rse.internal.core.RSECoreMessages; import org.eclipse.rse.persistence.IRSEPersistenceProvider; import org.eclipse.rse.persistence.dom.RSEDOM; @@ -38,7 +39,7 @@ public class SaveRSEDOMJob extends WorkspaceJob { public SaveRSEDOMJob(RSEDOM dom, IRSEPersistenceProvider provider) { super("Saving Profile"); //$NON-NLS-1$ - String title = MessageFormat.format(Messages.SaveRSEDOMJob_SavingProfileJobName, new Object[] { dom.getName() }); + String title = MessageFormat.format(RSECoreMessages.SaveRSEDOMJob_SavingProfileJobName, new Object[] { dom.getName() }); setName(title); _dom = dom; _provider = provider; diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/SerializingProvider.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/SerializingProvider.java index a87e3a4dda0..4ecbd466cbf 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/SerializingProvider.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/SerializingProvider.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,7 +11,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.persistence; @@ -33,6 +33,7 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; +import org.eclipse.rse.internal.core.RSECoreMessages; import org.eclipse.rse.persistence.IRSEPersistenceProvider; import org.eclipse.rse.persistence.dom.RSEDOM; @@ -157,7 +158,7 @@ public class SerializingProvider implements IRSEPersistenceProvider { try { profileFile.delete(IResource.FORCE | IResource.KEEP_HISTORY, monitor); } catch (CoreException e) { - result = new Status(IStatus.ERROR, null, 0, Messages.SerializingProvider_UnexpectedException, e); + result = new Status(IStatus.ERROR, null, 0, RSECoreMessages.SerializingProvider_UnexpectedException, e); } } return result; diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMExporter.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMExporter.java index e98f0d2c9dd..7fdc5959db5 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMExporter.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMExporter.java @@ -12,6 +12,7 @@ * * Contributors: * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.persistence.dom; @@ -21,6 +22,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.filters.ISystemFilter; import org.eclipse.rse.core.filters.ISystemFilterPool; import org.eclipse.rse.core.filters.ISystemFilterPoolReference; @@ -316,7 +318,8 @@ public class RSEDOMExporter implements IRSEDOMExporter { RSEDOMNode node = findOrCreateNode(parent, IRSEDOMConstants.TYPE_CONNECTOR_SERVICE, connectorService, clean); if (clean || node.isDirty()) { // store it's attributes - node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, connectorService.getHostType()); + IRSESystemType systemType = connectorService.getHost().getSystemType(); + node.addAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE, systemType.getName()); // can't do this til connector service owns the properties (right now it's still subsystem) node.addAttribute(IRSEDOMConstants.ATTRIBUTE_GROUP, connectorService.getName()); diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java index 11134c331f9..6541ccb4f90 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/dom/RSEDOMImporter.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,13 +11,15 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.persistence.dom; import java.util.Vector; +import org.eclipse.rse.core.IRSESystemType; +import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.filters.ISystemFilter; import org.eclipse.rse.core.filters.ISystemFilterPool; import org.eclipse.rse.core.filters.ISystemFilterPoolManager; @@ -99,7 +101,7 @@ public class RSEDOMImporter { // get host node attributes String connectionName = hostNode.getName(); - String systemType = hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue(); + String systemTypeName = hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_TYPE).getValue(); String hostName = hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_HOSTNAME).getValue(); String description = hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_DESCRIPTION).getValue(); boolean isOffline = getBooleanValue(hostNode.getAttribute(IRSEDOMConstants.ATTRIBUTE_OFFLINE).getValue()); @@ -109,6 +111,7 @@ public class RSEDOMImporter { try { // NOTE create host effectively recreates the subsystems // so instead of creating subsystems on restore, we should be updating their properties + IRSESystemType systemType = RSECorePlugin.getDefault().getRegistry().getSystemType(systemTypeName); host = profile.createHost(systemType, connectionName, hostName, description); host.setOffline(isOffline); host.setPromptable(isPromptable); diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/messages.properties b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/messages.properties deleted file mode 100644 index 94d3f589651..00000000000 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/persistence/messages.properties +++ /dev/null @@ -1,20 +0,0 @@ -############################################################################### -# Copyright (c) 2006 IBM Corporation. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# David Dykstal (IBM) - initial API and implementation -############################################################################### - -# NLS_MESSAGEFORMAT_VAR -# NLS_ENCODING=UTF-8 - -RSEPersistenceManager_DeleteProfileJobName=Delete RSE Profile Job -PropertyFileProvider_SavingTaskName=Saving DOM -PropertyFileProvider_UnexpectedException=Unexpected Exception -PropertyFileProvider_LoadingTaskName=Loading DOM -SaveRSEDOMJob_SavingProfileJobName=Saving RSE Profile {0} -SerializingProvider_UnexpectedException=Unexpected Exception diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemReferencingObject.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemReferencingObject.java index 8203d1fb2b2..fe673349d8c 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemReferencingObject.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/references/SystemReferencingObject.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,7 +11,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.references; @@ -19,7 +19,7 @@ package org.eclipse.rse.internal.references; import org.eclipse.rse.core.model.RSEModelObject; import org.eclipse.rse.core.references.IRSEBaseReferencedObject; import org.eclipse.rse.core.references.IRSEReferencingObject; -import org.eclipse.rse.internal.core.model.RSEModelResources; +import org.eclipse.rse.internal.core.RSECoreMessages; /** * A class to encapsulate the operations required of an object which @@ -32,36 +32,36 @@ import org.eclipse.rse.internal.core.model.RSEModelResources; * These references are not persistent. Persistent references are managed * by the subclass SystemPersistableReferencingObject. */ -/** - * @lastgen class SystemReferencingObjectImpl Impl implements SystemReferencingObject, EObject {} - */ public abstract class SystemReferencingObject extends RSEModelObject implements IRSEReferencingObject { private SystemReferencingObjectHelper helper = null; protected boolean referenceBroken = false; /** - * Default constructor. Typically called by EMF factory method. + * Default constructor. */ protected SystemReferencingObject() { super(); helper = new SystemReferencingObjectHelper(this); } - /** - * @see org.eclipse.rse.core.references.IRSEBaseReferencingObject#setReferencedObject(IRSEBaseReferencedObject) + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.references.IRSEBaseReferencingObject#setReferencedObject(org.eclipse.rse.core.references.IRSEBaseReferencedObject) */ public void setReferencedObject(IRSEBaseReferencedObject obj) { helper.setReferencedObject(obj); } - /** + /* + * (non-Javadoc) * @see org.eclipse.rse.core.references.IRSEBaseReferencingObject#getReferencedObject() */ public IRSEBaseReferencedObject getReferencedObject() { return helper.getReferencedObject(); } - /** + /* + * (non-Javadoc) * @see org.eclipse.rse.core.references.IRSEBaseReferencingObject#removeReference() */ public int removeReference() { @@ -83,7 +83,7 @@ public abstract class SystemReferencingObject extends RSEModelObject implements } public String getDescription() { - return RSEModelResources.RESID_MODELOBJECTS_REFERENCINGOBJECT_DESCRIPTION; + return RSECoreMessages.RESID_MODELOBJECTS_REFERENCINGOBJECT_DESCRIPTION; } protected final SystemReferencingObjectHelper getHelper() { diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemSelectRemoteFileAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemSelectRemoteFileAction.java index db2dbe0f870..1417d53bf7c 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemSelectRemoteFileAction.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemSelectRemoteFileAction.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,7 +11,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.files.ui.actions; @@ -21,6 +21,7 @@ import java.util.List; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.viewers.ViewerFilter; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.files.ui.ISystemAddFileListener; import org.eclipse.rse.files.ui.dialogs.SystemSelectRemoteFileOrFolderDialog; @@ -39,7 +40,7 @@ import org.eclipse.swt.widgets.Shell; *
      *
    • {@link #setShowNewConnectionPrompt(boolean)} *
    • {@link #setHost(IHost) or #setDefaultConnection(SystemConnection)} - *
    • {@link #setSystemType(String)} or {@link #setSystemTypes(String[])} + *
    • {@link #setSystemType(IRSESystemType)} or {@link #setSystemTypes(IRSESystemType[])} *
    • {@link #setRootFolder(IHost, String)} or {@link #setRootFolder(IRemoteFile)} or {@link #setPreSelection(IRemoteFile)} *
    • {@link #setFileTypes(String[])} or {@link #setFileTypes(String)} *
    • {@link #setAutoExpandDepth(int)} @@ -64,7 +65,7 @@ import org.eclipse.swt.widgets.Shell; */ public class SystemSelectRemoteFileAction extends SystemBaseDialogAction { - private String[] systemTypes; + private IRSESystemType[] systemTypes; private IHost systemConnection, outputConnection; private IHost rootFolderConnection; private IRemoteFile preSelection; @@ -130,30 +131,34 @@ public class SystemSelectRemoteFileAction extends SystemBaseDialogAction } /** - * Set the system types to restrict what connections the user sees, and what types of - * connections they can create. - * @param systemTypes An array of system type names + * Set the system types to restrict what connections the user sees, + * and what types of connections they can create. * - * @see org.eclipse.rse.core.IRSESystemType + * @param systemTypes An array of system types, or + * null to allow all registered valid system types. + * A system type is valid if at least one subsystem configuration + * is registered against it. */ - public void setSystemTypes(String[] systemTypes) + public void setSystemTypes(IRSESystemType[] systemTypes) { this.systemTypes = systemTypes; } + /** * Convenience method to restrict to a single system type. - * Same as setSystemTypes(new String[] {systemType}) + * Same as setSystemTypes(new IRSESystemType[] {systemType}) * - * @param systemType The name of the system type to restrict to - * - * @see org.eclipse.rse.core.IRSESystemType + * @param systemType The name of the system type to restrict to, or + * null to allow all registered valid system types. + * A system type is valid if at least one subsystem configuration + * is registered against it. */ - public void setSystemType(String systemType) + public void setSystemType(IRSESystemType systemType) { if (systemType == null) setSystemTypes(null); else - setSystemTypes(new String[] {systemType}); + setSystemTypes(new IRSESystemType[] {systemType}); } /** diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemSelectRemoteFolderAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemSelectRemoteFolderAction.java index fe084300987..a8a8dafb688 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemSelectRemoteFolderAction.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/actions/SystemSelectRemoteFolderAction.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,11 +11,12 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.files.ui.actions; import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.files.ui.ISystemAddFileListener; import org.eclipse.rse.files.ui.dialogs.SystemRemoteFileDialog; @@ -36,7 +37,7 @@ import org.eclipse.swt.widgets.Shell; *
        *
      • {@link #setShowNewConnectionPrompt(boolean)} *
      • {@link #setHost(IHost) or #setDefaultConnection(SystemConnection)} - *
      • {@link #setSystemType(String)} or {@link #setSystemTypes(String[])} + *
      • {@link #setSystemType(IRSESystemType)} or {@link #setSystemTypes(IRSESystemType[])} *
      • {@link #setRootFolder(IHost, String)} or {@link #setRootFolder(IRemoteFile)} or {@link #setPreSelection(IRemoteFile)} *
      • {@link #setAutoExpandDepth(int)} *
      • {@link #setShowPropertySheet(boolean)} @@ -60,7 +61,7 @@ import org.eclipse.swt.widgets.Shell; */ public class SystemSelectRemoteFolderAction extends SystemBaseDialogAction { - private String[] systemTypes; + private IRSESystemType[] systemTypes; private boolean foldersOnly = false; private IHost systemConnection, outputConnection; private IHost rootFolderConnection; @@ -159,7 +160,7 @@ public class SystemSelectRemoteFolderAction extends SystemBaseDialogAction * * @see org.eclipse.rse.core.IRSESystemType */ - public void setSystemTypes(String[] systemTypes) + public void setSystemTypes(IRSESystemType[] systemTypes) { this.systemTypes = systemTypes; } @@ -167,16 +168,17 @@ public class SystemSelectRemoteFolderAction extends SystemBaseDialogAction * Convenience method to restrict to a single system type. * Same as setSystemTypes(new String[] {systemType}) * - * @param systemType The name of the system type to restrict to - * - * @see org.eclipse.rse.core.IRSESystemType + * @param systemType The name of the system type to restrict to, + * or null to allow all valid system types. + * A system type is valid if at least one subsystem + * configuration is registered against it. */ - public void setSystemType(String systemType) + public void setSystemType(IRSESystemType systemType) { if (systemType == null) setSystemTypes(null); else - setSystemTypes(new String[] {systemType}); + setSystemTypes(new IRSESystemType[] {systemType}); } /** diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/CombineDialog.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/CombineDialog.java index 47f4e74d0e8..f4a8dd302fa 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/CombineDialog.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/CombineDialog.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2003, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2003, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,7 +11,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.files.ui.dialogs; diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/ExtractToDialog.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/ExtractToDialog.java index b1ae299628d..f9aff887b66 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/ExtractToDialog.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/ExtractToDialog.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2003, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2003, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,7 +11,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.files.ui.dialogs; diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/SystemSelectRemoteFileOrFolderDialog.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/SystemSelectRemoteFileOrFolderDialog.java index f5382107b98..721209ac6c3 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/SystemSelectRemoteFileOrFolderDialog.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/dialogs/SystemSelectRemoteFileOrFolderDialog.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,11 +11,12 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.files.ui.dialogs; import org.eclipse.jface.viewers.ViewerFilter; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.files.ui.ISystemAddFileListener; import org.eclipse.rse.files.ui.widgets.SystemSelectRemoteFileOrFolderForm; @@ -40,7 +41,7 @@ import org.eclipse.swt.widgets.Shell; *
          *
        • {@link #setSystemConnection(IHost) or #setDefaultConnection(SystemConnection)} *
        • {@link #setShowNewConnectionPrompt(boolean)} - *
        • {@link #setSystemTypes(String[])} + *
        • {@link #setSystemTypes(IRSESystemType[])} *
        • {@link #setAutoExpandDepth(int)} *
        • {@link #setRootFolder(IHost, String)} or {@link #setRootFolder(IRemoteFile)} or {@link #setPreSelection(IRemoteFile)} *
        • {@link #setFileTypes(String[])} or {@link #setFileTypes(String)} @@ -132,12 +133,15 @@ public class SystemSelectRemoteFileOrFolderDialog } /** - * Restrict to certain system types - * @param systemTypes the system types to restrict what connections are shown and what types of connections - * the user can create - * @see org.eclipse.rse.core.IRSESystemType + * Set the system types to restrict what connections the user sees, + * and what types of connections they can create. + * + * @param systemTypes An array of system types, or + * null to allow all registered valid system types. + * A system type is valid if at least one subsystem configuration + * is registered against it. */ - public void setSystemTypes(String[] systemTypes) + public void setSystemTypes(IRSESystemType[] systemTypes) { form.setSystemTypes(systemTypes); } 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 8e206b74576..5b2f687d47b 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, 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2000, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -12,12 +12,14 @@ * * Contributors: * David Dykstal (IBM) - moved SystemPreferencesManager to a new package + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.files.ui.widgets; import java.util.Hashtable; import java.util.ResourceBundle; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.ISystemProfile; import org.eclipse.rse.core.model.ISystemRegistry; @@ -82,7 +84,7 @@ public class SystemQualifiedRemoteFolderCombo extends Composite //private IRemoteFile[] folders = null; private Hashtable resolvedFolders = new Hashtable(); //private String[] folderStrings = null; - private String[] systemTypes; + private IRSESystemType[] systemTypes; private boolean readOnly = true; private boolean showNewPrompt = true; private SystemSelectRemoteFolderAction browseAction = null; @@ -99,7 +101,7 @@ public class SystemQualifiedRemoteFolderCombo extends Composite * @param parent Parent composite * @param style SWT style flags for overall composite widget * @param historyKey A string identifying the key into the user preferences where this combo's history will be stored. - * @see #setSystemType(String) + * @see #setSystemType(IRSESystemType) */ public SystemQualifiedRemoteFolderCombo(Composite parent, int style, String historyKey) { @@ -129,30 +131,33 @@ public class SystemQualifiedRemoteFolderCombo extends Composite } /** - * Set the system types to restrict what connections the user sees, and what types of - * connections they can create. - * @param systemTypes An array of system type names + * Set the system types to restrict what connections the user sees, + * and what types of connections they can create. * - * @see org.eclipse.rse.core.IRSESystemType + * @param systemTypes An array of system types, or + * null to allow all registered valid system types. + * A system type is valid if at least one subsystem configuration + * is registered against it. */ - public void setSystemTypes(String[] systemTypes) + public void setSystemTypes(IRSESystemType[] systemTypes) { this.systemTypes = systemTypes; } /** * Convenience method to restrict to a single system type. - * Same as setSystemTypes(new String[] {systemType}) + * Same as setSystemTypes(new IRSESystemType[] {systemType}) * - * @param systemType The name of the system type to restrict to - * - * @see org.eclipse.rse.core.IRSESystemType + * @param systemType The system type to restrict to, or + * null to allow all registered valid system types. + * A system type is valid if at least one subsystem configuration + * is registered against it. */ - public void setSystemType(String systemType) + public void setSystemType(IRSESystemType systemType) { if (systemType == null) setSystemTypes(null); else - setSystemTypes(new String[] {systemType}); + setSystemTypes(new IRSESystemType[] {systemType}); //System.out.println("SYSTEM TYPES SET TO "+systemType+" IN SYSQUALRMTFLDRCMBO"); } diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemRemoteConnectionCombo.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemRemoteConnectionCombo.java index 4c133867b13..c854c55c94b 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemRemoteConnectionCombo.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemRemoteConnectionCombo.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,12 +11,13 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.files.ui.widgets; import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.model.IHost; +import org.eclipse.rse.ui.SystemWidgetHelpers; import org.eclipse.rse.ui.widgets.SystemHostCombo; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; @@ -28,10 +29,12 @@ import org.eclipse.swt.widgets.Composite; */ public class SystemRemoteConnectionCombo extends SystemHostCombo { - private static final String[] SYSTEM_TYPES = { IRSESystemType.SYSTEMTYPE_LINUX, - IRSESystemType.SYSTEMTYPE_LOCAL, - IRSESystemType.SYSTEMTYPE_UNIX, - IRSESystemType.SYSTEMTYPE_WINDOWS }; + private static final String[] SYSTEM_TYPE_IDS = { + IRSESystemType.SYSTEMTYPE_LINUX_ID, + IRSESystemType.SYSTEMTYPE_LOCAL_ID, + IRSESystemType.SYSTEMTYPE_UNIX_ID, + IRSESystemType.SYSTEMTYPE_WINDOWS_ID + }; /** * Constructor when you want to set the style. @@ -41,7 +44,7 @@ public class SystemRemoteConnectionCombo extends SystemHostCombo { * @param showNewButton true if a New... button is to be included in this composite. */ public SystemRemoteConnectionCombo(Composite parent, int style, IHost defaultConnection, boolean showNewButton) { - super(parent, style, SYSTEM_TYPES, defaultConnection, showNewButton); + super(parent, style, SystemWidgetHelpers.getValidSystemTypes(SYSTEM_TYPE_IDS), defaultConnection, showNewButton); } /** 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 b419f90847e..d90cce291ea 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, 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2000, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,7 +11,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.files.ui.widgets; @@ -19,6 +19,7 @@ import java.util.Iterator; import java.util.ResourceBundle; import java.util.Vector; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.SystemBasePlugin; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.files.ui.actions.SystemSelectRemoteFolderAction; @@ -70,7 +71,7 @@ public class SystemRemoteFolderCombo extends Composite implements ISystemCombo private Button browseButton = null; //private RemoteFileSubSystem subsystem = null; //private RemoteFileSubSystemConfiguration subsystemFactory = null; - private String[] systemTypes = null; + private IRSESystemType[] systemTypes = null; private IHost connection = null; private boolean showNewConnectionPrompt = true; //private static final int DEFAULT_COMBO_WIDTH = 300; @@ -118,30 +119,34 @@ public class SystemRemoteFolderCombo extends Composite implements ISystemCombo } /** - * Set the system types to restrict what connections the user sees, and what types of - * connections they can create. - * @param systemTypes An array of system type names + * Set the system types to restrict what connections the user sees, + * and what types of connections they can create. * - * @see org.eclipse.rse.core.IRSESystemType + * @param systemTypes An array of system types, or + * null to allow all registered valid system types. + * A system type is valid if at least one subsystem configuration + * is registered against it. */ - public void setSystemTypes(String[] systemTypes) + public void setSystemTypes(IRSESystemType[] systemTypes) { this.systemTypes = systemTypes; } + /** * Convenience method to restrict to a single system type. - * Same as setSystemTypes(new String[] {systemType}) + * Same as setSystemTypes(new IRSESystemType[] {systemType}) * - * @param systemType The name of the system type to restrict to - * - * @see org.eclipse.rse.core.IRSESystemType + * @param systemType The system type to restrict to, or + * null to allow all registered valid system types. + * A system type is valid if at least one subsystem configuration + * is registered against it. */ - public void setSystemType(String systemType) + public void setSystemType(IRSESystemType systemType) { if (systemType == null) setSystemTypes(null); else - setSystemTypes(new String[] {systemType}); + setSystemTypes(new IRSESystemType[] {systemType}); } /** diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemSelectRemoteFileOrFolderForm.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemSelectRemoteFileOrFolderForm.java index 629ff07d904..4300c600a26 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemSelectRemoteFileOrFolderForm.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemSelectRemoteFileOrFolderForm.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,7 +11,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.files.ui.widgets; @@ -26,6 +26,7 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.ViewerFilter; import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.SystemAdapterHelpers; import org.eclipse.rse.core.SystemBasePlugin; import org.eclipse.rse.core.SystemRemoteObjectMatcher; @@ -73,7 +74,7 @@ import org.eclipse.swt.widgets.Text; *
            *
          • {@link #setShowNewConnectionPrompt(boolean)} *
          • {@link #setSystemConnection(IHost) or #setDefaultConnection(SystemConnection)} - *
          • {@link #setSystemTypes(String[])} + *
          • {@link #setSystemTypes(IRSESystemType[])} *
          • {@link #setRootFolder(IHost, String)} or {@link #setRootFolder(IRemoteFile)} *
          • {@link #setPreSelection(IRemoteFile)} *
          • {@link #setFileTypes(String[])} or {@link #setFileTypes(String)} @@ -156,7 +157,7 @@ public class SystemSelectRemoteFileOrFolderForm * @see #setSystemConnection(IHost) * @see #setShowNewConnectionPrompt(boolean) - * @see #setSystemTypes(String[]) + * @see #setSystemTypes(IRSESystemType[]) * @see #setSelectionTreeToolTipText(String) */ public SystemSelectRemoteFileOrFolderForm(ISystemMessageLine msgLine, Object caller, boolean fileMode) @@ -240,16 +241,21 @@ public class SystemSelectRemoteFileOrFolderForm { inputProvider.setShowNewConnectionPrompt(show); } + /** - * Restrict to certain system types - * @param systemTypes the system types to restrict what connections are shown and what types of connections - * the user can create - * @see org.eclipse.rse.core.IRSESystemType + * Set the system types to restrict what connections the user sees, + * and what types of connections they can create. + * + * @param systemTypes An array of system types, or + * null to allow all registered valid system types. + * A system type is valid if at least one subsystem configuration + * is registered against it. */ - public void setSystemTypes(String[] systemTypes) + public void setSystemTypes(IRSESystemType[] systemTypes) { inputProvider.setSystemTypes(systemTypes); } + /** * Set the message shown as the text at the top of the form. Eg, "Select a file" */ diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemSelectRemoteFilesForm.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemSelectRemoteFilesForm.java index 766318aa18f..10edbb4de2c 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemSelectRemoteFilesForm.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/widgets/SystemSelectRemoteFilesForm.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2000, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2000, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,7 +11,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.files.ui.widgets; @@ -21,6 +21,7 @@ import java.util.Iterator; import java.util.Map; import org.eclipse.jface.viewers.ICheckStateListener; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.internal.files.ui.actions.SystemSelectFileTypesAction; import org.eclipse.rse.internal.ui.SystemResources; import org.eclipse.rse.internal.ui.view.SystemViewLabelAndContentProvider; @@ -158,30 +159,33 @@ public class SystemSelectRemoteFilesForm extends Composite } /** - * Set the system types to restrict what connections the user sees, and what types of - * connections they can create. - * @param systemTypes An array of system type names + * Set the system types to restrict what connections the user sees, + * and what types of connections they can create. * - * @see org.eclipse.rse.core.IRSESystemType + * @param systemTypes An array of system types, or + * null to allow all registered valid system types. + * A system type is valid if at least one subsystem configuration + * is registered against it. */ - public void setSystemTypes(String[] systemTypes) - { + public void setSystemTypes(IRSESystemType[] systemTypes) + { dirCombo.setSystemTypes(systemTypes); } /** * Convenience method to restrict to a single system type. - * Same as setSystemTypes(new String[] {systemType}) + * Same as setSystemTypes(new IRSESystemType[] {systemType}) * - * @param systemType The name of the system type to restrict to - * - * @see org.eclipse.rse.core.IRSESystemType + * @param systemType The system type to restrict to, or + * null to allow all registered valid system types. + * A system type is valid if at least one subsystem configuration + * is registered against it. */ - public void setSystemType(String systemType) + public void setSystemType(IRSESystemType systemType) { if (systemType == null) setSystemTypes(null); else - setSystemTypes(new String[] {systemType}); + setSystemTypes(new IRSESystemType[] {systemType}); } /** diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCombineAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCombineAction.java index 485a6f178ce..685f3e636ec 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCombineAction.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemCombineAction.java @@ -12,6 +12,7 @@ * * Contributors: * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.files.ui.actions; @@ -64,7 +65,7 @@ public class SystemCombineAction extends SystemExtractToAction { dialog.setMessage(FileResources.RESID_COMBINE_PROMPT); dialog.setShowNewConnectionPrompt(true); dialog.setShowPropertySheet(true, false); - dialog.setSystemTypes(systemTypes); + dialog.setSystemTypes(getValidSystemTypes()); dialog.setPreSelection(firstSelection); diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemConvertAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemConvertAction.java index 44b70c49108..77029db5880 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemConvertAction.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemConvertAction.java @@ -12,6 +12,7 @@ * * Contributors: * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.files.ui.actions; @@ -64,7 +65,7 @@ public class SystemConvertAction extends SystemExtractToAction { dialog.setMessage(message); dialog.setShowNewConnectionPrompt(true); dialog.setShowPropertySheet(true, false); - dialog.setSystemTypes(systemTypes); + dialog.setSystemTypes(getValidSystemTypes()); dialog.setPreSelection(selection); diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemExtractToAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemExtractToAction.java index 731e7d40394..c4d352cea41 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemExtractToAction.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemExtractToAction.java @@ -12,6 +12,7 @@ * * Contributors: * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.files.ui.actions; @@ -21,15 +22,16 @@ import org.eclipse.rse.core.events.ISystemRemoteChangeEvents; import org.eclipse.rse.core.events.ISystemResourceChangeEvents; import org.eclipse.rse.core.events.SystemResourceChangeEvent; import org.eclipse.rse.core.model.IHost; +import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.files.ui.dialogs.ExtractToDialog; import org.eclipse.rse.internal.files.ui.FileResources; -import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.services.clientserver.messages.SystemMessage; import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile; import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem; import org.eclipse.rse.ui.ISystemIconConstants; import org.eclipse.rse.ui.ISystemMessages; import org.eclipse.rse.ui.RSEUIPlugin; +import org.eclipse.rse.ui.SystemWidgetHelpers; import org.eclipse.rse.ui.messages.SystemMessageDialog; import org.eclipse.rse.ui.validators.IValidatorRemoteSelection; import org.eclipse.rse.ui.view.ISystemRemoteElementAdapter; @@ -44,14 +46,17 @@ import org.eclipse.swt.widgets.Shell; */ public class SystemExtractToAction extends SystemExtractAction implements IValidatorRemoteSelection { - protected static final String[] systemTypes = { IRSESystemType.SYSTEMTYPE_LOCAL, - IRSESystemType.SYSTEMTYPE_WINDOWS, - IRSESystemType.SYSTEMTYPE_LINUX, - IRSESystemType.SYSTEMTYPE_POWER_LINUX, - IRSESystemType.SYSTEMTYPE_UNIX, - IRSESystemType.SYSTEMTYPE_AIX, - IRSESystemType.SYSTEMTYPE_ISERIES - }; + private static final String[] validSystemTypesIds = { + IRSESystemType.SYSTEMTYPE_LOCAL_ID, + IRSESystemType.SYSTEMTYPE_WINDOWS_ID, + IRSESystemType.SYSTEMTYPE_LINUX_ID, + IRSESystemType.SYSTEMTYPE_POWER_LINUX_ID, + IRSESystemType.SYSTEMTYPE_UNIX_ID, + IRSESystemType.SYSTEMTYPE_AIX_ID, + IRSESystemType.SYSTEMTYPE_ISERIES_ID + }; + private static IRSESystemType[] validSystemTypes = null; + protected SystemMessage targetDescendsFromSrcMsg = null; protected int currentlyProcessingSelection = 0; @@ -69,6 +74,13 @@ public class SystemExtractToAction extends SystemExtractAction implements IValid setHelp(RSEUIPlugin.HELPPREFIX + "actn0119"); //$NON-NLS-1$ setImageDescriptor(RSEUIPlugin.getDefault().getImageDescriptor(ISystemIconConstants.ICON_SYSTEM_EXTRACTTO_ID)); } + + protected IRSESystemType[] getValidSystemTypes() { + if (validSystemTypes==null) { + validSystemTypes = SystemWidgetHelpers.getValidSystemTypes(validSystemTypesIds); + } + return validSystemTypes; + } public void run() { @@ -86,7 +98,7 @@ public class SystemExtractToAction extends SystemExtractAction implements IValid dialog.setMessage(message); dialog.setShowNewConnectionPrompt(true); dialog.setShowPropertySheet(true, false); - dialog.setSystemTypes(systemTypes); + dialog.setSystemTypes(getValidSystemTypes()); dialog.setPreSelection(selection); diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFileSelectAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFileSelectAction.java index 98df9d2767e..06a7b00c0e6 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFileSelectAction.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/actions/SystemRemoteFileSelectAction.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,11 +11,12 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.files.ui.actions; import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.files.ui.ISystemAddFileListener; import org.eclipse.rse.files.ui.dialogs.SystemRemoteFileDialog; @@ -38,7 +39,7 @@ import org.eclipse.swt.widgets.Shell; *
              *
            • {@link #setShowNewConnectionPrompt(boolean)} *
            • {@link #setHost(IHost) or #setDefaultConnection(SystemConnection)} - *
            • {@link #setSystemType(String)} or {@link #setSystemTypes(String[])} + *
            • {@link #setSystemType(IRSESystemType)} or {@link #setSystemTypes(IRSESystemType[])} *
            • {@link #setRootFolder(IHost, String)} or {@link #setRootFolder(IRemoteFile)} or {@link #setPreSelection(IRemoteFile)} *
            • {@link #setAutoExpandDepth(int)} *
            • {@link #setShowPropertySheet(boolean)} @@ -62,7 +63,7 @@ import org.eclipse.swt.widgets.Shell; */ public class SystemRemoteFileSelectAction extends SystemBaseDialogAction { - private String[] systemTypes; + private IRSESystemType[] systemTypes; private IHost systemConnection, outputConnection; private IRemoteFile preSelection; private String rootFolderAbsPath; @@ -143,30 +144,33 @@ public class SystemRemoteFileSelectAction extends SystemBaseDialogAction onlyConnection = false; } /** - * Set the system types to restrict what connections the user sees, and what types of - * connections they can create. - * @param systemTypes An array of system type names + * Set the system types to restrict what connections the user sees, + * and what types of connections they can create. * - * @see org.eclipse.rse.core.IRSESystemType + * @param systemTypes An array of system types, or + * null to allow all registered valid system types. + * A system type is valid if at least one subsystem configuration + * is registered against it. */ - public void setSystemTypes(String[] systemTypes) + public void setSystemTypes(IRSESystemType[] systemTypes) { this.systemTypes = systemTypes; } /** * Convenience method to restrict to a single system type. - * Same as setSystemTypes(new String[] {systemType}) + * Same as setSystemTypes(new IRSESystemType[] {systemType}) * - * @param systemType The name of the system type to restrict to - * - * @see org.eclipse.rse.core.IRSESystemType + * @param systemType The name of the system type to restrict to, or + * null to allow all registered valid system types. + * A system type is valid if at least one subsystem configuration + * is registered against it. */ - public void setSystemType(String systemType) + public void setSystemType(IRSESystemType systemType) { if (systemType == null) setSystemTypes(null); else - setSystemTypes(new String[] {systemType}); + setSystemTypes(new IRSESystemType[] {systemType}); } /** diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/FileServicesPropertyPage.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/FileServicesPropertyPage.java index 4fed4cd5929..96028a3ae70 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/FileServicesPropertyPage.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/propertypages/FileServicesPropertyPage.java @@ -12,6 +12,7 @@ * * Contributors: * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.files.ui.propertypages; @@ -19,6 +20,7 @@ package org.eclipse.rse.internal.files.ui.propertypages; import java.util.ArrayList; import java.util.List; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.core.subsystems.IServiceSubSystemConfiguration; @@ -47,7 +49,7 @@ public class FileServicesPropertyPage extends ServicesPropertyPage IHost host = subSystem.getHost(); _currentFactory = (IFileServiceSubSystemConfiguration)subSystem.getParentRemoteFileSubSystemConfiguration(); - IFileServiceSubSystemConfiguration[] factories = getFileServiceSubSystemFactories(host.getSystemType().getName()); + IFileServiceSubSystemConfiguration[] factories = getFileServiceSubSystemConfigurations(host.getSystemType()); // create elements for each @@ -65,11 +67,11 @@ public class FileServicesPropertyPage extends ServicesPropertyPage return elements; } - protected IFileServiceSubSystemConfiguration[] getFileServiceSubSystemFactories(String systemType) + protected IFileServiceSubSystemConfiguration[] getFileServiceSubSystemConfigurations(IRSESystemType systemType) { List results = new ArrayList(); ISystemRegistry sr = RSEUIPlugin.getTheSystemRegistry(); - ISubSystemConfiguration[] factories = sr.getSubSystemConfigurationsBySystemType(systemType); + ISubSystemConfiguration[] factories = sr.getSubSystemConfigurationsBySystemType(systemType, false); for (int i = 0; i < factories.length; i++) { diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteFolderAction.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteFolderAction.java index ce0a234367a..a87fbb5946c 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteFolderAction.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteFolderAction.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,11 +11,12 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.files.ui.search; import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.files.ui.ISystemAddFileListener; import org.eclipse.rse.files.ui.actions.SystemSelectRemoteFolderAction; @@ -28,7 +29,7 @@ import org.eclipse.swt.widgets.Shell; */ public class SystemSearchRemoteFolderAction extends SystemSelectRemoteFolderAction { - private String[] systemTypes; + private IRSESystemType[] systemTypes; private IHost systemConnection, outputConnection; private IHost rootFolderConnection; private IRemoteFile preSelection; @@ -109,31 +110,36 @@ public class SystemSearchRemoteFolderAction extends SystemSelectRemoteFolderActi systemConnection = conn; onlyConnection = false; } + /** - * Set the system types to restrict what connections the user sees, and what types of - * connections they can create. - * @param systemTypes An array of system type names + * Set the system types to restrict what connections the user sees, + * and what types of connections they can create. * - * @see org.eclipse.rse.core.IRSESystemType + * @param systemTypes An array of system types, or + * null to allow all registered valid system types. + * A system type is valid if at least one subsystem configuration + * is registered against it. */ - public void setSystemTypes(String[] systemTypes) + public void setSystemTypes(IRSESystemType[] systemTypes) { this.systemTypes = systemTypes; } + /** * Convenience method to restrict to a single system type. - * Same as setSystemTypes(new String[] {systemType}) + * Same as setSystemTypes(new IRSESystemType[] {systemType}) * - * @param systemType The name of the system type to restrict to - * - * @see org.eclipse.rse.core.IRSESystemType + * @param systemType The system type to restrict to, or + * null to allow all registered valid system types. + * A system type is valid if at least one subsystem configuration + * is registered against it. */ - public void setSystemType(String systemType) + public void setSystemType(IRSESystemType systemType) { if (systemType == null) setSystemTypes(null); else - setSystemTypes(new String[] {systemType}); + setSystemTypes(new IRSESystemType[] {systemType}); } /** diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteObjectAPIProvider.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteObjectAPIProvider.java index e2e9bebaa93..c5738c221c0 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteObjectAPIProvider.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/search/SystemSearchRemoteObjectAPIProvider.java @@ -1,11 +1,12 @@ /******************************************************************************** - * Copyright (c) 2006, 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Kushal Munir (IBM) - initial API and implementation. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.files.ui.search; @@ -13,6 +14,7 @@ package org.eclipse.rse.internal.files.ui.search; import java.util.List; import java.util.Vector; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.internal.ui.view.SystemSelectRemoteObjectAPIProviderImpl; @@ -31,7 +33,7 @@ public class SystemSearchRemoteObjectAPIProvider extends SystemSelectRemoteObjec * @param showNewConnectionPrompt whether to show new connection prompt. * @param systemTypes the system types to restrict to. */ - public SystemSearchRemoteObjectAPIProvider(String factoryId, String factoryCategory, boolean showNewConnectionPrompt, String[] systemTypes) { + public SystemSearchRemoteObjectAPIProvider(String factoryId, String factoryCategory, boolean showNewConnectionPrompt, IRSESystemType[] systemTypes) { super(factoryId, factoryCategory, showNewConnectionPrompt, systemTypes); } diff --git a/rse/plugins/org.eclipse.rse.processes.ui/src/org/eclipse/rse/internal/processes/ui/propertypages/ProcessServicesPropertyPage.java b/rse/plugins/org.eclipse.rse.processes.ui/src/org/eclipse/rse/internal/processes/ui/propertypages/ProcessServicesPropertyPage.java index 1ff4a9897fc..fec5e54edad 100644 --- a/rse/plugins/org.eclipse.rse.processes.ui/src/org/eclipse/rse/internal/processes/ui/propertypages/ProcessServicesPropertyPage.java +++ b/rse/plugins/org.eclipse.rse.processes.ui/src/org/eclipse/rse/internal/processes/ui/propertypages/ProcessServicesPropertyPage.java @@ -12,6 +12,7 @@ * * Contributors: * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.processes.ui.propertypages; @@ -19,6 +20,7 @@ package org.eclipse.rse.internal.processes.ui.propertypages; import java.util.ArrayList; import java.util.List; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.core.subsystems.IServiceSubSystemConfiguration; @@ -45,7 +47,7 @@ public class ProcessServicesPropertyPage extends ServicesPropertyPage IHost host = subSystem.getHost(); _currentFactory = (IProcessServiceSubSystemConfiguration)subSystem.getParentRemoteProcessSubSystemConfiguration(); - IProcessServiceSubSystemConfiguration[] factories = getProcessServiceSubSystemFactories(host.getSystemType().getName()); + IProcessServiceSubSystemConfiguration[] factories = getProcessServiceSubSystemConfigurations(host.getSystemType()); // create elements for each @@ -63,11 +65,11 @@ public class ProcessServicesPropertyPage extends ServicesPropertyPage return elements; } - protected IProcessServiceSubSystemConfiguration[] getProcessServiceSubSystemFactories(String systemType) + protected IProcessServiceSubSystemConfiguration[] getProcessServiceSubSystemConfigurations(IRSESystemType systemType) { List results = new ArrayList(); ISystemRegistry sr = RSEUIPlugin.getTheSystemRegistry(); - ISubSystemConfiguration[] factories = sr.getSubSystemConfigurationsBySystemType(systemType); + ISubSystemConfiguration[] factories = sr.getSubSystemConfigurationsBySystemType(systemType, false); for (int i = 0; i < factories.length; i++) { diff --git a/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/propertypages/ShellServicesPropertyPage.java b/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/propertypages/ShellServicesPropertyPage.java index ccb05720475..a70385e6096 100644 --- a/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/propertypages/ShellServicesPropertyPage.java +++ b/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/propertypages/ShellServicesPropertyPage.java @@ -12,6 +12,7 @@ * * Contributors: * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.shells.ui.propertypages; @@ -19,6 +20,7 @@ package org.eclipse.rse.internal.shells.ui.propertypages; import java.util.ArrayList; import java.util.List; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.model.DummyHost; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.ISystemRegistry; @@ -52,14 +54,14 @@ public class ShellServicesPropertyPage extends ServicesPropertyPage if (subSystem == null || _currentFactory != null) { // create dummy host - factories = getShellServiceSubSystemFactories(getSystemType().getName()); + factories = getShellServiceSubSystemConfigurations(getSystemType()); host = new DummyHost(getHostname(), getSystemType()); } else { host = subSystem.getHost(); _currentFactory = (IShellServiceSubSystemConfiguration)subSystem.getParentRemoteCmdSubSystemConfiguration(); - factories = getShellServiceSubSystemFactories(host.getSystemType().getName()); + factories = getShellServiceSubSystemConfigurations(host.getSystemType()); } // create elements for each @@ -78,11 +80,11 @@ public class ShellServicesPropertyPage extends ServicesPropertyPage } - protected IShellServiceSubSystemConfiguration[] getShellServiceSubSystemFactories(String systemType) + protected IShellServiceSubSystemConfiguration[] getShellServiceSubSystemConfigurations(IRSESystemType systemType) { List results = new ArrayList(); ISystemRegistry sr = RSEUIPlugin.getTheSystemRegistry(); - ISubSystemConfiguration[] factories = sr.getSubSystemConfigurationsBySystemType(systemType); + ISubSystemConfiguration[] factories = sr.getSubSystemConfigurationsBySystemType(systemType, false); for (int i = 0; i < factories.length; i++) { diff --git a/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/shells/ui/RemoteCommandHelpers.java b/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/shells/ui/RemoteCommandHelpers.java index 3f287266b80..b2d34d1e939 100644 --- a/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/shells/ui/RemoteCommandHelpers.java +++ b/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/shells/ui/RemoteCommandHelpers.java @@ -13,6 +13,7 @@ * Contributors: * Martin Oberhuber (Wind River) - Fix 154874 - handle files with space or $ in the name * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.shells.ui; @@ -140,7 +141,7 @@ public class RemoteCommandHelpers showInView(defaultShell, isCompile, cmdString); - IRemoteFileSubSystemConfiguration fileSSF = RemoteFileUtility.getFileSubSystemConfiguration(cmdSubSystem.getHost().getSystemType().getName()); + IRemoteFileSubSystemConfiguration fileSSF = RemoteFileUtility.getFileSubSystemConfiguration(cmdSubSystem.getHost().getSystemType()); IRemoteFile pwd = ((RemoteCommandShell)defaultShell).getWorkingDirectory(); if (pwd == null || !pwd.getAbsolutePath().equals(path)) { diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/RemoteFileUtility.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/RemoteFileUtility.java index f988d74d2c7..8a2907cc3d4 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/RemoteFileUtility.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/model/RemoteFileUtility.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,7 +11,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.subsystems.files.core.model; @@ -19,6 +19,7 @@ package org.eclipse.rse.subsystems.files.core.model; import java.util.ArrayList; import java.util.List; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.core.subsystems.ISubSystem; @@ -63,10 +64,10 @@ public class RemoteFileUtility return (IRemoteFileSubSystem[])results.toArray(new IRemoteFileSubSystem[results.size()]); } - public static IRemoteFileSubSystemConfiguration getFileSubSystemConfiguration(String systemType) + public static IRemoteFileSubSystemConfiguration getFileSubSystemConfiguration(IRSESystemType systemType) { ISystemRegistry sr = RSEUIPlugin.getTheSystemRegistry(); - ISubSystemConfiguration[] sses = sr.getSubSystemConfigurationsBySystemType(systemType); + ISubSystemConfiguration[] sses = sr.getSubSystemConfigurationsBySystemType(systemType, false); for (int i = 0; i < sses.length; i++) { if (sses[i] instanceof IRemoteFileSubSystemConfiguration) diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemSelectConnectionAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemSelectConnectionAction.java index 9ff221bdec8..f2e629317d7 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemSelectConnectionAction.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemSelectConnectionAction.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,12 +11,13 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.ui.actions; import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.internal.ui.SystemResources; import org.eclipse.rse.ui.actions.SystemBaseDialogAction; @@ -35,8 +36,8 @@ public class SystemSelectConnectionAction extends SystemBaseDialogAction private boolean showPropertySheet; private String message; private boolean showNewConnectionPrompt = true; - private String[] systemTypes; - private String systemType; + private IRSESystemType[] systemTypes; + private IRSESystemType systemType; private IHost defaultConn; private Object result; @@ -56,22 +57,20 @@ public class SystemSelectConnectionAction extends SystemBaseDialogAction this.defaultConn = conn; } /** - * Restrict to certain system types - * @param systemTypes the system types to restrict what connections are shown and what types of connections - * the user can create - * @see org.eclipse.rse.core.IRSESystemType + * Restrict to certain system types. + * @param systemTypes the system types to restrict what connections + * are shown and what types of connections the user can create. */ - public void setSystemTypes(String[] systemTypes) + public void setSystemTypes(IRSESystemType[] systemTypes) { this.systemTypes = systemTypes; } /** - * Restrict to a certain system type - * @param systemType the system type to restrict what connections are shown and what types of connections - * the user can create - * @see org.eclipse.rse.core.IRSESystemType + * Restrict to a certain system type. + * @param systemType the system type to restrict what connections + * are shown and what types of connections the user can create. */ - public void setSystemType(String systemType) + public void setSystemType(IRSESystemType systemType) { this.systemType = systemType; } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemUpdateConnectionDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemUpdateConnectionDialog.java index 82832d5f900..8cd545b80e9 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemUpdateConnectionDialog.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/dialogs/SystemUpdateConnectionDialog.java @@ -13,9 +13,11 @@ * Contributors: * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.ui.dialogs; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.internal.ui.SystemResources; import org.eclipse.rse.ui.ISystemConnectionFormCaller; @@ -123,7 +125,7 @@ public class SystemUpdateConnectionDialog extends SystemPromptDialog implements { IHost conn = (IHost)getInputObject(); ISystemRegistryUI sr = RSEUIPlugin.getTheSystemRegistry(); - sr.updateHost( conn,conn.getSystemType().getName(),form.getConnectionName(),form.getHostName(), + sr.updateHost( conn,conn.getSystemType(), form.getConnectionName(),form.getHostName(), form.getConnectionDescription(), form.getDefaultUserId(), form.getUserIdLocation() ); } @@ -136,7 +138,7 @@ public class SystemUpdateConnectionDialog extends SystemPromptDialog implements /** * Event: the user has selected a system type. */ - public void systemTypeSelected(String systemType, boolean duringInitialization) + public void systemTypeSelected(IRSESystemType systemType, boolean duringInitialization) { } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/ServerConnectionSecurityPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/ServerConnectionSecurityPropertyPage.java index 711588f7489..1144f39d47a 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/ServerConnectionSecurityPropertyPage.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/ServerConnectionSecurityPropertyPage.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,12 +11,13 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.ui.propertypages; import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.comm.SystemKeystoreProviderManager; import org.eclipse.rse.core.subsystems.IConnectorService; import org.eclipse.rse.core.subsystems.ISubSystem; @@ -120,7 +121,7 @@ public class ServerConnectionSecurityPropertyPage extends SystemBasePropertyPage { } - public void setSystemType(String systemType) + public void setSystemType(IRSESystemType systemType) { } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/ServerLauncherPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/ServerLauncherPropertyPage.java index 8fde4255fbc..1428eb28ab9 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/ServerLauncherPropertyPage.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/ServerLauncherPropertyPage.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,11 +11,12 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.ui.propertypages; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.subsystems.IConnectorService; import org.eclipse.rse.core.subsystems.IServerLauncherProperties; import org.eclipse.rse.core.subsystems.ISubSystem; @@ -39,7 +40,7 @@ public class ServerLauncherPropertyPage extends SystemBasePropertyPage implement { private IServerLauncherForm _form; - protected String _systemType; + protected IRSESystemType _systemType; private IServerLauncherProperties sl; private ISubSystemConfiguration _factory; @@ -180,7 +181,7 @@ public class ServerLauncherPropertyPage extends SystemBasePropertyPage implement return getErrorMessage(); } - public void setSystemType(String systemType) + public void setSystemType(IRSESystemType systemType) { _systemType = systemType; } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectionPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectionPropertyPage.java index a85cb1c969a..4a2217fa865 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectionPropertyPage.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectionPropertyPage.java @@ -13,6 +13,7 @@ * Contributors: * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.ui.propertypages; @@ -90,7 +91,7 @@ public class SystemConnectionPropertyPage extends SystemBasePropertyPage { IHost conn = (IHost)getElement(); ISystemRegistryUI sr = RSEUIPlugin.getTheSystemRegistry(); - sr.updateHost( conn,conn.getSystemType().getName(),form.getConnectionName(),form.getHostName(), + sr.updateHost( conn, conn.getSystemType(), form.getConnectionName(),form.getHostName(), form.getConnectionDescription(), form.getDefaultUserId(), form.getUserIdLocation() ); @@ -130,7 +131,7 @@ public class SystemConnectionPropertyPage extends SystemBasePropertyPage } // check that everything was disconnedted okay and this is not the local connection - if(sr.isAnySubSystemConnected(conn) && !IRSESystemType.SYSTEMTYPE_LOCAL.equals(conn.getSystemType().getName())) + if(sr.isAnySubSystemConnected(conn) && !IRSESystemType.SYSTEMTYPE_LOCAL_ID.equals(conn.getSystemType().getId())) { // backout changes, likely because user cancelled the disconnect sr.setHostOffline(conn, false); @@ -161,7 +162,7 @@ public class SystemConnectionPropertyPage extends SystemBasePropertyPage /** * Event: the user has selected a system type. */ - public void systemTypeSelected(String systemType, boolean duringInitialization) + public void systemTypeSelected(IRSESystemType systemType, boolean duringInitialization) { } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectionSubSystemsPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectionSubSystemsPropertyPage.java index 56a3592df19..7669cbfd715 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectionSubSystemsPropertyPage.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemConnectionSubSystemsPropertyPage.java @@ -12,6 +12,7 @@ * * Contributors: * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.ui.propertypages; @@ -19,6 +20,7 @@ import java.util.ResourceBundle; import java.util.Vector; import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.SystemAdapterHelpers; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.subsystems.ISubSystem; @@ -391,7 +393,7 @@ public class SystemConnectionSubSystemsPropertyPage extends SystemBasePropertyPa /** * Event: the user has selected a system type. */ - public void systemTypeSelected(String systemType, boolean duringInitialization) + public void systemTypeSelected(IRSESystemType systemType, boolean duringInitialization) { } } \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemTeamViewSubSystemConfigurationPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemTeamViewSubSystemConfigurationPropertyPage.java index 0f6c4e4a200..6a2641579e3 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemTeamViewSubSystemConfigurationPropertyPage.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/propertypages/SystemTeamViewSubSystemConfigurationPropertyPage.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,10 +11,11 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.ui.propertypages; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy; import org.eclipse.rse.internal.ui.SystemPropertyResources; @@ -114,20 +115,21 @@ public class SystemTeamViewSubSystemConfigurationPropertyPage extends SystemBase labelId.setText(proxy.getId()); labelVendor.setText(proxy.getVendor()); String systypes = ""; //$NON-NLS-1$ - String[] types = ssf.getSystemTypes(); if (ssf.getSubSystemConfigurationProxy().supportsAllSystemTypes()) { systypes = SystemResources.TERM_ALL; } else { + IRSESystemType[] types = ssf.getSystemTypes(); + StringBuffer buf = new StringBuffer(); for (int idx=0; idx0) + buf.append(", "); //$NON-NLS-1$ + buf.append(types[idx].getLabel()); } + systypes = buf.toString(); } labelTypes.setText(systypes); } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemResourceSelectionForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemResourceSelectionForm.java index d6d85c2f8c7..94becbd8154 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemResourceSelectionForm.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemResourceSelectionForm.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,7 +11,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.ui.view; @@ -26,6 +26,7 @@ import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.SystemAdapterHelpers; import org.eclipse.rse.core.filters.ISystemFilterReference; import org.eclipse.rse.core.model.IHost; @@ -158,12 +159,12 @@ public class SystemResourceSelectionForm implements ISelectionChangedListener } else { - String[] systemTypes = _inputProvider.getSystemTypes(); + IRSESystemType[] systemTypes = _inputProvider.getSystemTypes(); String category = _inputProvider.getCategory(); if (systemTypes != null) { - _connectionCombo = new SystemHostCombo(composite_prompts, SWT.NULL, _inputProvider.getSystemTypes(), _inputProvider.getSystemConnection(), _inputProvider.allowNewConnection()); + _connectionCombo = new SystemHostCombo(composite_prompts, SWT.NULL, systemTypes, _inputProvider.getSystemConnection(), _inputProvider.allowNewConnection()); } else if (category != null) { @@ -171,7 +172,10 @@ public class SystemResourceSelectionForm implements ISelectionChangedListener } else { - _connectionCombo = new SystemHostCombo(composite_prompts, SWT.NULL, "*", _inputProvider.getSystemConnection(), _inputProvider.allowNewConnection()); //$NON-NLS-1$ + _connectionCombo = new SystemHostCombo(composite_prompts, SWT.NULL, + SystemWidgetHelpers.getValidSystemTypes(null), + _inputProvider.getSystemConnection(), + _inputProvider.allowNewConnection()); } _connectionCombo.addSelectionListener(new SelectionAdapter() diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemResourceSelectionInputProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemResourceSelectionInputProvider.java index 6c4b6bd52e9..38d173e6a9b 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemResourceSelectionInputProvider.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemResourceSelectionInputProvider.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2004, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2004, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,10 +11,11 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.ui.view; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.core.subsystems.ISubSystem; @@ -26,7 +27,7 @@ public abstract class SystemResourceSelectionInputProvider extends SystemAbstrac private IHost _connection; private boolean _onlyConnection = false; private boolean _allowNew = true; - private String[] _systemTypes; + private IRSESystemType[] _systemTypes; private String _category = null; public SystemResourceSelectionInputProvider(IHost connection) @@ -69,12 +70,12 @@ public abstract class SystemResourceSelectionInputProvider extends SystemAbstrac _onlyConnection = onlyConnection; } - public String[] getSystemTypes() + public IRSESystemType[] getSystemTypes() { return _systemTypes; } - public void setSystemTypes(String[] types) + public void setSystemTypes(IRSESystemType[] types) { _systemTypes = types; } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemSelectRemoteObjectAPIProviderImpl.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemSelectRemoteObjectAPIProviderImpl.java index 61d6d369dc9..03254cc5ebc 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemSelectRemoteObjectAPIProviderImpl.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemSelectRemoteObjectAPIProviderImpl.java @@ -12,11 +12,13 @@ * * Contributors: * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.ui.view; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.SystemAdapterHelpers; import org.eclipse.rse.core.SystemBasePlugin; import org.eclipse.rse.core.filters.ISystemFilter; @@ -61,7 +63,7 @@ public class SystemSelectRemoteObjectAPIProviderImpl protected String subsystemFactoryId; protected String subsystemFactoryCategory; protected String filterSuffix; - protected String[] systemTypes; + protected IRSESystemType[] systemTypes; protected String preSelectFilterChild; protected Object preSelectFilterChildObject; protected ISystemFilter[] quickFilters; @@ -102,7 +104,7 @@ public class SystemSelectRemoteObjectAPIProviderImpl * @param systemTypes Optional list of system types to restrict the "New Connection" wizard to. Pass null for no restrictions */ public SystemSelectRemoteObjectAPIProviderImpl(String factoryId, String factoryCategory, - boolean showNewConnectionPrompt, String[] systemTypes) + boolean showNewConnectionPrompt, IRSESystemType[] systemTypes) { super(); this.subsystemFactoryId = factoryId; @@ -130,11 +132,16 @@ public class SystemSelectRemoteObjectAPIProviderImpl } /** - * Specify system types to restrict what types of connections the user can create, and see. + * Specify system types to restrict what types of connections + * the user can create, and see. * This will override subsystemFactoryId,if that has been set! - * @see org.eclipse.rse.core.IRSESystemType + * + * @param systemTypes An array of system types, or + * null to allow all registered valid system types. + * A system type is valid if at least one subsystem configuration + * is registered against it. */ - public void setSystemTypes(String[] systemTypes) + public void setSystemTypes(IRSESystemType[] systemTypes) { this.systemTypes = systemTypes; } 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 204d799a006..4f6abdb8e27 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 @@ -18,6 +18,7 @@ * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.ui.view; @@ -31,6 +32,7 @@ import org.eclipse.jface.viewers.ICellEditorValidator; 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.RSEPreferencesManager; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.ISystemRegistry; @@ -572,7 +574,7 @@ public class SystemViewConnectionAdapter { String localUserId = conn.getLocalDefaultUserId(); data.setLocalValue(localUserId); - String parentUserId = RSEPreferencesManager.getUserId(conn.getSystemType().getName()); + String parentUserId = RSEPreferencesManager.getUserId(conn.getSystemType().getId()); data.setInheritedValue(parentUserId); data.setIsLocal((localUserId!=null)&&(localUserId.length()>0)); //data.printDetails(); @@ -635,12 +637,12 @@ public class SystemViewConnectionAdapter } else if (property.equals(ISystemPropertyConstants.P_HOSTNAME)) { - sr.updateHost(conn, conn.getSystemType().getName(), conn.getAliasName(), original_hostName, + sr.updateHost(conn, conn.getSystemType(), conn.getAliasName(), original_hostName, conn.getDescription(), conn.getDefaultUserId(), IRSEUserIdConstants.USERID_LOCATION_NOTSET); } else if (property.equals(ISystemPropertyConstants.P_DESCRIPTION)) { - sr.updateHost(conn, conn.getSystemType().getName(), conn.getAliasName(), conn.getHostName(), + sr.updateHost(conn, conn.getSystemType(), conn.getAliasName(), conn.getHostName(), original_description, conn.getDefaultUserId(), IRSEUserIdConstants.USERID_LOCATION_NOTSET); } } @@ -654,7 +656,7 @@ public class SystemViewConnectionAdapter //whereToUpdate = USERID_LOCATION_DEFAULT_SYSTEMTYPE; String userId = data.getLocalValue(); // will be "" if !data.getIsLocal(), which results in wiping out local override ISystemRegistryUI sr = RSEUIPlugin.getTheSystemRegistry(); - sr.updateHost(conn, conn.getSystemType().getName(), conn.getAliasName(), conn.getHostName(), + sr.updateHost(conn, conn.getSystemType(), conn.getAliasName(), conn.getHostName(), conn.getDescription(), userId, whereToUpdate); } @@ -681,7 +683,7 @@ public class SystemViewConnectionAdapter // defect 57739 if (!((String)value).equalsIgnoreCase(conn.getHostName())) { - sr.updateHost(conn, conn.getSystemType().getName(), conn.getAliasName(), (String)value, + sr.updateHost(conn, conn.getSystemType(), conn.getAliasName(), (String)value, conn.getDescription(), conn.getDefaultUserId(), IRSEUserIdConstants.USERID_LOCATION_NOTSET); changed_hostName = true; } @@ -692,7 +694,7 @@ public class SystemViewConnectionAdapter // defect 57739 if (!((String)value).equalsIgnoreCase(conn.getDescription())) { - sr.updateHost(conn, conn.getSystemType().getName(), conn.getAliasName(), conn.getHostName(), + sr.updateHost(conn, conn.getSystemType(), conn.getAliasName(), conn.getHostName(), (String)value, conn.getDefaultUserId(), IRSEUserIdConstants.USERID_LOCATION_NOTSET); changed_description = true; } @@ -709,7 +711,7 @@ public class SystemViewConnectionAdapter if (element instanceof IHost) { IHost sysCon = (IHost) element; - if (sysCon.getSystemType().getName().equals(IRSESystemType.SYSTEMTYPE_LOCAL)) return existsMoreThanOneLocalConnection(); + if (sysCon.getSystemType().getId().equals(IRSESystemType.SYSTEMTYPE_LOCAL_ID)) return existsMoreThanOneLocalConnection(); ISystemRegistry sr = RSEUIPlugin.getTheSystemRegistry(); return !sr.isAnySubSystemConnected((IHost)element); } @@ -718,7 +720,8 @@ public class SystemViewConnectionAdapter protected boolean existsMoreThanOneLocalConnection() { - IHost[] localCons = RSEUIPlugin.getTheSystemRegistry().getHostsBySystemType(IRSESystemType.SYSTEMTYPE_LOCAL); + IRSESystemType localType = RSECorePlugin.getDefault().getRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_LOCAL_ID); + IHost[] localCons = RSEUIPlugin.getTheSystemRegistry().getHostsBySystemType(localType); return localCons.length > 1; } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewConnectionSelectionInputProvider.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewConnectionSelectionInputProvider.java index 1279644f77a..55de0419dfb 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewConnectionSelectionInputProvider.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/SystemViewConnectionSelectionInputProvider.java @@ -12,10 +12,12 @@ * * Contributors: * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.ui.view; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.ui.RSEUIPlugin; import org.eclipse.rse.ui.internal.model.SystemNewConnectionPromptObject; @@ -32,7 +34,7 @@ public class SystemViewConnectionSelectionInputProvider extends SystemAbstractAP private boolean showNew = true; private SystemNewConnectionPromptObject newConnPrompt; private Object[] newConnPromptArray; - private String[] systemTypes; + private IRSESystemType[] systemTypes; /** * Constructor @@ -60,14 +62,14 @@ public class SystemViewConnectionSelectionInputProvider extends SystemAbstractAP /** * Set the system types to restrict by */ - public void setSystemTypes(String[] systemTypes) + public void setSystemTypes(IRSESystemType[] systemTypes) { this.systemTypes = systemTypes; } /** * Return the system types we are restricted by */ - public String[] getSystemTypes() + public IRSESystemType[] getSystemTypes() { return systemTypes; } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewSubSystemConfigurationNode.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewSubSystemConfigurationNode.java index c92a84f2d17..cc6b34be677 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewSubSystemConfigurationNode.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/view/team/SystemTeamViewSubSystemConfigurationNode.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,7 +11,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.internal.ui.view.team; @@ -19,6 +19,7 @@ package org.eclipse.rse.internal.ui.view.team; import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.Platform; import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.model.ISystemProfile; import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; import org.eclipse.rse.core.subsystems.util.ISubSystemConfigurationAdapter; @@ -95,24 +96,24 @@ public class SystemTeamViewSubSystemConfigurationNode implements IAdaptable { if (name == null) { - name = ""; //$NON-NLS-1$ - String[] types = ssf.getSystemTypes(); + StringBuffer buf = new StringBuffer(); + buf.append(ssf.getName()); + buf.append(" ("); //$NON-NLS-1$ if (ssf.getSubSystemConfigurationProxy().supportsAllSystemTypes()) { - name = SystemResources.TERM_ALL; + buf.append(SystemResources.TERM_ALL); } else { + IRSESystemType[] types = ssf.getSystemTypes(); for (int idx=0; idx0) buf.append(", "); //$NON-NLS-1$ + buf.append(types[idx].getLabel()); } } - name = ssf.getName() + " ("+name+")"; //$NON-NLS-1$ //$NON-NLS-2$ - //name = ssf.getName() + ": "+name; + buf.append(")"); //$NON-NLS-1$ + name = buf.toString(); } return name; } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemConnectionFormCaller.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemConnectionFormCaller.java index c04a609004d..0f10a248810 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemConnectionFormCaller.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemConnectionFormCaller.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,10 +11,11 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.ui; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.swt.widgets.Shell; /** @@ -28,7 +29,7 @@ public interface ISystemConnectionFormCaller { * @param systemType the type of system selected * @param duringInitialization true if this is being set at page initialization time versus selected by the user */ - public void systemTypeSelected(String systemType, boolean duringInitialization); + public void systemTypeSelected(IRSESystemType systemType, boolean duringInitialization); /** * Return the shell hosting this form 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 45b40eb19cf..98374a129df 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 @@ -17,12 +17,15 @@ * David Dykstal (IBM) - 168977: refactoring IConnectorService and ServerLauncher hierarchies * David Dykstal (IBM) - 180562: remove implementation of IRSEUserIdConstants * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.ui; import java.lang.reflect.InvocationTargetException; import java.net.InetAddress; +import java.util.Arrays; +import java.util.List; import java.util.Vector; import org.eclipse.core.runtime.IProgressMonitor; @@ -34,7 +37,6 @@ import org.eclipse.jface.wizard.IWizardPage; 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.model.IHost; @@ -81,7 +83,9 @@ public class SystemConnectionForm implements Listener, SelectionListener, Runnab public static final boolean CREATE_MODE = false; public static final boolean UPDATE_MODE = true; - public static String lastSystemType = null; + public static IRSESystemType lastSystemType = null; + protected IRSESystemType defaultSystemType; + protected IRSESystemType[] validSystemTypes; // GUI widgets protected Label labelType, labelConnectionName, labelHostName, labelUserId, labelDescription, labelProfile; @@ -104,8 +108,7 @@ public class SystemConnectionForm implements Listener, SelectionListener, Runnab // other inputs protected ISystemMessageLine msgLine; protected ISystemConnectionFormCaller caller; - protected String[] restrictSystemTypesTo; - protected String defaultSystemType, defaultConnectionName, defaultHostName; + protected String defaultConnectionName, defaultHostName; protected String defaultUserId, defaultDescription, defaultProfile; // update mode initial values protected String[] defaultProfileNames; protected boolean defaultWorkOffline; @@ -227,28 +230,56 @@ public class SystemConnectionForm implements Listener, SelectionListener, Runnab } /** - * Call this to restrict the system type that the user is allowed to choose + * Call this to restrict the system type that the user is allowed to choose. + * Must be called before the widgets are created in + * {@link #createContents(Composite, boolean, String)}. + * + * @param systemType the only IRSESystemType allowed, or + * null to show all allowed system types. */ - public void restrictSystemType(String systemType) { - if (systemType.equals("*")) //$NON-NLS-1$ - return; - this.restrictSystemTypesTo = new String[1]; - this.restrictSystemTypesTo[0] = systemType; - if (defaultSystemType == null) - defaultSystemType = systemType; + public void restrictSystemType(IRSESystemType systemType) { + if (systemType==null) { + restrictSystemTypes(null); + } else { + IRSESystemType[] types = new IRSESystemType[] { systemType }; + restrictSystemTypes (types); + } } /** - * Call this to restrict the system types that the user is allowed to choose + * Call this to restrict the system types that the user is allowed to choose. + * + * @param systemTypes the list of allowed system types, or + * null to not restrict the allowed system types. */ - public void restrictSystemTypes(String[] systemTypes) { - if (systemTypes == null) - return; - else if ((systemTypes.length == 1) && (systemTypes[0].equals("*"))) //$NON-NLS-1$ - return; - this.restrictSystemTypesTo = systemTypes; - if (defaultSystemType == null) - defaultSystemType = systemTypes[0]; + public void restrictSystemTypes(IRSESystemType[] systemTypes) { + //Remember the old selection before changing the data + IRSESystemType oldSelection = getSystemType(); + + //Update the known list of valid system types + if (systemTypes == null) { + validSystemTypes = SystemWidgetHelpers.getValidSystemTypes(null); + } else { + validSystemTypes = new IRSESystemType[systemTypes.length]; + System.arraycopy(systemTypes, 0, validSystemTypes, 0, systemTypes.length); + SystemWidgetHelpers.sortSystemTypesByLabel(validSystemTypes); + } + + //Restore the default system type based on the new list + List systemTypesAsList = Arrays.asList(validSystemTypes); + if (defaultSystemType == null || !systemTypesAsList.contains(defaultSystemType)) { + defaultSystemType = validSystemTypes[0]; + } + + //Set items in Combo and restore the previous selection + if (textSystemType!=null) { + textSystemType.setItems(SystemWidgetHelpers.getSystemTypeLabels(validSystemTypes)); + if (oldSelection!=null && Arrays.asList(validSystemTypes).contains(oldSelection)) { + textSystemType.select(systemTypesAsList.indexOf(oldSelection)); + } else { + textSystemType.select(0); + } + } } /** @@ -271,7 +302,7 @@ public class SystemConnectionForm implements Listener, SelectionListener, Runnab */ public void initializeInputFields(IHost conn, boolean updateMode) { this.updateMode = updateMode; - defaultSystemType = conn.getSystemType().getName(); + defaultSystemType = conn.getSystemType(); defaultConnectionName = conn.getAliasName(); defaultHostName = conn.getHostName(); defaultUserId = conn.getLocalDefaultUserId(); @@ -468,21 +499,22 @@ public class SystemConnectionForm implements Listener, SelectionListener, Runnab if (!updateMode) { return false; } - - IRSESystemType sysType = RSECorePlugin.getDefault().getRegistry().getSystemType(defaultSystemType); - RSESystemTypeAdapter sysTypeAdapter = (RSESystemTypeAdapter)(sysType.getAdapter(IRSESystemType.class)); - return sysTypeAdapter.isEnableOffline(sysType); + RSESystemTypeAdapter sysTypeAdapter = (RSESystemTypeAdapter)(defaultSystemType.getAdapter(IRSESystemType.class)); + return sysTypeAdapter.isEnableOffline(defaultSystemType); } /** * Return user-entered System Type. * Call this after finish ends successfully. */ - public String getSystemType() { - if (textSystemType != null) - return textSystemType.getText().trim(); - else - return defaultSystemType; + public IRSESystemType getSystemType() { + if (textSystemType != null) { + int idx = textSystemType.getSelectionIndex(); + if (idx >= 0) { + return validSystemTypes[idx]; + } + } + return defaultSystemType; } /** @@ -603,7 +635,7 @@ public class SystemConnectionForm implements Listener, SelectionListener, Runnab SystemWidgetHelpers.createLabel(composite_prompts, " ", 2); // filler //$NON-NLS-1$ // SYSTEMTYPE PROMPT IN UPDATE MODE OR RESTRICTED MODE - if (updateMode || ((restrictSystemTypesTo != null) && (restrictSystemTypesTo.length == 1))) { + if (updateMode || ((validSystemTypes != null) && (validSystemTypes.length == 1))) { if (updateMode) { temp = SystemWidgetHelpers.appendColon(SystemResources.RESID_CONNECTION_SYSTEMTYPE_LABEL); labelSystemType = SystemWidgetHelpers.createLabel(composite_prompts, temp); @@ -624,9 +656,9 @@ public class SystemConnectionForm implements Listener, SelectionListener, Runnab if (!updateMode && (defaultSystemType == null)) { defaultSystemType = lastSystemType; - - if ((defaultSystemType == null) || (defaultSystemType.length() == 0)) - defaultSystemType = textSystemType.getItem(0); + if (defaultSystemType == null) { + defaultSystemType = validSystemTypes[0]; + } } textHostName = SystemWidgetHelpers.createHostNameCombo(composite_prompts, null, defaultSystemType); @@ -646,7 +678,12 @@ public class SystemConnectionForm implements Listener, SelectionListener, Runnab temp = SystemWidgetHelpers.appendColon(SystemResources.RESID_CONNECTION_SYSTEMTYPE_LABEL); labelSystemType = SystemWidgetHelpers.createLabel(composite_prompts, temp); labelSystemType.setToolTipText(SystemResources.RESID_CONNECTION_SYSTEMTYPE_TIP); - textSystemType = SystemWidgetHelpers.createSystemTypeCombo(composite_prompts, null, restrictSystemTypesTo); + if (validSystemTypes==null) { + validSystemTypes = SystemWidgetHelpers.getValidSystemTypes(null); + } else { + SystemWidgetHelpers.sortSystemTypesByLabel(validSystemTypes); + } + textSystemType = SystemWidgetHelpers.createSystemTypeCombo(composite_prompts, null, validSystemTypes); textSystemType.setToolTipText(SystemResources.RESID_CONNECTION_SYSTEMTYPE_TIP); SystemWidgetHelpers.setHelp(textSystemType, RSEUIPlugin.HELPPREFIX + "ccon0003"); //$NON-NLS-1$ } @@ -725,10 +762,10 @@ public class SystemConnectionForm implements Listener, SelectionListener, Runnab verifyHostNameCB.addSelectionListener(this); } - if ((textSystemType != null) && (textSystemType.getText() != null)) - caller.systemTypeSelected(textSystemType.getText(), true); - else if ((restrictSystemTypesTo != null) && (restrictSystemTypesTo.length == 1)) - caller.systemTypeSelected(restrictSystemTypesTo[0], true); + if ((textSystemType != null) && (textSystemType.getSelectionIndex()>=0)) + caller.systemTypeSelected(validSystemTypes[textSystemType.getSelectionIndex()], true); + else if ((validSystemTypes != null) && (validSystemTypes.length == 1)) + caller.systemTypeSelected(validSystemTypes[0], true); if (textUserId == null) userIdLocation = IRSEUserIdConstants.USERID_LOCATION_NOTSET; @@ -774,7 +811,7 @@ public class SystemConnectionForm implements Listener, SelectionListener, Runnab { String currHostName = textHostName.getText().trim(); boolean hostNameChanged = !currHostName.equals(originalHostName); - String currSystemType = textSystemType.getText().trim(); + IRSESystemType currSystemType = getSystemType(); textHostName.setItems(RSEUIPlugin.getTheSystemRegistry().getHostNames(currSystemType)); if (hostNameChanged) { textHostName.setText(currHostName); @@ -893,14 +930,14 @@ public class SystemConnectionForm implements Listener, SelectionListener, Runnab // ----------- // ...output-only: if ((textSystemTypeReadOnly != null) || singleTypeMode) { - if (restrictSystemTypesTo != null) { + if (validSystemTypes != null) { if (textSystemTypeReadOnly != null) - textSystemTypeReadOnly.setText(restrictSystemTypesTo[0]); + textSystemTypeReadOnly.setText(validSystemTypes[0].getLabel()); if (defaultSystemType == null) - defaultSystemType = restrictSystemTypesTo[0]; + defaultSystemType = validSystemTypes[0]; } else if (defaultSystemType != null) { if (textSystemTypeReadOnly != null) - textSystemTypeReadOnly.setText(defaultSystemType); + textSystemTypeReadOnly.setText(defaultSystemType.getLabel()); } } // ...selectable: @@ -909,13 +946,16 @@ public class SystemConnectionForm implements Listener, SelectionListener, Runnab defaultSystemType = lastSystemType; } if (defaultSystemType != null) { - int selIdx = textSystemType.indexOf(defaultSystemType); - if (selIdx >= 0) + int selIdx = Arrays.asList(validSystemTypes).indexOf(defaultSystemType); + if (selIdx >= 0) { textSystemType.select(selIdx); + } else { + textSystemType.select(0); + } } else { textSystemType.select(0); - defaultSystemType = textSystemType.getText(); } + defaultSystemType = getSystemType(); } // --------------------------------------------------- @@ -961,11 +1001,11 @@ public class SystemConnectionForm implements Listener, SelectionListener, Runnab * Initialize userId values. * We have to reset after user changes the system type */ - private void initializeUserIdField(String systemType, String currentUserId) { + private void initializeUserIdField(IRSESystemType systemType, String currentUserId) { // --------------- // default user id // --------------- - String parentUserId = RSEPreferencesManager.getUserId(systemType); + String parentUserId = RSEPreferencesManager.getUserId(systemType.getId()); if (textUserId != null) { textUserId.setInheritedText(parentUserId); boolean allowEditingOfInherited = ((parentUserId == null) || (parentUserId.length() == 0)); @@ -1101,7 +1141,7 @@ public class SystemConnectionForm implements Listener, SelectionListener, Runnab public void setPageComplete() { boolean complete = isPageComplete(); if (complete && (textSystemType != null)) - lastSystemType = textSystemType.getText().trim(); + lastSystemType = getSystemType(); if (callerInstanceOfWizardPage) { ((WizardPage)caller).setPageComplete(complete); } else if (callerInstanceOfSystemPromptDialog) { diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemWidgetHelpers.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemWidgetHelpers.java index 50f291b3475..bd55582f0b4 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemWidgetHelpers.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemWidgetHelpers.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -12,11 +12,13 @@ * * Contributors: * Javier Montalvo Orús (Symbian) - Bug 149151: New Connection first page should use a Listbox for systemtype + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.ui; import java.util.ArrayList; import java.util.Arrays; +import java.util.Comparator; import java.util.Locale; import org.eclipse.jface.action.IAction; @@ -24,6 +26,7 @@ import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.SystemBasePlugin; import org.eclipse.rse.core.model.IHost; +import org.eclipse.rse.core.model.ISystemRegistry; import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; import org.eclipse.rse.internal.ui.SystemResources; import org.eclipse.rse.ui.widgets.InheritableEntryField; @@ -749,58 +752,28 @@ public class SystemWidgetHelpers { return createPushButton(group, label, listener, tooltip); } - /** - * Creates a readonly system type listbox. - * Does NOT create the leading prompt or anything except the listbox. - * @param group composite to put the listbox into. - * @param listener object to listen for events. Can be null. - * @return empty listbox - */ - public static List createSystemTypeListBox(Composite group, Listener listener) { - return createSystemTypeListBox(group, listener, null); - } - /** * Creates a readonly system type listbox with the given system types. * Does NOT create the leading prompt or anything except the listbox. + * * @param group composite to put the listbox into. * @param listener object to listen for events. Can be null. - * @param systemTypes array of system types to add to the listbox + * @param systemTypes an array of system types to show in this Combo. + * Must not be null. + * Fill this with the result of {@link #getValidSystemTypes(String[])} + * with a null argument in order to get a combo box with all valid + * system types. * @return listbox containing the given system types - */ - public static List createSystemTypeListBox(Composite group, Listener listener, String[] systemTypes) { - ArrayList arrayList = new ArrayList(); - + public static List createSystemTypeListBox(Composite group, Listener listener, IRSESystemType[] systemTypes) { List list = createListBox(group, listener, false, null, SystemResources.RESID_CONNECTION_SYSTEMTYPE_TIP); - - String[] typeItems = ((systemTypes == null) ? getSystemTypeNames() : systemTypes); - - if (systemTypes == null) { - for (int i = 0; i < typeItems.length; i++) { - ISubSystemConfiguration[] configurations = RSEUIPlugin.getTheSystemRegistry().getSubSystemConfigurationsBySystemType(typeItems[i]); - - if (configurations != null && configurations.length > 0) { - arrayList.add(typeItems[i]); - } - } - - systemTypes = (String[])arrayList.toArray(new String[arrayList.size()]); - Arrays.sort(systemTypes); - } - - for(int i=0; i0){ list.select(0); } - return list; } - /** * Creates a new listbox instance and sets the default * layout data. @@ -1080,7 +1053,7 @@ public class SystemWidgetHelpers { * @param horizontalSpan number of columns this should span * @param newButton true if the combo is to have a "New..." button beside it */ - public static SystemHostCombo createConnectionCombo(Composite parent, SelectionListener listener, String[] systemTypes, ISubSystemConfiguration factory, String factoryId, String factoryCategory, IHost defaultConnection, int horizontalSpan, boolean newButton) { + public static SystemHostCombo createConnectionCombo(Composite parent, SelectionListener listener, IRSESystemType[] systemTypes, ISubSystemConfiguration factory, String factoryId, String factoryCategory, IHost defaultConnection, int horizontalSpan, boolean newButton) { SystemHostCombo combo = null; if (systemTypes != null) combo = new SystemHostCombo(parent, SWT.NULL, systemTypes, defaultConnection, newButton); @@ -1120,56 +1093,100 @@ public class SystemWidgetHelpers { return combo; } + private static IRSESystemType[] validSystemTypes = null; + /** - * Creates a readonly system type combination box. - * Does NOT create the leading prompt or anything except the combo. + * Return the list of all registered valid system types. + * + * A system type is considered valid, if at least one subsystem + * configuration is registered against it. The list is ordered + * alphabetically by system type label. + * + * @param restrictIds An array of system type IDs to restrict the + * returned list of valid system types to only those requested, + * or null to return all valid system types. + * @return an ordered list of all registered valid system types. */ - public static Combo createSystemTypeCombo(Composite parent, Listener listener) { - return createSystemTypeCombo(parent, listener, null); + public static IRSESystemType[] getValidSystemTypes(String[] restrictIds) { + if (validSystemTypes==null) { + IRSESystemType[] systemTypes = RSECorePlugin.getDefault().getRegistry().getSystemTypes(); + ArrayList list = new ArrayList(systemTypes.length); + ISystemRegistry sr = RSECorePlugin.getDefault().getSystemRegistry(); + for (int i=0; i 0) { + list.add(systemTypes[i]); + } + } + systemTypes = (IRSESystemType[])list.toArray(new IRSESystemType[list.size()]); + sortSystemTypesByLabel(systemTypes); + } + if (restrictIds==null) { + return validSystemTypes; + } else { + java.util.List result = new ArrayList(validSystemTypes.length); + java.util.List restrictList = Arrays.asList(restrictIds); + for(int i=0; inull. + * Fill this with the result of {@link #getValidSystemTypes(String[])} + * with a null argument in order to get a combo box with all valid + * system types. + * @return a Combo box displaying the given system types. */ - public static Combo createSystemTypeCombo(Composite parent, Listener listener, String[] systemTypes) { + public static Combo createSystemTypeCombo(Composite parent, Listener listener, IRSESystemType[] systemTypes) { Combo combo = createReadonlyCombo(parent, listener, SystemResources.RESID_CONNECTION_SYSTEMTYPE_TIP); - String[] typeItems = ((systemTypes == null) ? getSystemTypeNames() : systemTypes); - - ArrayList list = new ArrayList(); - - if (systemTypes == null) { - for (int i = 0; i < typeItems.length; i++) { - ISubSystemConfiguration[] configurations = RSEUIPlugin.getTheSystemRegistry().getSubSystemConfigurationsBySystemType(typeItems[i]); - - if (configurations != null && configurations.length > 0) { - list.add(typeItems[i]); - } - } - } - - typeItems = new String[list.size()]; - - for (int i = 0; i < list.size(); i++) { - typeItems[i] = (String)(list.get(i)); - } - - combo.setItems(typeItems); + combo.setItems(getSystemTypeLabels(systemTypes)); combo.select(0); return combo; } @@ -1180,7 +1197,7 @@ public class SystemWidgetHelpers { *

              * Does NOT create the leading prompt or anything except the combo. */ - public static Combo createHostNameCombo(Composite parent, Listener listener, String systemType) { + public static Combo createHostNameCombo(Composite parent, Listener listener, IRSESystemType systemType) { //System.out.println("TipId: " + ISystemConstants.RESID_HOSTNAME_TIP); Combo combo = createCombo(parent, listener, SystemResources.RESID_CONNECTION_HOSTNAME_TIP); //System.out.println("Tip : " + combo.getToolTipText()); @@ -1189,10 +1206,6 @@ public class SystemWidgetHelpers { return combo; } - - - - /** * Create an entry field controlled by an inherit/override switch button *

              diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemNewConnectionAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemNewConnectionAction.java index 5b9bb1e704a..dc47878ea0e 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemNewConnectionAction.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/actions/SystemNewConnectionAction.java @@ -12,12 +12,10 @@ * * Contributors: * Uwe Stieber (Wind River) - Set action id for identification from plugin.xml menu extensions. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.ui.actions; -import java.util.LinkedList; -import java.util.List; - import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; @@ -26,7 +24,6 @@ import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.wizard.IWizard; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.rse.core.IRSESystemType; -import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.filters.ISystemFilterPoolReference; import org.eclipse.rse.core.filters.ISystemFilterReference; import org.eclipse.rse.core.filters.ISystemFilterStringReference; @@ -47,7 +44,7 @@ public class SystemNewConnectionAction extends SystemBaseWizardAction { private boolean fromPopupMenu = true; private ISelectionProvider sp; - private String[] restrictSystemTypesTo; + private IRSESystemType[] restrictSystemTypesTo; // The current selection the action is knowing of. Just pass on // to the wizards. Do not interpret here! @@ -120,16 +117,7 @@ public class SystemNewConnectionAction extends SystemBaseWizardAction { // First, restrict the wizard in the system types to show if this is // requested. if (restrictSystemTypesTo != null) { - // Till now, we get the list of system types to restrict to via system - // type name. This should be changed to be a list of system type objects - // as soon as possible. Till than, we have to translate the lists here. - List systemTypes = new LinkedList(); - for (int i = 0; i < restrictSystemTypesTo.length; i++) { - IRSESystemType systemType = RSECorePlugin.getDefault().getRegistry().getSystemType(restrictSystemTypesTo[i]); - if (systemType != null) systemTypes.add(systemType); - } - - newConnWizard.restrictToSystemTypes((IRSESystemType[])systemTypes.toArray(new IRSESystemType[systemTypes.size()])); + newConnWizard.restrictToSystemTypes(restrictSystemTypesTo); } // If there is an remembered selection, we pass on the selected context @@ -167,7 +155,7 @@ public class SystemNewConnectionAction extends SystemBaseWizardAction { /** * Call this to restrict the system types that the user is allowed to choose */ - public void restrictSystemTypes(String[] systemTypes) { + public void restrictSystemTypes(IRSESystemType[] systemTypes) { this.restrictSystemTypesTo = systemTypes; } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/EnvironmentVariablesPromptDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/EnvironmentVariablesPromptDialog.java index ddf767aaec0..949e4e6e59f 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/EnvironmentVariablesPromptDialog.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/EnvironmentVariablesPromptDialog.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,11 +11,12 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.ui.dialogs; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.internal.ui.SystemResources; import org.eclipse.rse.services.clientserver.messages.SystemMessage; import org.eclipse.rse.ui.ISystemMessages; @@ -36,7 +37,8 @@ public class EnvironmentVariablesPromptDialog extends SystemPromptDialog impleme private Text nameTextField, valueTextField; - private String name, value, systemType, invalidNameChars; + private String name, value, invalidNameChars; + private IRSESystemType systemType; private boolean change; // Is this dialog for add or change private String[] existingNames; @@ -45,7 +47,7 @@ public class EnvironmentVariablesPromptDialog extends SystemPromptDialog impleme * @param shell * @param title */ - public EnvironmentVariablesPromptDialog(Shell shell, String title, String systemType, String invalidNameChars, String[] existingNames, boolean change) { + public EnvironmentVariablesPromptDialog(Shell shell, String title, IRSESystemType systemType, String invalidNameChars, String[] existingNames, boolean change) { super(shell, title); this.change = change; this.systemType = systemType; diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPersistencePrompt.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPersistencePrompt.java index 39947baeca9..6dea56301a1 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPersistencePrompt.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemPasswordPersistencePrompt.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,13 +11,14 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.ui.dialogs; import java.util.List; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.PasswordPersistenceManager; import org.eclipse.rse.core.model.SystemSignonInformation; import org.eclipse.rse.internal.ui.SystemResources; @@ -45,9 +46,11 @@ public final class SystemPasswordPersistencePrompt extends SystemPromptDialog im private Text hostname, userid, password, passwordVerify; private Combo systemType; + private IRSESystemType[] systemTypes; private SystemSignonInformation signonInfo; private boolean change; - private String originalHostname, originalUserid, originalSystemType; + private String originalHostname, originalUserid; + private IRSESystemType originalSystemType; private List existingEntries; @@ -79,11 +82,16 @@ public final class SystemPasswordPersistencePrompt extends SystemPromptDialog im hostname.addModifyListener(this); // System type prompt + systemTypes = PasswordPersistenceManager.getInstance().getRegisteredSystemTypes(); + String[] systemTypeLabels = new String[systemTypes.length]; + for (int i=0; i *

            • {@link #setHost(IHost) or #setDefaultConnection(SystemConnection)} *
            • {@link #setShowNewConnectionPrompt(boolean)} - *
            • {@link #setSystemTypes(String[])} + *
            • {@link #setSystemTypes(IRSESystemType[])} *
            • {@link #setAutoExpandDepth(int)} *
            • {@link #setRootFolder(IHost, String)} or {@link #setRootFolder(IRemoteFile)} or {@link #setPreSelection(IRemoteFile)} *
            • {@link #setFileTypes(String[])} or {@link #setFileTypes(String)} @@ -104,22 +105,20 @@ public class SystemSelectConnectionDialog form.setDefaultConnection(conn); } /** - * Restrict to certain system types - * @param systemTypes the system types to restrict what connections are shown and what types of connections - * the user can create - * @see org.eclipse.rse.core.IRSESystemType + * Restrict to certain system types. + * @param systemTypes the system types to restrict what connections + * are shown and what types of connections the user can create. */ - public void setSystemTypes(String[] systemTypes) + public void setSystemTypes(IRSESystemType[] systemTypes) { form.setSystemTypes(systemTypes); } /** - * Restrict to a certain system type - * @param systemType the system type to restrict what connections are shown and what types of connections - * the user can create - * @see org.eclipse.rse.core.IRSESystemType + * Restrict to a certain system type. + * @param systemType the system type to restrict what connections + * are shown and what types of connections the user can create. */ - public void setSystemType(String systemType) + public void setSystemType(IRSESystemType systemType) { form.setSystemType(systemType); } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemConnectionWizardPropertyPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemConnectionWizardPropertyPage.java index 8c4ca3085e4..6363983bf23 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemConnectionWizardPropertyPage.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/ISystemConnectionWizardPropertyPage.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,12 +11,13 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.ui.propertypages; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.subsystems.IConnectorService; import org.eclipse.rse.core.subsystems.ISubSystemConfiguration; @@ -28,5 +29,5 @@ public interface ISystemConnectionWizardPropertyPage public boolean applyValues(IConnectorService subsystem); public void setSubSystemConfiguration(ISubSystemConfiguration factory); public void setHostname(String hostname); - public void setSystemType(String systemType); + public void setSystemType(IRSESystemType systemType); } \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SignonPreferencePage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SignonPreferencePage.java index ee1a3af93aa..de36cbe31e8 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SignonPreferencePage.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/propertypages/SignonPreferencePage.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,7 +11,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.ui.propertypages; @@ -131,7 +131,7 @@ public final class SignonPreferencePage extends PreferencePage implements IWorkb return ((SystemSignonInformation) element).getHostname(); case 1: - return ((SystemSignonInformation) element).getSystemType(); + return ((SystemSignonInformation) element).getSystemType().getLabel(); case 2: return ((SystemSignonInformation) element).getUserId(); 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 6425fd42d69..602e1c3a0aa 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, 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -13,6 +13,7 @@ * Contributors: * David Dykstal (IBM) - moved SystemPreferencesManager to a new package * - created and used RSEPreferencesManager + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ @@ -319,7 +320,7 @@ public class SystemTypeFieldEditor extends FieldEditor ArrayList list = new ArrayList(); if (systemTypes == null || restoreDefaults) { for (int i = 0; i < types.length; i++) { - ISubSystemConfiguration[] configurations = RSEUIPlugin.getTheSystemRegistry().getSubSystemConfigurationsBySystemType(types[i].getName()); + ISubSystemConfiguration[] configurations = RSEUIPlugin.getTheSystemRegistry().getSubSystemConfigurationsBySystemType(types[i], false); if (configurations != null && configurations.length > 0) { list.add(types[i]); } @@ -399,7 +400,7 @@ public class SystemTypeFieldEditor extends FieldEditor else return; - keyValues.put(row.getLabel(), ""); //$NON-NLS-1$ + keyValues.put(row.getId(), ""); //$NON-NLS-1$ tableViewer.update(row, null); } 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 a189cd7b6a8..3059bb8c57e 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 @@ -13,6 +13,7 @@ * Contributors: * David Dykstal (IBM) - moved SystemPreferencesManager to a new package * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.ui.widgets; @@ -22,6 +23,7 @@ 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.IRSESystemType; import org.eclipse.rse.core.events.ISystemResourceChangeEvent; import org.eclipse.rse.core.events.ISystemResourceChangeEvents; import org.eclipse.rse.core.events.ISystemResourceChangeListener; @@ -92,13 +94,13 @@ public class SystemHostCombo extends Composite implements ISelectionProvider, protected boolean listeningForConnectionEvents = false; private IHost[] connections = null; private SystemNewConnectionAction newConnectionAction = null; - private String[] restrictSystemTypesTo = null; + private IRSESystemType[] restrictSystemTypesTo = null; private int gridColumns = 2; //private static final int DEFAULT_COMBO_WIDTH = 300; //private static final int DEFAULT_BUTTON_WIDTH = 80; private String label; - private String populateSystemType = null; /* used as criteria when refresh is done */ - private String[] populateSystemTypes = null; /* used as criteria when refresh is done */ + private IRSESystemType populateSystemType = null; /* used as criteria when refresh is done */ + private IRSESystemType[] populateSystemTypes = null; /* used as criteria when refresh is done */ private ISubSystemConfiguration populateSSFactory = null; /* used as criteria when refresh is done */ private String populateSSFactoryId = null; /* used as criteria when refresh is done */ private String populateSSFactoryCategory = null; /* used as criteria when refresh is done */ @@ -112,10 +114,10 @@ public class SystemHostCombo extends Composite implements ISelectionProvider, * @param defaultConnection the system connection to preselect. Pass null to preselect first connection. * @param showNewButton true if a New... button is to be included in this composite */ - public SystemHostCombo(Composite parent, int style, String systemType, IHost defaultConnection, boolean showNewButton) + public SystemHostCombo(Composite parent, int style, IRSESystemType systemType, IHost defaultConnection, boolean showNewButton) { super(parent, style); - restrictSystemTypesTo = new String[1]; + restrictSystemTypesTo = new IRSESystemType[1]; restrictSystemTypesTo[0] = systemType; init(parent, showNewButton); populateSystemType = systemType; @@ -131,7 +133,7 @@ public class SystemHostCombo extends Composite implements ISelectionProvider, * @param defaultConnection the system connection to preselect. Pass null to preselect first connection. * @param showNewButton true if a New... button is to be included in this composite */ - public SystemHostCombo(Composite parent, int style, String[] systemTypes, IHost defaultConnection, boolean showNewButton) + public SystemHostCombo(Composite parent, int style, IRSESystemType[] systemTypes, IHost defaultConnection, boolean showNewButton) { super(parent, style); restrictSystemTypesTo = systemTypes; @@ -217,15 +219,13 @@ public class SystemHostCombo extends Composite implements ISelectionProvider, // some one has overriden ISubSystemConfiguration.getSystemTypes(), the // proxy cannot return the correct list anymore. This is especially important // if the systemType <--> subsystemConfiguration association is dynamic! - String[] types = ssfProxies[idx].getSubSystemConfiguration().getSystemTypes(); + IRSESystemType[] types = ssfProxies[idx].getSubSystemConfiguration().getSystemTypes(); for (int jdx = 0; jdx < types.length; jdx++) { if (!vTypes.contains(types[jdx])) vTypes.addElement(types[jdx]); } } - restrictSystemTypesTo = new String[vTypes.size()]; - for (int idx = 0; idx < vTypes.size(); idx++) - restrictSystemTypesTo[idx] = (String)vTypes.elementAt(idx); + restrictSystemTypesTo = (IRSESystemType[])vTypes.toArray(new IRSESystemType[vTypes.size()]); } init(parent, showNewButton, showLabel); populateSSFactoryCategory = ssFactoryCategory; @@ -667,8 +667,8 @@ public class SystemHostCombo extends Composite implements ISelectionProvider, * @param preSelectIfNoMatch true if we should preselect the first item if the given connection is not found * @return true if given default connection was found and selected */ - protected boolean populateConnectionCombo(Combo combo, String systemType, IHost defaultConnection, - boolean preSelectIfNoMatch) + protected boolean populateConnectionCombo(Combo combo, IRSESystemType systemType, + IHost defaultConnection, boolean preSelectIfNoMatch) { return populateConnectionCombo(combo, systemType, defaultConnection, preSelectIfNoMatch, false); } @@ -686,7 +686,7 @@ public class SystemHostCombo extends Composite implements ISelectionProvider, * @param appendToCombo indicates whether or not to append to combo with population or replace * @return true if given default connection was found and selected */ - protected boolean populateConnectionCombo(Combo combo, String systemType, IHost defaultConnection, + protected boolean populateConnectionCombo(Combo combo, IRSESystemType systemType, IHost defaultConnection, boolean preSelectIfNoMatch, boolean appendToCombo) { boolean matchFound = false; @@ -751,7 +751,7 @@ public class SystemHostCombo extends Composite implements ISelectionProvider, * @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. */ - protected void populateConnectionCombo(Combo combo, String[] systemTypes, IHost defaultConnection) + protected void populateConnectionCombo(Combo combo, IRSESystemType[] systemTypes, IHost defaultConnection) { boolean match = false; boolean anyMatch = false; diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemSelectConnectionForm.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemSelectConnectionForm.java index f4c5d02f0ad..959a0d89412 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemSelectConnectionForm.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/widgets/SystemSelectConnectionForm.java @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (c) 2002, 2006 IBM Corporation. All rights reserved. + * Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -11,7 +11,7 @@ * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. * * Contributors: - * {Name} (company) - description of contribution. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.ui.widgets; @@ -22,6 +22,7 @@ import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.internal.ui.SystemResources; import org.eclipse.rse.internal.ui.view.SystemPropertySheetForm; @@ -52,7 +53,7 @@ import org.eclipse.swt.widgets.Text; *
                *
              • {@link #setShowNewConnectionPrompt(boolean)} *
              • {@link #setDefaultConnection(IHost)} - *
              • {@link #setSystemTypes(String[])} + *
              • {@link #setSystemTypes(IRSESystemType[])} *
              • {@link #setShowPropertySheet(boolean)} *
              • {@link #setMultipleSelectionMode(boolean)} *
              @@ -81,7 +82,7 @@ public class SystemSelectConnectionForm extends SystemBaseForm protected Composite outerParent, ps_composite; // inputs protected String verbiage = null; - protected String[] systemTypes = null; + protected IRSESystemType[] systemTypes = null; protected IHost defaultConn; protected boolean allowNew = true; protected boolean multipleSelectionMode; @@ -109,7 +110,7 @@ public class SystemSelectConnectionForm extends SystemBaseForm * @param msgLine A GUI widget capable of writing error messages to. * * @see #setShowNewConnectionPrompt(boolean) - * @see #setSystemTypes(String[]) + * @see #setSystemTypes(IRSESystemType[]) */ public SystemSelectConnectionForm(Shell shell, ISystemMessageLine msgLine) { @@ -141,25 +142,23 @@ public class SystemSelectConnectionForm extends SystemBaseForm allowNew = show; } /** - * Restrict to certain system types - * @param systemTypes the system types to restrict what connections are shown and what types of connections - * the user can create - * @see org.eclipse.rse.core.IRSESystemType + * Restrict to certain system types. + * @param systemTypes the system types to restrict what connections + * are shown and what types of connections the user can create. */ - public void setSystemTypes(String[] systemTypes) + public void setSystemTypes(IRSESystemType[] systemTypes) { this.systemTypes = systemTypes; } /** - * Restrict to one system type - * @param systemType the system type to restrict what connections are shown and what types of connections - * the user can create - * @see org.eclipse.rse.core.IRSESystemType + * Restrict to one system type. + * @param systemType the system type to restrict what connections + * are shown and what types of connections the user can create. */ - public void setSystemType(String systemType) + public void setSystemType(IRSESystemType systemType) { - systemTypes = new String[1]; - systemTypes[0] = systemType; + if (systemType==null) setSystemTypes(null); + setSystemTypes(new IRSESystemType[] {systemType}); } /** * Set the message shown as the text at the top of the form. Default is "Select a connection" diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SubSystemServiceWizardPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SubSystemServiceWizardPage.java index 29e9f49b004..0748cc507f0 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SubSystemServiceWizardPage.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/SubSystemServiceWizardPage.java @@ -13,6 +13,7 @@ * Contributors: * Uwe Stieber (Wind River) - Reworked new connection wizard extension point. * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.ui.wizards; @@ -88,9 +89,7 @@ public class SubSystemServiceWizardPage extends AbstractSystemNewConnectionWizar IServiceSubSystemConfiguration currentFactory = (IServiceSubSystemConfiguration)getSubSystemConfiguration(); IRSESystemType systemType = getMainPage() != null && getMainPage().getWizard() instanceof RSEDefaultNewConnectionWizard ? ((RSEDefaultNewConnectionWizard)getMainPage().getWizard()).getSystemType() : null; - String systemTypeName = systemType != null ? systemType.getName() : null; - - IServiceSubSystemConfiguration[] factories = getServiceSubSystemFactories(systemTypeName, currentFactory.getServiceType()); + IServiceSubSystemConfiguration[] factories = getServiceSubSystemConfigurations(systemType, currentFactory.getServiceType()); IHost dummyHost = null; if (getWizard() instanceof RSEDefaultNewConnectionWizard) @@ -119,22 +118,22 @@ public class SubSystemServiceWizardPage extends AbstractSystemNewConnectionWizar return _serviceElements; } - protected IServiceSubSystemConfiguration[] getServiceSubSystemFactories(String systemType, Class serviceType) + protected IServiceSubSystemConfiguration[] getServiceSubSystemConfigurations(IRSESystemType systemType, Class serviceType) { List results = new ArrayList(); ISystemRegistry sr = RSEUIPlugin.getTheSystemRegistry(); - ISubSystemConfiguration[] factories = sr.getSubSystemConfigurationsBySystemType(systemType); + ISubSystemConfiguration[] configs = sr.getSubSystemConfigurationsBySystemType(systemType, false); - for (int i = 0; i < factories.length; i++) + for (int i = 0; i < configs.length; i++) { - ISubSystemConfiguration factory = factories[i]; - if (factory instanceof IServiceSubSystemConfiguration) + ISubSystemConfiguration config = configs[i]; + if (config instanceof IServiceSubSystemConfiguration) { - IServiceSubSystemConfiguration sfactory = (IServiceSubSystemConfiguration)factory; - if (sfactory.getServiceType() == serviceType) + IServiceSubSystemConfiguration sconfig = (IServiceSubSystemConfiguration)config; + if (sconfig.getServiceType() == serviceType) { - results.add(sfactory); + results.add(sconfig); } } } diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizard.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizard.java index 6a496ebd17e..0bc6ab7fa6e 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizard.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizard.java @@ -13,6 +13,7 @@ * Contributors: * Uwe Stieber (Wind River) - Reworked new connection wizard extension point. * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.ui.wizards.newconnection; @@ -162,13 +163,13 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar if (getSystemType() == null) { pageTitle = SystemResources.RESID_NEWCONN_PAGE1_TITLE; } else { - String onlySystemType = getSystemType().getLabel(); + IRSESystemType onlySystemType = getSystemType(); - if (onlySystemType.equals(IRSESystemType.SYSTEMTYPE_LOCAL)) { + if (onlySystemType.getId().equals(IRSESystemType.SYSTEMTYPE_LOCAL_ID)) { pageTitle = SystemResources.RESID_NEWCONN_PAGE1_LOCAL_TITLE; } else { pageTitle = SystemResources.RESID_NEWCONN_PAGE1_REMOTE_TITLE; - pageTitle = SystemMessage.sub(pageTitle, "&1", onlySystemType); //$NON-NLS-1$ + pageTitle = SystemMessage.sub(pageTitle, "&1", onlySystemType.getLabel()); //$NON-NLS-1$ } } @@ -322,9 +323,9 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar if (ok) { try { - String sysType = getSystemType() != null ? getSystemType().getName() : null; + IRSESystemType systemType = getSystemType(); SystemConnectionForm form = mainPage.getSystemConnectionForm(); - IHost conn = sr.createHost(form.getProfileName(), sysType, form.getConnectionName(), form.getHostName(), + IHost conn = sr.createHost(form.getProfileName(), systemType, form.getConnectionName(), form.getHostName(), form.getConnectionDescription(), form.getDefaultUserId(), form.getUserIdLocation(), subsystemFactorySuppliedWizardPages); @@ -333,7 +334,7 @@ public class RSEDefaultNewConnectionWizard extends RSEAbstractNewConnectionWizar // a tweak that is the result of UCD feedback. Phil if ((conn != null) && SystemPerspectiveHelpers.isRSEPerspectiveActive()) { - if (sysType.equals(IRSESystemType.SYSTEMTYPE_ISERIES)) { + if (systemType.getId().equals(IRSESystemType.SYSTEMTYPE_ISERIES_ID)) { ISubSystem[] objSubSystems = sr.getSubSystemsBySubSystemConfigurationCategory("nativefiles", conn); //$NON-NLS-1$ if ((objSubSystems != null) && (objSubSystems.length > 0))// might be in product that doesn't have iSeries plugins sr.expandSubSystem(objSubSystems[0]); diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizardMainPage.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizardMainPage.java index 384702641e3..2b21e11f706 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizardMainPage.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/wizards/newconnection/RSEDefaultNewConnectionWizardMainPage.java @@ -12,6 +12,7 @@ * * Contributors: * Uwe Stieber (Wind River) - Reworked new connection wizard extension point. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.ui.wizards.newconnection; @@ -71,7 +72,7 @@ public class RSEDefaultNewConnectionWizardMainPage extends WizardPage implements if (systemType != null) { // The page _always_ restrict the system connection form // to only one system type. - getSystemConnectionForm().restrictSystemType(systemType.getName()); + getSystemConnectionForm().restrictSystemType(systemType); } } @@ -164,7 +165,7 @@ public class RSEDefaultNewConnectionWizardMainPage extends WizardPage implements /* (non-Javadoc) * @see org.eclipse.rse.ui.ISystemConnectionFormCaller#systemTypeSelected(java.lang.String, boolean) */ - public void systemTypeSelected(String systemType, boolean duringInitialization) { + public void systemTypeSelected(IRSESystemType systemType, boolean duringInitialization) { // Not applicable: The Page is driving the system connection form and not the way around!!! } diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemHostPool.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemHostPool.java index 7756738c5cb..2020f370677 100644 --- a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemHostPool.java +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemHostPool.java @@ -16,6 +16,7 @@ * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType * David Dykstal (IBM) - 142806: refactoring persistence framework * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.ui.internal.model; @@ -26,7 +27,6 @@ import java.util.List; 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.model.Host; import org.eclipse.rse.core.model.IHost; @@ -34,7 +34,7 @@ import org.eclipse.rse.core.model.IRSEPersistableContainer; import org.eclipse.rse.core.model.ISystemHostPool; import org.eclipse.rse.core.model.ISystemProfile; import org.eclipse.rse.core.model.RSEModelObject; -import org.eclipse.rse.internal.core.model.RSEModelResources; +import org.eclipse.rse.internal.core.RSECoreMessages; import org.eclipse.rse.internal.core.model.SystemProfileManager; import org.eclipse.rse.ui.RSESystemTypeAdapter; @@ -148,59 +148,35 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool } } - // ------------------------------------------------------------------------------------- // CONNECTION METHODS... // ------------------------------------------------------------------------------------- - /** - * Create a connection object, given only the minimal information. - *

              - * THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU. - * @param systemType system type matching one of the system type names defined via the - * systemTypes extension point. - * @param aliasName unique connection name. - * @param hostName ip name of host. - * @return SystemConnection object, or null if it failed to create - * because the aliasName is not unique. All other errors throw an exception. + + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemHostPool#createHost(org.eclipse.rse.core.IRSESystemType, java.lang.String, java.lang.String) */ - public IHost createHost(String systemType, String aliasName, String hostName) + public IHost createHost(IRSESystemType systemType, String aliasName, String hostName) throws Exception { return createHost(systemType,aliasName,hostName,null,null,IRSEUserIdConstants.USERID_LOCATION_HOST); } - /** - * Create a connection object, given all the possible attributes except default userId. - *

              - * THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU. - * @param systemType system type matching one of the system type names defined via the - * systemTypes extension point. - * @param aliasName unique connection name. - * @param hostName ip name of host. - * @param description optional description of the connection. Can be null. - * @return SystemConnection object, or null if it failed to create - * because the aliasName is not unique. All other errors throw an exception. + + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemHostPool#createHost(org.eclipse.rse.core.IRSESystemType, java.lang.String, java.lang.String, java.lang.String) */ - public IHost createHost(String systemType, String aliasName, String hostName, String description) + public IHost createHost(IRSESystemType systemType, String aliasName, String hostName, String description) throws Exception { return createHost(systemType,aliasName,hostName,description,null,IRSEUserIdConstants.USERID_LOCATION_HOST); } - /** - * Create a connection object, given all the possible attributes. - *

              - * The new connection is added to the list and saved to disk. - * @param systemType system type matching one of the system type names defined via the - * systemTypes extension point. - * @param aliasName unique connection name. - * @param hostName ip name of host. - * @param description optional description of the connection. Can be null. - * @param defaultUserId userId to use as the default for the subsystems. - * @param defaultUserIdLocation where to set the given default user Id. See IRSEUserIdConstants for values. - * @return SystemConnection object, or null if it failed to create - * because the aliasName is not unique. All other errors throw an exception. - * @see IRSEUserIdConstants + + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemHostPool#createHost(org.eclipse.rse.core.IRSESystemType, java.lang.String, java.lang.String, java.lang.String, java.lang.String, int) */ - public IHost createHost(String systemType, String aliasName, String hostName, + public IHost createHost(IRSESystemType systemType, String aliasName, String hostName, String description,String defaultUserId,int defaultUserIdLocation) throws Exception { @@ -215,9 +191,8 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool ISystemProfile profile = getSystemProfile(); // delegate the creation of the host object instance to the system type provider!!! - IRSESystemType systemTypeObject = RSECorePlugin.getDefault().getRegistry().getSystemType(systemType); - if (systemTypeObject != null) { - Object adapter = systemTypeObject.getAdapter(IRSESystemType.class); + if (systemType != null) { + Object adapter = systemType.getAdapter(IRSESystemType.class); if (adapter instanceof RSESystemTypeAdapter) { conn = ((RSESystemTypeAdapter)adapter).createNewHostInstance(profile); } @@ -229,7 +204,7 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool addHost(conn); // only record internally if saved successfully conn.setHostPool(this); conn.setAliasName(aliasName); - conn.setSystemType(systemTypeObject); + conn.setSystemType(systemType); // if default userID is null, and location is in the connection we should retrieve it and use it as the initial value. if (defaultUserId == null && defaultUserIdLocation == IRSEUserIdConstants.USERID_LOCATION_HOST) { defaultUserId = conn.getDefaultUserId(); @@ -242,25 +217,12 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool } return conn; } - /** - * Update an existing connection given the new information. - * This method: - *

                - *
              • calls the setXXX methods on the given connection object, updating the information in it. - *
              • saves the connection to disk (renaming its folder if needed) - *
              - *

              - * @param conn SystemConnection to be updated - * @param systemType system type matching one of the system type names defined via the - * systemTypes extension point. - * @param aliasName unique connection name. - * @param hostName ip name of host. - * @param description optional description of the connection. Can be null. - * @param defaultUserId userId to use as the default for the subsystems. - * @param defaultUserIdLocation where to set the given default user Id. See IRSEUserIdConstants for values. - * @see IRSEUserIdConstants + + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemHostPool#updateHost(org.eclipse.rse.core.model.IHost, org.eclipse.rse.core.IRSESystemType, java.lang.String, java.lang.String, java.lang.String, java.lang.String, int) */ - public void updateHost(IHost conn, String systemType, + public void updateHost(IHost conn, IRSESystemType systemType, String aliasName, String hostName, String description,String defaultUserId, int defaultUserIdLocation) throws Exception @@ -268,8 +230,7 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool boolean aliasNameChanged = !aliasName.equalsIgnoreCase(conn.getAliasName()); if (aliasNameChanged) renameHost(conn,aliasName); - IRSESystemType systemTypeObject = RSECorePlugin.getDefault().getRegistry().getSystemType(systemType); - conn.setSystemType(systemTypeObject); + conn.setSystemType(systemType); conn.setHostName(hostName); if (defaultUserIdLocation != IRSEUserIdConstants.USERID_LOCATION_NOTSET) { @@ -443,7 +404,7 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool throws Exception { IHost copy = - targetPool.createHost(conn.getSystemType().getName(), aliasName, + targetPool.createHost(conn.getSystemType(), aliasName, conn.getHostName(), conn.getDescription(), conn.getLocalDefaultUserId(), IRSEUserIdConstants.USERID_LOCATION_HOST); return copy; } @@ -555,7 +516,7 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool public String getDescription() { - return RSEModelResources.RESID_MODELOBJECTS_HOSTPOOL_DESCRIPTION; + return RSECoreMessages.RESID_MODELOBJECTS_HOSTPOOL_DESCRIPTION; } /** @@ -646,7 +607,8 @@ public class SystemHostPool extends RSEModelObject implements ISystemHostPool // ------------------------- /** * Save all connections to disk. - * Attempts to save all of them, swallowing exceptions, then at the end throws the last exception caught. + * Attempts to save all of them, swallowing exceptions, + * then at the end throws the last exception caught. */ public boolean commit() { diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemNewConnectionPromptObject.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemNewConnectionPromptObject.java index b48d1b16942..e100dab31f5 100644 --- a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemNewConnectionPromptObject.java +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemNewConnectionPromptObject.java @@ -12,6 +12,7 @@ * * Contributors: * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.ui.internal.model; @@ -83,22 +84,6 @@ public class SystemNewConnectionPromptObject implements ISystemPromptableObject, this.systemTypesSet = true; } - /** - * @deprecated Use {@link #setSystemTypes(IRSESystemType[])}. - */ - public void setSystemTypes(String[] systemTypes) { - if (systemTypes != null) { - List types = new ArrayList(); - for (int i = 0; i < systemTypes.length; i++) { - IRSESystemType type = RSECorePlugin.getDefault().getRegistry().getSystemType(systemTypes[i]); - if (type != null) types.add(type); - } - setSystemTypes((IRSESystemType[])types.toArray(new IRSESystemType[types.size()])); - } else { - setSystemTypes((IRSESystemType[])null); - } - } - /* (non-Javadoc) * @see org.eclipse.rse.ui.model.ISystemPromptableObject#getSystemTypes() */ @@ -280,9 +265,7 @@ public class SystemNewConnectionPromptObject implements ISystemPromptableObject, action = new SystemNewConnectionAction(shell, false, false, null); } if (systemTypes != null) { - List systemTypeNames = new ArrayList(); - for (int i = 0; i < systemTypes.length; i++) systemTypeNames.add(systemTypes[i].getName()); - action.restrictSystemTypes((String[])systemTypeNames.toArray(new String[systemTypeNames.size()])); + action.restrictSystemTypes(systemTypes); } try { diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemRegistry.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemRegistry.java index 80915521538..e5a6b4d1cba 100644 --- a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemRegistry.java +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/ui/internal/model/SystemRegistry.java @@ -19,10 +19,12 @@ * David Dykstal (IBM) - 142806: refactoring persistence framework * Tobias Schwarz (Wind River) - [183134] getLocalHost() does not return Local * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.ui.internal.model; import java.util.ArrayList; +import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.Vector; @@ -36,6 +38,7 @@ import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.Viewer; import org.eclipse.rse.core.IRSESystemType; 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.events.ISystemModelChangeEvent; @@ -602,27 +605,12 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid return factories; } - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.ISystemRegistry#getSubSystemConfigurationsBySystemType(org.eclipse.rse.core.IRSESystemType, boolean) - */ - public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(IRSESystemType systemType, boolean filterDuplicateServiceSubSystemFactories) { - return getSubSystemConfigurationsBySystemType(systemType != null ? systemType.getName() : null, filterDuplicateServiceSubSystemFactories); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.model.ISystemRegistry#getSubSystemConfigurationsBySystemType(java.lang.String) - */ - public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(String systemType) - { - return getSubSystemConfigurationsBySystemType(systemType, false); - } - /** - * Return all subsystem factories which support the given system type. If the type is null, - * returns all. + * Return all subsystem factories which support the given system type. + * If the type is null, returns all. * */ - public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(String systemType, boolean filterDuplicateServiceSubSystemFactories) + public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(IRSESystemType systemType, boolean filterDuplicateServiceSubSystemFactories) { List serviceTypesAdded = new ArrayList(); List serviceImplsAdded = new ArrayList(); @@ -1260,7 +1248,7 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid { for (int idx = 0; idx < subsystemFactoryProxies.length; idx++) { - // if (subsystemFactoryProxies[idx].appliesToSystemType(conn.getSystemType().getName())) + // if (subsystemFactoryProxies[idx].appliesToSystemType(conn.getSystemType())) // { ISubSystemConfiguration factory = subsystemFactoryProxies[idx].getSubSystemConfiguration(); if (factory != null) @@ -1416,7 +1404,7 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid { for (int idx = 0; idx < subsystemFactoryProxies.length; idx++) { - if (subsystemFactoryProxies[idx].appliesToSystemType(conn.getSystemType().getName()) && subsystemFactoryProxies[idx].isSubSystemConfigurationActive()) + if (subsystemFactoryProxies[idx].appliesToSystemType(conn.getSystemType()) && subsystemFactoryProxies[idx].isSubSystemConfigurationActive()) { ISubSystemConfiguration factory = subsystemFactoryProxies[idx].getSubSystemConfiguration(); if (factory != null) @@ -1660,7 +1648,8 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid public IHost getLocalHost() { IHost localConn = null; - IHost[] conns = getHostsBySystemType(IRSESystemType.SYSTEMTYPE_LOCAL); + IRSESystemType localType = RSECorePlugin.getDefault().getRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_LOCAL_ID); + IHost[] conns = getHostsBySystemType(localType); if (conns != null && conns.length > 0) return conns[0]; else return localConn; } @@ -1674,7 +1663,7 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid Vector v = new Vector(); for (int idx = 0; idx < pools.length; idx++) { - IHost[] conns = getHostsByProfile(getSystemProfileName(pools[idx])); + IHost[] conns = getHostsByProfile(getSystemProfile(pools[idx])); if (conns != null) for (int jdx = 0; jdx < conns.length; jdx++) v.addElement(conns[jdx]); @@ -1684,16 +1673,20 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid allConns[idx] = (IHost) v.elementAt(idx); return allConns; } - /** - * Return all connections in a given profile. + + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#getHostsByProfile(org.eclipse.rse.core.model.ISystemProfile) */ public IHost[] getHostsByProfile(ISystemProfile profile) { ISystemHostPool pool = getHostPool(profile); return pool.getHosts(); } - /** - * Return all connections in a given profile name. + + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#getHostsByProfile(java.lang.String) */ public IHost[] getHostsByProfile(String profileName) { @@ -1707,10 +1700,10 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid return null; } } - /** - * Return all connections for which there exists one or more subsystems owned - * by a given subsystem factory. - * @see #getSubSystemConfiguration(String) + + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#getHostsBySubSystemConfiguration(org.eclipse.rse.core.subsystems.ISubSystemConfiguration) */ public IHost[] getHostsBySubSystemConfiguration(ISubSystemConfiguration factory) { @@ -1733,23 +1726,19 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid } return conns; } - /** - * Return all connections for which there exists one or more subsystems owned - * by a given subsystem factory, identified by factory Id + + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#getHostsBySubSystemConfigurationId(java.lang.String) */ public IHost[] getHostsBySubSystemConfigurationId(String factoryId) { return getHostsBySubSystemConfiguration(getSubSystemConfiguration(factoryId)); } - /** - * Return all connections for which there exists one or more subsystems owned - * by any child classes of a given subsystem factory category. - *

              - * This looks for a match on the "category" of the subsystem factory's xml declaration - * in its plugin.xml file. Thus, it is effecient as it need not bring to live a - * subsystem factory just to test its parent class type. - * - * @see ISubSystemConfigurationCategories + + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#getHostsBySubSystemConfigurationCategory(java.lang.String) */ public IHost[] getHostsBySubSystemConfigurationCategory(String factoryCategory) { @@ -1803,64 +1792,44 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid return (IHost[])connections.toArray(new IHost[connections.size()]); } - /** - * Return all connections for all active profiles, for the given system type. - * Never returns null! + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#getHostsBySystemTypes(org.eclipse.rse.core.IRSESystemType[]) */ - public IHost[] getHostsBySystemType(String systemType) + public IHost[] getHostsBySystemTypes(IRSESystemType[] systemTypes) { + List systemTypesList = Arrays.asList(systemTypes); IHost[] connections = getHosts(); Vector v = new Vector(); for (int idx = 0; idx < connections.length; idx++) { - if (systemType.equals(connections[idx].getSystemType().getName())) + IRSESystemType systemType = connections[idx].getSystemType(); + if (systemTypesList.contains(systemType)) { v.addElement(connections[idx]); + } } - IHost[] conns = new IHost[v.size()]; - for (int idx = 0; idx < v.size(); idx++) - conns[idx] = (IHost) v.elementAt(idx); - return conns; - } - /** - * Return all connections for all active profiles, for the given system types. - * Never returns null! - */ - public IHost[] getHostsBySystemTypes(String[] systemTypes) - { - IHost[] connections = getHosts(); - Vector v = new Vector(); - for (int idx = 0; idx < connections.length; idx++) - { - String systemType = connections[idx].getSystemType().getName(); - boolean match = false; - for (int jdx = 0; !match && (jdx < systemTypes.length); jdx++) - if (systemType.equals(systemTypes[jdx])) - match = true; - if (match) - v.addElement(connections[idx]); - } - IHost[] conns = new IHost[v.size()]; - for (int idx = 0; idx < v.size(); idx++) - conns[idx] = (IHost) v.elementAt(idx); - return conns; + return (IHost[])v.toArray(new IHost[v.size()]); } - /** - * Return a SystemConnection object given a system profile containing it, - * and an connection name uniquely identifying it. + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#getHost(org.eclipse.rse.core.model.ISystemProfile, java.lang.String) */ public IHost getHost(ISystemProfile profile, String connectionName) { return getHostPool(profile).getHost(connectionName); } - /** - * Return the zero-based position of a SystemConnection object within its profile. + + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#getHostPosition(org.eclipse.rse.core.model.IHost) */ public int getHostPosition(IHost conn) { ISystemHostPool pool = conn.getHostPool(); return pool.getHostPosition(conn); } + /** * Return the zero-based position of a SystemConnection object within all active profiles. */ @@ -1876,23 +1845,27 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid return pos; } - /** - * Return the number of SystemConnection objects within the given profile + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#getHostCount(java.lang.String) */ public int getHostCount(String profileName) { return getHostPool(profileName).getHostCount(); } - /** - * Return the number of SystemConnection objects within the given connection's owning profile + + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#getHostCountWithinProfile(org.eclipse.rse.core.model.IHost) */ public int getHostCountWithinProfile(IHost conn) { return conn.getHostPool().getHostCount(); } - /** - * Return the number of SystemConnection objects within all active profiles + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#getHostCount() */ public int getHostCount() { @@ -1905,9 +1878,9 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid return total; } - /** - * Return a vector of previously-used connection names in the given named profile. - * @return Vector of String objects. + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#getHostAliasNames(java.lang.String) */ public Vector getHostAliasNames(String profileName) { @@ -1920,16 +1893,19 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid } return names; } - /** - * Return a vector of previously-used connection names in the given profile. - * @return Vector of String objects. + + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#getHostAliasNames(org.eclipse.rse.core.model.ISystemProfile) */ public Vector getHostAliasNames(ISystemProfile profile) { return getHostAliasNames(profile.getName()); } - /** - * Return a vector of previously-used connection names in all active profiles. + + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#getHostAliasNamesForAllActiveProfiles() */ public Vector getHostAliasNamesForAllActiveProfiles() { @@ -1944,19 +1920,11 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid return allNames; } - /** - * Return array of all previously specified hostnames. + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#getHostNames(org.eclipse.rse.core.IRSESystemType) */ - public String[] getHostNames() - { - return getHostNames(null); - } - /** - * Return array of previously specified hostnames for a given system type. - * After careful consideration, it is decided that if the system type is null, - * then no hostnames should be returned. Previously all for all types were returned. - */ - public String[] getHostNames(String systemType) + public String[] getHostNames(IRSESystemType systemType) { Vector v = new Vector(); @@ -1971,21 +1939,19 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid // in SystemConnectionForm. if (conns[idx].getHostName() != null && !v.contains(conns[idx].getHostName())) { - if (conns[idx].getSystemType().getName().equals(systemType)) + if (conns[idx].getSystemType().equals(systemType)) v.addElement(conns[idx].getHostName()); } } } - if ((systemType != null) && (systemType.equals(IRSESystemType.SYSTEMTYPE_LOCAL) && (v.size() == 0))) + if ((systemType != null) && (systemType.getId().equals(IRSESystemType.SYSTEMTYPE_LOCAL_ID) && (v.size() == 0))) v.addElement("localhost"); //$NON-NLS-1$ - String[] names = new String[v.size()]; - for (int idx = 0; idx < names.length; idx++) - names[idx] = (String) v.elementAt(idx); - return names; + return (String[])v.toArray(new String[v.size()]); } - /** - * Returns the clipboard used for copy actions + /* + * (non-Javadoc) + * @see org.eclipse.rse.ui.model.ISystemRegistryUI#getSystemClipboard() */ public Clipboard getSystemClipboard() { @@ -2058,6 +2024,10 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid } } + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#getSystemClipboardObjects(int) + */ public List getSystemClipboardObjects(int srcType) { Clipboard clipboard = getSystemClipboard(); @@ -2144,14 +2114,9 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid return scratchpad; } - - /** - * Convenience method to create a local connection, as it often that one is needed - * for access to the local file system. - * @param profile - the profile to create this connection in. If null is passed, we first - * try to find the default private profile and use it, else we take the first active profile. - * @param name - the name to give this profile. Must be unique and non-null. - * @param userId - the user ID to use as the default for the subsystems. Can be null. + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#createLocalHost(org.eclipse.rse.core.model.ISystemProfile, java.lang.String, java.lang.String) */ public IHost createLocalHost(ISystemProfile profile, String name, String userId) { @@ -2163,8 +2128,9 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid try { - localConn = createHost( - profile.getName(), IRSESystemType.SYSTEMTYPE_LOCAL, + IRSESystemType localType = RSECorePlugin.getDefault().getRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_LOCAL_ID); + localConn = createHost( + profile.getName(), localType, name, // connection name "localhost", // hostname //$NON-NLS-1$ "", // description //$NON-NLS-1$ @@ -2181,36 +2147,13 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid return localConn; } - /** - * Create a connection object, given the connection pool and given all the possible attributes. - *

              - * THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU, IN - * THE PROFILE YOU SPECIFY. THE PROFILE IS ALSO SAVED TO DISK. - *

              - * This method: - *

                - *
              • creates and saves a new connection within the given profile - *
              • calls all subsystem factories to give them a chance to create a subsystem instance - *
              • fires an ISystemResourceChangeEvent event of type EVENT_ADD to all registered listeners - *
              - *

              - * @param profileName Name of the system profile the connection is to be added to. - * @param systemType system type matching one of the system type names defined via the - * systemTypes extension point. - * @param connectionName unique connection name. - * @param hostName ip name of host. - * @param description optional description of the connection. Can be null. - * @param defaultUserId userId to use as the default for the subsystems. - * @param defaultUserIdLocation one of the constants in {@link org.eclipse.rse.core.IRSEUserIdConstants} - * that tells us where to set the user Id - * @param newConnectionWizardPages when called from the New Connection wizard this is union of the list of additional - * wizard pages supplied by the subsystem factories that pertain to the specified system type. Else null. - * @return SystemConnection object, or null if it failed to create. This is typically - * because the connectionName is not unique. Call getLastException() if necessary. + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#createHost(java.lang.String, org.eclipse.rse.core.IRSESystemType, java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, org.eclipse.rse.core.model.ISystemNewConnectionWizardPage[]) */ public IHost createHost( String profileName, - String systemType, + IRSESystemType systemType, String connectionName, String hostName, String description, @@ -2236,8 +2179,8 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid *

            *

            * @param profileName Name of the system profile the connection is to be added to. - * @param systemType system type matching one of the system type names defined via the - * systemTypes extension point. + * @param systemType system type matching one of the system types + * defined via the systemTypes extension point. * @param connectionName unique connection name. * @param hostName ip name of host. * @param description optional description of the connection. Can be null. @@ -2252,7 +2195,7 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid */ public IHost createHost( String profileName, - String systemType, + IRSESystemType systemType, String connectionName, String hostName, String description, @@ -2307,12 +2250,9 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid return conn; } - /** - * Creates subsystems for a given host and subsystem configurations. - * @param host the host. - * @param configurations the subsystem configurations. - * @return the array of subsystems corresponding to the array of given configurations. - * @since 2.0 + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#createSubSystems(org.eclipse.rse.core.model.IHost, org.eclipse.rse.core.subsystems.ISubSystemConfiguration[]) */ public ISubSystem[] createSubSystems(IHost host, ISubSystemConfiguration[] configurations) { @@ -2330,7 +2270,6 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid return subsystems; } - class FireNewHostEvents implements Runnable { private ISubSystem[] subSystems; @@ -2389,29 +2328,12 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid subPages[count++] = allPages[idx]; return subPages; } - /** - * Create a connection object. This is a simplified version - *

            - * THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU, IN - * THE PROFILE YOU SPECIFY. THE PROFILE IS ALSO SAVED TO DISK. - *

            - * This method: - *

              - *
            • creates and saves a new connection within the given profile - *
            • calls all subsystem factories to give them a chance to create a subsystem instance - *
            • fires an ISystemResourceChangeEvent event of type EVENT_ADD to all registered listeners - *
            - *

            - * @param profileName Name of the system profile the connection is to be added to. - * @param systemType system type matching one of the system type names defined via the - * systemTypes extension point. - * @param connectionName unique connection name. - * @param hostName ip name of host. - * @param description optional description of the connection. Can be null. - * @return SystemConnection object, or null if it failed to create. This is typically - * because the connectionName is not unique. Call getLastException() if necessary. + + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#createHost(java.lang.String, org.eclipse.rse.core.IRSESystemType, java.lang.String, java.lang.String, java.lang.String) */ - public IHost createHost(String profileName, String systemType, String connectionName, String hostName, String description) + public IHost createHost(String profileName, IRSESystemType systemType, String connectionName, String hostName, String description) throws Exception { return createHost(profileName, systemType, connectionName, hostName, description, true); @@ -2431,8 +2353,8 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid *

          *

          * @param profileName Name of the system profile the connection is to be added to. - * @param systemType system type matching one of the system type names defined via the - * systemTypes extension point. + * @param systemType system type matching one of the system types + * defined via the systemTypes extension point. * @param connectionName unique connection name. * @param hostName ip name of host. * @param description optional description of the connection. Can be null. @@ -2441,34 +2363,16 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid * because the connectionName is not unique. Call getLastException() if necessary. * @since 2.0 */ - public IHost createHost(String profileName, String systemType, String connectionName, String hostName, String description, boolean createSubSystems) throws Exception + public IHost createHost(String profileName, IRSESystemType systemType, String connectionName, String hostName, String description, boolean createSubSystems) throws Exception { return createHost(profileName, systemType, connectionName, hostName, description, null, IRSEUserIdConstants.USERID_LOCATION_HOST, null); } - /** - * Create a connection object. This is a very simplified version that defaults to the user's - * private profile, or the first active profile if there is no private profile. - *

          - * THE RESULTING CONNECTION OBJECT IS ADDED TO THE LIST OF EXISTING CONNECTIONS FOR YOU, IN - * THE DEFAULT PRIVATE PROFILE, WHICH IS SAVED TO DISK. - *

          - * This method: - *

            - *
          • creates and saves a new connection within the given profile - *
          • calls all subsystem factories to give them a chance to create a subsystem instance - *
          • fires an ISystemResourceChangeEvent event of type EVENT_ADD to all registered listeners - *
          - *

          - * @param systemType system type matching one of the system type names defined via the - * systemTypes extension point. - * @param connectionName unique connection name. - * @param hostName ip name of host. - * @param description optional description of the connection. Can be null. - * @return SystemConnection object, or null if it failed to create. This is typically - * because the connectionName is not unique. Call getLastException() if necessary. + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#createHost(org.eclipse.rse.core.IRSESystemType, java.lang.String, java.lang.String, java.lang.String) */ - public IHost createHost(String systemType, String connectionName, String hostName, String description) + public IHost createHost(IRSESystemType systemType, String connectionName, String hostName, String description) throws Exception { ISystemProfile profile = getSystemProfileManager().getDefaultPrivateSystemProfile(); @@ -2476,6 +2380,7 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid profile = getSystemProfileManager().getActiveSystemProfiles()[0]; return createHost(profile.getName(), systemType, connectionName, hostName, description); } + /** * Return the previous connection as would be shown in the view */ @@ -2498,30 +2403,12 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid } return prevConn; } - /** - * Update an existing connection given the new information. - * This method: - *

            - *
          • calls the setXXX methods on the given connection object, updating the information in it. - *
          • save the connection's connection pool to disk - *
          • fires an ISystemResourceChangeEvent event of type EVENT_CHANGE to all registered listeners - *
          • if the systemtype or hostname is changed, calls disconnect on each associated subsystem. - * We must do this because a hostname changes fundamentally affects the connection, - * rendering any information currently displayed under - * that connection obsolete. That is, the user will have to reconnect. - *
          - *

          - * @param conn SystemConnection to be updated - * @param systemType system type matching one of the system type names defined via the - * systemTypes extension point. - * @param connectionName unique connection name. - * @param hostName ip name of host. - * @param description optional description of the connection. Can be null. - * @param defaultUserId userId to use as the default for the subsystems. - * @param defaultUserIdLocation one of the constants in {@link org.eclipse.rse.core.IRSEUserIdConstants} - * that tells us where to set the user Id + + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#updateHost(org.eclipse.rse.core.model.IHost, org.eclipse.rse.core.IRSESystemType, java.lang.String, java.lang.String, java.lang.String, java.lang.String, int) */ - public void updateHost(IHost conn, String systemType, String connectionName, String hostName, String description, String defaultUserId, int defaultUserIdLocation) + public void updateHost(IHost conn, IRSESystemType systemType, String connectionName, String hostName, String description, String defaultUserId, int defaultUserIdLocation) { lastException = null; boolean connectionNameChanged = !connectionName.equalsIgnoreCase(conn.getAliasName()); @@ -2588,11 +2475,9 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid } } - /** - * Update the workoffline attribute for a connection. - * - * @param conn SystemConnection to change - * @param offline true if connection should be set offline, false if it should be set online + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#setHostOffline(org.eclipse.rse.core.model.IHost, boolean) */ public void setHostOffline(IHost conn, boolean offline) { @@ -2604,17 +2489,9 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid } } - /** - * Delete an existing connection. - *

          - * Lots to do here: - *

            - *
          • Delete all subsystem objects for this connection, including their file's on disk. - *
          • Delete this connection's private filter pool, if exists - *
          • Delete the connection from memory. - *
          • Delete the connection's folder from disk. - *
          - * Assumption: firing the delete event is done elsewhere. Specifically, the doDelete method of SystemView. + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#deleteHost(org.eclipse.rse.core.model.IHost) */ public void deleteHost(IHost conn) { @@ -2631,16 +2508,9 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid conn, null); } - /** - * Renames an existing connection. - *

          - * Lots to do here: - *

            - *
          • Reset the conn name for all subsystem objects for this connection - *
          • Rename the connection in memory. - *
          • Rename the connection's folder on disk. - *
          - * Assumption: firing the rename event is done elsewhere. Specifically, the doRename method of SystemView. + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#renameHost(org.eclipse.rse.core.model.IHost, java.lang.String) */ public void renameHost(IHost conn, String newName) throws Exception { @@ -2671,18 +2541,10 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid conn, oldName); } - /** - * Move existing connections a given number of positions in the same profile. - * If the delta is negative, they are all moved up by the given amount. If - * positive, they are all moved down by the given amount.

          - *

            - *
          • After the move, the pool containing the moved connection is saved to disk. - *
          • The connection's connection name must be unique in pool. - *
          • Fires a single ISystemResourceChangeEvent event of type EVENT_MOVE, if the pool is the private pool. - *
          - * TODO PROBLEM: CAN'T RE-ORDER FOLDERS SO CAN WE SUPPORT THIS ACTION? - * @param conns Array of SystemConnections to move. - * @param delta new zero-based position for the connection + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#moveHosts(java.lang.String, org.eclipse.rse.core.model.IHost[], int) + * FIXME PROBLEM: CAN'T RE-ORDER FOLDERS SO CAN WE SUPPORT THIS ACTION? */ public void moveHosts(String profileName, IHost conns[], int delta) { @@ -2701,13 +2563,9 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid conns[idx], null); } - /** - * Copy a SystemConnection. All subsystems are copied, and all connection data is copied. - * @param monitor Progress monitor to reflect each step of the operation - * @param conn The connection to copy - * @param targetProfile What profile to copy into - * @param newName Unique name to give copied profile - * @return new SystemConnection object + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#copyHost(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.rse.core.model.IHost, org.eclipse.rse.core.model.ISystemProfile, java.lang.String) */ public IHost copyHost(IProgressMonitor monitor, IHost conn, ISystemProfile targetProfile, String newName) throws Exception { @@ -2792,15 +2650,9 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid return newConn; } - /** - * Move a SystemConnection to another profile. All subsystems are moved, and all connection data is moved. - * This is actually accomplished by doing a copy operation first, and if successful deleting the original. - * @param monitor Progress monitor to reflect each step of the operation - * @param conn The connection to move - * @param targetProfile What profile to move into - * @param newName Unique name to give copied profile. Typically this is the same as the original name, but - * will be different on name collisions - * @return new SystemConnection object + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#moveHost(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.rse.core.model.IHost, org.eclipse.rse.core.model.ISystemProfile, java.lang.String) */ public IHost moveHost(IProgressMonitor monitor, IHost conn, ISystemProfile targetProfile, String newName) throws Exception { @@ -2823,7 +2675,8 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid return newConn; } - /** + /* + * (non-Javadoc) * @see org.eclipse.rse.core.model.ISystemRegistry#isAnySubSystemSupportsConnect(org.eclipse.rse.core.model.IHost) */ public boolean isAnySubSystemSupportsConnect(IHost conn) { @@ -2848,8 +2701,9 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid return false; } - /** - * Return true if any of the subsystems for the given connection are currently connected + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#isAnySubSystemConnected(org.eclipse.rse.core.model.IHost) */ public boolean isAnySubSystemConnected(IHost conn) { @@ -2866,8 +2720,9 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid return any; } - /** - * Return true if all of the subsystems for the given connection are currently connected + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#areAllSubSystemsConnected(org.eclipse.rse.core.model.IHost) */ public boolean areAllSubSystemsConnected(IHost conn) { @@ -2886,8 +2741,10 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid } return all; } - /** - * Disconnect all subsystems for the given connection, if they are currently connected. + + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#disconnectAllSubSystems(org.eclipse.rse.core.model.IHost) */ public void disconnectAllSubSystems(IHost conn) { @@ -2921,18 +2778,18 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemViewInputProvid } } - /** - * Inform the world when the connection status changes for a subsystem within a connection. - * Update properties for the subsystem and its connection + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#connectedStatusChange(org.eclipse.rse.core.subsystems.ISubSystem, boolean, boolean) */ public void connectedStatusChange(ISubSystem subsystem, boolean connected, boolean wasConnected) { connectedStatusChange(subsystem, connected, wasConnected, true); } - /** - * Inform the world when the connection status changes for a subsystem within a connection. - * Update properties for the subsystem and its connection + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#connectedStatusChange(org.eclipse.rse.core.subsystems.ISubSystem, boolean, boolean, boolean) */ public void connectedStatusChange(ISubSystem subsystem, boolean connected, boolean wasConnected, boolean collapseTree) { 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 51b03157951..1d6a00b47e8 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 @@ -17,6 +17,7 @@ * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType * David Dykstal (IBM) - 142806: refactoring persistence framework * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.core.subsystems; @@ -758,7 +759,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration /** * Return the system types this subsystem factory supports. */ - public String[] getSystemTypes() + public IRSESystemType[] getSystemTypes() { return proxy.getSystemTypes(); } @@ -931,7 +932,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration else { // strange situation..log this - RSEUIPlugin.logInfo("renameSubSystemsByConnection for " + conn.getAliasName() + " has no subsystems" ); + SystemBasePlugin.logInfo("renameSubSystemsByConnection for " + conn.getAliasName() + " has no subsystems" ); //$NON-NLS-1$ //$NON-NLS-2$ } try { @@ -1002,7 +1003,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration if (allActiveConnections != null) { for (int idx = 0; idx < allActiveConnections.length; idx++) - if (proxy.appliesToSystemType(allActiveConnections[idx].getSystemType().getName())) + if (proxy.appliesToSystemType(allActiveConnections[idx].getSystemType())) getSubSystems(allActiveConnections[idx], force); // will load from disk if not already loaded } allSubSystemsRestored = true; @@ -1042,7 +1043,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration boolean subsystemsRestored = subSystemsHaveBeenRestored(conn); if (!subsystemsRestored && force) { - RSEUIPlugin.logInfo("in SubSystemConfiguration.getSubSystems(conn, force) - not restored"); + SystemBasePlugin.logInfo("in SubSystemConfiguration.getSubSystems(conn, force) - not restored"); //$NON-NLS-1$ /*FIXME - this should now be triggered by new persistence model try { @@ -1064,7 +1065,7 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration } else if (!subsystemsRestored && !force) { - RSEUIPlugin.logInfo("in SubSystemConfiguration.getSubSytems(conn, force) - returning empty array"); + SystemBasePlugin.logInfo("in SubSystemConfiguration.getSubSytems(conn, force) - returning empty array"); //$NON-NLS-1$ return EMPTY_SUBSYSTEM_ARRAY; } else @@ -2688,15 +2689,18 @@ public abstract class SubSystemConfiguration implements ISubSystemConfiguration public IServerLauncherProperties createServerLauncher(IConnectorService connectorService) { IRemoteServerLauncher sl = new RemoteServerLauncher("Remote Server Launcher", connectorService); //$NON-NLS-1$ - String systemType = connectorService.getHostType(); + IRSESystemType systemType = connectorService.getHost().getSystemType(); + String systemTypeId = systemType.getId(); - if (systemType.equals(IRSESystemType.SYSTEMTYPE_LINUX) || - systemType.equals(IRSESystemType.SYSTEMTYPE_POWER_LINUX) || - systemType.equals(IRSESystemType.SYSTEMTYPE_ZSERIES_LINUX)) { + if (systemTypeId.equals(IRSESystemType.SYSTEMTYPE_LINUX_ID) + || systemTypeId.equals(IRSESystemType.SYSTEMTYPE_POWER_LINUX_ID) + || systemTypeId.equals(IRSESystemType.SYSTEMTYPE_ZSERIES_LINUX_ID) + ) { sl.setServerScript(RemoteServerLauncherConstants.LINUX_REXEC_SCRIPT); } - else if (systemType.equals(IRSESystemType.SYSTEMTYPE_UNIX) || - systemType.equals(IRSESystemType.SYSTEMTYPE_AIX)) { + else if (systemTypeId.equals(IRSESystemType.SYSTEMTYPE_UNIX_ID) + || systemTypeId.equals(IRSESystemType.SYSTEMTYPE_AIX_ID) + ) { sl.setServerScript(RemoteServerLauncherConstants.UNIX_REXEC_SCRIPT); } diff --git a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/ui/subsystems/StandardCredentialsProvider.java b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/ui/subsystems/StandardCredentialsProvider.java index 01ef4931044..c9ce46dda07 100644 --- a/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/ui/subsystems/StandardCredentialsProvider.java +++ b/rse/plugins/org.eclipse.rse.ui/subsystems/org/eclipse/rse/ui/subsystems/StandardCredentialsProvider.java @@ -7,10 +7,12 @@ * Contributors: * David Dykstal (IBM) - 168977: refactoring IConnectorService * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.ui.subsystems; import org.eclipse.core.runtime.Platform; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.PasswordPersistenceManager; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.SystemSignonInformation; @@ -175,7 +177,7 @@ public class StandardCredentialsProvider extends AbstractCredentialsProvider { ISubSystem subsystem = getPrimarySubSystem(); IHost host = subsystem.getHost(); String hostName = host.getHostName(); - String hostType = host.getSystemType().getName(); + IRSESystemType systemType = host.getSystemType(); savePassword = false; if (supportsUserId()) { boolean sameHost = hostName.equalsIgnoreCase(getConnectorService().getHostName()); @@ -187,7 +189,7 @@ public class StandardCredentialsProvider extends AbstractCredentialsProvider { if (supportsPassword()) { if (password == null) { PasswordPersistenceManager ppm = PasswordPersistenceManager.getInstance(); - SystemSignonInformation savedSignonInformation = ppm.find(hostType, hostName, userId); + SystemSignonInformation savedSignonInformation = ppm.find(systemType, hostName, userId); if (savedSignonInformation != null) { password = savedSignonInformation.getPassword(); savePassword = true; @@ -253,7 +255,7 @@ public class StandardCredentialsProvider extends AbstractCredentialsProvider { public final ICredentials getCredentials() { IHost host = getConnectorService().getHost(); String hostName = host.getHostName(); - String systemType = host.getSystemType().getName(); + IRSESystemType systemType = host.getSystemType(); SystemSignonInformation result = new SystemSignonInformation(hostName, userId, password, systemType); return result; } @@ -296,7 +298,7 @@ public class StandardCredentialsProvider extends AbstractCredentialsProvider { matchingUserId = matchingUserId.toUpperCase(); } IConnectorService cs = getConnectorService(); - String systemType = cs.getHostType(); + IRSESystemType systemType = cs.getHost().getSystemType(); String hostName = cs.getHostName(); SystemSignonInformation signonInformation = new SystemSignonInformation(hostName, matchingUserId, password, systemType); setSignonInformation(signonInformation); diff --git a/rse/plugins/org.eclipse.rse.useractions/src/org/eclipse/rse/internal/useractions/ui/uda/SystemUserActionExtension.java b/rse/plugins/org.eclipse.rse.useractions/src/org/eclipse/rse/internal/useractions/ui/uda/SystemUserActionExtension.java index f2f9375a644..a08872652a0 100644 --- a/rse/plugins/org.eclipse.rse.useractions/src/org/eclipse/rse/internal/useractions/ui/uda/SystemUserActionExtension.java +++ b/rse/plugins/org.eclipse.rse.useractions/src/org/eclipse/rse/internal/useractions/ui/uda/SystemUserActionExtension.java @@ -1,5 +1,3 @@ -package org.eclipse.rse.internal.useractions.ui.uda; - /******************************************************************************* * Copyright (c) 2002, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials @@ -9,8 +7,13 @@ package org.eclipse.rse.internal.useractions.ui.uda; * * Contributors: * IBM Corporation - initial API and implementation + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType *******************************************************************************/ + +package org.eclipse.rse.internal.useractions.ui.uda; + import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.rse.core.IRSESystemType; /** * This class represents a user action read from a user action extension point @@ -19,7 +22,8 @@ import org.eclipse.core.runtime.IConfigurationElement; * IT IS NOT COMPLETE YET AND NOT SUPPORTED YET. */ public class SystemUserActionExtension { - private String types, id, vendor; + private String types; + private String id, vendor; private boolean allTypes; // SEE FILE plugin.xml.udaExtensionPoint.notused @@ -51,11 +55,13 @@ public class SystemUserActionExtension { /** * Return true if this extension's systemTypes attribute matches the given system type */ - public boolean appliesToSystemType(String type) { + public boolean appliesToSystemType(IRSESystemType type) { //System.out.println("INSIDE APPLIESTO FOR " + type + ". allTypes = " + allTypes + ". types = " + types); if (allTypes) return true; - else - return (types.indexOf(type) >= 0); + else { + //FIXME migrate to using ID + return (types.indexOf(type.getName()) >= 0); + } } } diff --git a/rse/plugins/org.eclipse.rse.useractions/src/org/eclipse/rse/internal/useractions/ui/uda/SystemUserActionExtensionManager.java b/rse/plugins/org.eclipse.rse.useractions/src/org/eclipse/rse/internal/useractions/ui/uda/SystemUserActionExtensionManager.java index c61baca437a..41e90c2dd9a 100644 --- a/rse/plugins/org.eclipse.rse.useractions/src/org/eclipse/rse/internal/useractions/ui/uda/SystemUserActionExtensionManager.java +++ b/rse/plugins/org.eclipse.rse.useractions/src/org/eclipse/rse/internal/useractions/ui/uda/SystemUserActionExtensionManager.java @@ -1,5 +1,3 @@ -package org.eclipse.rse.internal.useractions.ui.uda; - /******************************************************************************* * Copyright (c) 2002, 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials @@ -9,12 +7,17 @@ package org.eclipse.rse.internal.useractions.ui.uda; * * Contributors: * IBM Corporation - initial API and implementation + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType *******************************************************************************/ + +package org.eclipse.rse.internal.useractions.ui.uda; + import java.util.Vector; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExtensionRegistry; import org.eclipse.core.runtime.Platform; +import org.eclipse.rse.core.IRSESystemType; /** * This class manages reading user action extension points. @@ -52,7 +55,7 @@ public class SystemUserActionExtensionManager { * Return list of user-actions defined by the given extension point, for the given * system type. */ - public SystemUserActionExtension[] getUserActionExtensions(String systemType) { + public SystemUserActionExtension[] getUserActionExtensions(IRSESystemType systemType) { int count = 0; if (!read) readExtensions(); if ((elements == null) || (elements.size() == 0)) return null; diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/IRSEConnectionProperties.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/IRSEConnectionProperties.java index 91fd22acea8..e86ca7cd295 100644 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/IRSEConnectionProperties.java +++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/IRSEConnectionProperties.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * Uwe Stieber (Wind River) - initial API and implementation + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType *******************************************************************************/ package org.eclipse.rse.tests.core.connection; @@ -18,7 +19,7 @@ public interface IRSEConnectionProperties { public final String ATTR_NAME = "name"; //$NON-NLS-1$ public final String ATTR_PROFILE_NAME = "profile_name"; //$NON-NLS-1$ - public final String ATTR_SYSTEM_TYPE = "system_type"; //$NON-NLS-1$ + public final String ATTR_SYSTEM_TYPE_ID = "system_type_id"; //$NON-NLS-1$ public final String ATTR_ADDRESS = "address"; //$NON-NLS-1$ public final String ATTR_USERID = "userid"; //$NON-NLS-1$ public final String ATTR_PASSWORD = "password"; //$NON-NLS-1$ diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEBaseConnectionTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEBaseConnectionTestCase.java index bee7aecdc02..cc581e62af1 100644 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEBaseConnectionTestCase.java +++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEBaseConnectionTestCase.java @@ -1,5 +1,5 @@ -/* ******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. All rights reserved. +/******************************************************************************** + * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -8,11 +8,13 @@ * Don Yantzi (IBM) - initial contribution. * David Dykstal (IBM) - initial contribution. * Uwe Stieber (Wind River) - refactoring and cleanup. - * *******************************************************************************/ + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType + ********************************************************************************/ package org.eclipse.rse.tests.core.connection; import java.util.Properties; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.tests.core.RSECoreTestCase; import org.eclipse.rse.tests.internal.RSEConnectionManager; @@ -43,7 +45,7 @@ public class RSEBaseConnectionTestCase extends RSECoreTestCase { // Pre-create the local system connection properties Properties properties = new Properties(); - properties.setProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE, "Local"); //$NON-NLS-1$ + properties.setProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID, IRSESystemType.SYSTEMTYPE_LOCAL_ID); properties.setProperty(IRSEConnectionProperties.ATTR_ADDRESS, "localhost"); //$NON-NLS-1$ properties.setProperty(IRSEConnectionProperties.ATTR_NAME, "Local"); //$NON-NLS-1$ localSystemConnectionProperties = getConnectionManager().loadConnectionProperties(properties, false); diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestCase.java index dca1fdbdd6b..a015521a285 100644 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestCase.java +++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/connection/RSEConnectionTestCase.java @@ -1,5 +1,5 @@ -/* ******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. All rights reserved. +/******************************************************************************** + * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -7,11 +7,13 @@ * Contributors: * Don Yantzi (IBM) - initial contribution. * David Dykstal (IBM) - initial contribution. - * *******************************************************************************/ + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType + ********************************************************************************/ package org.eclipse.rse.tests.core.connection; import java.util.Properties; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.tests.RSETestsPlugin; @@ -37,7 +39,7 @@ public class RSEConnectionTestCase extends RSEBaseConnectionTestCase { properties.setProperty(IRSEConnectionProperties.ATTR_PROFILE_NAME, "TestProfile"); //$NON-NLS-1$ properties.setProperty(IRSEConnectionProperties.ATTR_NAME, "TestHost1"); //$NON-NLS-1$ properties.setProperty(IRSEConnectionProperties.ATTR_ADDRESS, "localhost"); //$NON-NLS-1$ - properties.setProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE, "Unix"); //$NON-NLS-1$ + properties.setProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID, IRSESystemType.SYSTEMTYPE_UNIX_ID); properties.setProperty(IRSEConnectionProperties.ATTR_USERID, "userid"); //$NON-NLS-1$ properties.setProperty(IRSEConnectionProperties.ATTR_PASSWORD, "password"); //$NON-NLS-1$ diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/registries/SubSystemConfigurationProxyTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/registries/SubSystemConfigurationProxyTestCase.java index bf7eb98537b..71f3c165d66 100644 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/registries/SubSystemConfigurationProxyTestCase.java +++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/core/registries/SubSystemConfigurationProxyTestCase.java @@ -7,6 +7,7 @@ * * Contributors: * Uwe Stieber (Wind River) - initial API and implementation + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType *******************************************************************************/ package org.eclipse.rse.tests.core.registries; @@ -58,9 +59,9 @@ public class SubSystemConfigurationProxyTestCase extends RSECoreTestCase { IRSESystemType systemType = systemTypes[j]; assertNotNull("Invalid null value in list of registered system types!", systemType); //$NON-NLS-1$ if ("Local".equalsIgnoreCase(systemType.getName()) || "Windows".equalsIgnoreCase(systemType.getName())) { //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("Proxy is expected to be applicable, but returned not to be!", proxy.appliesToSystemType(systemType.getName())); //$NON-NLS-1$ + assertTrue("Proxy is expected to be applicable, but returned not to be!", proxy.appliesToSystemType(systemType)); //$NON-NLS-1$ } else { - assertFalse("Proxy is expected not to be applicable, but returned to be!", proxy.appliesToSystemType(systemType.getName())); //$NON-NLS-1$ + assertFalse("Proxy is expected not to be applicable, but returned to be!", proxy.appliesToSystemType(systemType)); //$NON-NLS-1$ } } } @@ -82,9 +83,9 @@ public class SubSystemConfigurationProxyTestCase extends RSECoreTestCase { IRSESystemType systemType = systemTypes[j]; assertNotNull("Invalid null value in list of registered system types!", systemType); //$NON-NLS-1$ if (systemType.getId().startsWith("org.eclipse.rse.tests.")) { //$NON-NLS-1$ - assertTrue("Proxy is expected to be applicable, but returned not to be!", proxy.appliesToSystemType(systemType.getName())); //$NON-NLS-1$ + assertTrue("Proxy is expected to be applicable, but returned not to be!", proxy.appliesToSystemType(systemType)); //$NON-NLS-1$ } else { - assertFalse("Proxy is expected not to be applicable, but returned to be!", proxy.appliesToSystemType(systemType.getName())); //$NON-NLS-1$ + assertFalse("Proxy is expected not to be applicable, but returned to be!", proxy.appliesToSystemType(systemType)); //$NON-NLS-1$ } } } @@ -106,9 +107,9 @@ public class SubSystemConfigurationProxyTestCase extends RSECoreTestCase { IRSESystemType systemType = systemTypes[j]; assertNotNull("Invalid null value in list of registered system types!", systemType); //$NON-NLS-1$ if ("Unix".equalsIgnoreCase(systemType.getName()) || "Linux".equalsIgnoreCase(systemType.getName())) { //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("Proxy is expected to be applicable, but returned not to be!", proxy.appliesToSystemType(systemType.getName())); //$NON-NLS-1$ + assertTrue("Proxy is expected to be applicable, but returned not to be!", proxy.appliesToSystemType(systemType)); //$NON-NLS-1$ } else { - assertFalse("Proxy is expected not to be applicable, but returned to be!", proxy.appliesToSystemType(systemType.getName())); //$NON-NLS-1$ + assertFalse("Proxy is expected not to be applicable, but returned to be!", proxy.appliesToSystemType(systemType)); //$NON-NLS-1$ } } } diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEConnectionManager.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEConnectionManager.java index 4dc6dbf1b99..4ed50570619 100644 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEConnectionManager.java +++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEConnectionManager.java @@ -10,6 +10,7 @@ * David Dykstal (IBM) - initial contribution. * Uwe Stieber (Wind River) - refactoring and cleanup. * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType *******************************************************************************/ package org.eclipse.rse.tests.internal; @@ -26,6 +27,7 @@ import junit.framework.Assert; import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.IRSEUserIdConstants; import org.eclipse.rse.core.PasswordPersistenceManager; import org.eclipse.rse.core.RSECorePlugin; @@ -219,9 +221,10 @@ public class RSEConnectionManager implements IRSEConnectionManager { Assert.assertNotSame("FAILED(findOrCreateConnection): Invalid user password name!", "unknown", password); //$NON-NLS-1$ //$NON-NLS-2$ String address = properties.getProperty(IRSEConnectionProperties.ATTR_ADDRESS); Assert.assertNotSame("FAILED(findOrCreateConnection): Invalid remote system ip address or dns name!", "unknown", address); //$NON-NLS-1$ //$NON-NLS-2$ - String systemType = properties.getProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE); - Assert.assertNotSame("FAILED(findOrCreateConnection): Invalid system type!", "unknown", address); //$NON-NLS-1$ //$NON-NLS-2$ - + String systemTypeId = properties.getProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID); + Assert.assertNotSame("FAILED(findOrCreateConnection): Invalid system type!", "unknown", systemTypeId); //$NON-NLS-1$ //$NON-NLS-2$ + IRSESystemType systemType = RSECorePlugin.getDefault().getRegistry().getSystemTypeById(systemTypeId); + exception = null; cause = null; diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEInternalFrameworkTestCase.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEInternalFrameworkTestCase.java index 9ddaae28563..3a6720b1afa 100644 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEInternalFrameworkTestCase.java +++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/internal/RSEInternalFrameworkTestCase.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 Wind River Systems, Inc. and others. + * Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,7 @@ * * Contributors: * Uwe Stieber (Wind River) - initial API and implementation + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType *******************************************************************************/ package org.eclipse.rse.tests.internal; @@ -21,6 +22,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.tests.RSETestsPlugin; import org.eclipse.rse.tests.core.IRSECoreTestCaseProperties; import org.eclipse.rse.tests.core.RSEWaitAndDispatchUtil; @@ -180,21 +182,21 @@ public class RSEInternalFrameworkTestCase extends RSEBaseConnectionTestCase { assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$ assertEquals("Property name does not match!", "test_windows", properties.getProperty(IRSEConnectionProperties.ATTR_NAME)); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("Property profile name does not match!", "junit_test_profile", properties.getProperty(IRSEConnectionProperties.ATTR_PROFILE_NAME)); //$NON-NLS-1$ //$NON-NLS-2$ - assertEquals("Property system type does not match!", "Windows", properties.getProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE)); //$NON-NLS-1$ //$NON-NLS-2$ + assertEquals("Property system type does not match!", IRSESystemType.SYSTEMTYPE_WINDOWS_ID, properties.getProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID)); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("Property remote system address does not match!", "128.0.0.1", properties.getProperty(IRSEConnectionProperties.ATTR_ADDRESS)); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("Property user id does not match!", "test_user", properties.getProperty(IRSEConnectionProperties.ATTR_USERID)); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("Property password does not match!", "test_passwd", properties.getProperty(IRSEConnectionProperties.ATTR_PASSWORD)); //$NON-NLS-1$ //$NON-NLS-2$ // test the loading with partial connection information (with defauls) Properties props = new Properties(); - props.setProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE, "SSH Only"); //$NON-NLS-1$ + props.setProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID, "org.eclipse.rse.systemtype.ssh"); //$NON-NLS-1$ props.setProperty(IRSEConnectionProperties.ATTR_USERID, "local_user"); //$NON-NLS-1$ props.setProperty(IRSEConnectionProperties.ATTR_PASSWORD, "local_passwd"); //$NON-NLS-1$ properties = getConnectionManager().loadConnectionProperties(props, true); assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$ assertEquals("Property name does not match!", "Local", properties.getProperty(IRSEConnectionProperties.ATTR_NAME)); //$NON-NLS-1$ //$NON-NLS-2$ assertNull("Property profile name does not match!", properties.getProperty(IRSEConnectionProperties.ATTR_PROFILE_NAME)); //$NON-NLS-1$ - assertEquals("Property system type does not match!", "SSH Only", properties.getProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE)); //$NON-NLS-1$ //$NON-NLS-2$ + assertEquals("Property system type does not match!", "org.eclipse.rse.systemtype.ssh", properties.getProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID)); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("Property remote system address does not match!", "localhost", properties.getProperty(IRSEConnectionProperties.ATTR_ADDRESS)); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("Property user id does not match!", "local_user", properties.getProperty(IRSEConnectionProperties.ATTR_USERID)); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("Property password does not match!", "local_passwd", properties.getProperty(IRSEConnectionProperties.ATTR_PASSWORD)); //$NON-NLS-1$ //$NON-NLS-2$ @@ -204,7 +206,7 @@ public class RSEInternalFrameworkTestCase extends RSEBaseConnectionTestCase { assertNotNull("Failed to load test connection properties from location " + location.toOSString(), properties); //$NON-NLS-1$ assertNull("Property name does not match!", properties.getProperty(IRSEConnectionProperties.ATTR_NAME)); //$NON-NLS-1$ assertNull("Property profile name does not match!", properties.getProperty(IRSEConnectionProperties.ATTR_PROFILE_NAME)); //$NON-NLS-1$ - assertEquals("Property system type does not match!", "SSH Only", properties.getProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE)); //$NON-NLS-1$ //$NON-NLS-2$ + assertEquals("Property system type does not match!", "org.eclipse.rse.systemtype.ssh", properties.getProperty(IRSEConnectionProperties.ATTR_SYSTEM_TYPE_ID)); //$NON-NLS-1$ //$NON-NLS-2$ assertNull("Property remote system address does not match!", properties.getProperty(IRSEConnectionProperties.ATTR_ADDRESS)); //$NON-NLS-1$ assertEquals("Property user id does not match!", "local_user", properties.getProperty(IRSEConnectionProperties.ATTR_USERID)); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("Property password does not match!", "local_passwd", properties.getProperty(IRSEConnectionProperties.ATTR_PASSWORD)); //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/PersistenceTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/PersistenceTest.java index 99e84e12ce0..90b450743d5 100644 --- a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/PersistenceTest.java +++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/persistence/PersistenceTest.java @@ -1,11 +1,12 @@ /******************************************************************************** - * Copyright (c) 2007 IBM Corporation. All rights reserved. + * Copyright (c) 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html * * Contributors: * David Dykstal (IBM) - initial API and implementation. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ********************************************************************************/ package org.eclipse.rse.tests.persistence; @@ -16,6 +17,7 @@ import java.util.List; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.core.runtime.jobs.IJobManager; import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.IPropertySet; @@ -172,7 +174,8 @@ public class PersistenceTest extends RSECoreTestCase { assertNotNull(profile); try { - registry.createHost("bogus", "Linux", "myhost", "myhost.mynet.mycompany.net", null); + IRSESystemType linuxType = RSECorePlugin.getDefault().getRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_LINUX_ID); + registry.createHost("bogus", linuxType, "myhost", "myhost.mynet.mycompany.net", null); } catch (Exception e) { throw new RuntimeException(e); } 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 a3aa2c261b6..3cced8e1ea0 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, 2007 IBM Corporation. All rights reserved. +/******************************************************************************* + * Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -10,7 +10,8 @@ * Kushal Munir (IBM) - initial API and implementation. * David Dykstal (IBM) - moved SystemPreferencesManager to a new package * - created and used RSEPreferencesManager - * ******************************************************************************/ + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType + *******************************************************************************/ package org.eclipse.rse.tests.preferences; @@ -73,7 +74,8 @@ public class PreferencesTest extends RSECoreTestCase { 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$ + IRSESystemType localType = RSECorePlugin.getDefault().getRegistry().getSystemTypeById(IRSESystemType.SYSTEMTYPE_LOCAL_ID); + RSEPreferencesManager.setDefaultUserId(localType, "bogus2"); //$NON-NLS-1$ //$NON-NLS-2$ assertEquals("bogus2", RSEPreferencesManager.getDefaultUserId(systemType)); //$NON-NLS-1$ RSEPreferencesManager.setDefaultUserId(systemType, oldValue); assertEquals(oldValue, RSEPreferencesManager.getDefaultUserId(systemType)); diff --git a/rse/tests/org.eclipse.rse.tests/test.data/connectionDefault.properties b/rse/tests/org.eclipse.rse.tests/test.data/connectionDefault.properties index e515b554d77..9b273a7107b 100644 --- a/rse/tests/org.eclipse.rse.tests/test.data/connectionDefault.properties +++ b/rse/tests/org.eclipse.rse.tests/test.data/connectionDefault.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2006 IBM Corporation and others. All rights reserved. +# Copyright (c) 2006, 2007 IBM Corporation and others. All rights reserved. # 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 @@ -8,6 +8,7 @@ # Contributors: # IBM Corporation - initial API and implementation # Uwe Stieber (Wind River) - refactoring and cleanup. +# Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ############################################################################### # The default RSE host node label/name @@ -20,7 +21,8 @@ name = Local # The default test connection system type if not explicitly # specified different (possible values: Unix, Linux, Local, Windows, SSH Only, FTP Only) -system_type = Local +#system_type = Local +system_type_id = org.eclipse.rse.systemtype.local # The default remote system ip address or dns name. address = localhost diff --git a/rse/tests/org.eclipse.rse.tests/test.data/testConnectionManager/connection.properties b/rse/tests/org.eclipse.rse.tests/test.data/testConnectionManager/connection.properties index cd608efacc5..b43a5f92dce 100644 --- a/rse/tests/org.eclipse.rse.tests/test.data/testConnectionManager/connection.properties +++ b/rse/tests/org.eclipse.rse.tests/test.data/testConnectionManager/connection.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2006 Wind River Systems, Inc. and others. +# Copyright (c) 2006, 2007 Wind River Systems, Inc. and others. # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at @@ -7,13 +7,15 @@ # # Contributors: # Uwe Stieber (Wind River) - initial contribution. +# Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ############################################################################### # Do not change the properties within this file without changing # the consuming unittest too! name = test_windows profile_name = junit_test_profile -system_type = Windows +#system_type = Windows +system_type_id = org.eclipse.rse.systemtype.windows address = 128.0.0.1 userid = test_user password = test_passwd diff --git a/rse/tests/org.eclipse.rse.tests/test.data/testFTPReadAccessToRemoteHost/connection.properties b/rse/tests/org.eclipse.rse.tests/test.data/testFTPReadAccessToRemoteHost/connection.properties index 870ccf722a0..04c088fc560 100644 --- a/rse/tests/org.eclipse.rse.tests/test.data/testFTPReadAccessToRemoteHost/connection.properties +++ b/rse/tests/org.eclipse.rse.tests/test.data/testFTPReadAccessToRemoteHost/connection.properties @@ -7,13 +7,15 @@ # # Contributors: # Uwe Stieber (Wind River) - initial contribution. +# Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType ############################################################################### # Do not change the properties within this file without changing # the consuming unittest too! name = test_remote_ftp_only profile_name = junit_test_profile -system_type = FTP Only +#system_type = FTP Only +system_type_id = org.eclipse.rse.systemtype.ftp address = gd.tuwien.ac.at userid = anonymous password = rseunittest@eclipse.org