diff --git a/rse/plugins/org.eclipse.rse.connectorservice.dstore/src/org/eclipse/rse/connectorservice/dstore/DStoreConnectorService.java b/rse/plugins/org.eclipse.rse.connectorservice.dstore/src/org/eclipse/rse/connectorservice/dstore/DStoreConnectorService.java index 605d0c4cc72..d86fe895ad8 100644 --- a/rse/plugins/org.eclipse.rse.connectorservice.dstore/src/org/eclipse/rse/connectorservice/dstore/DStoreConnectorService.java +++ b/rse/plugins/org.eclipse.rse.connectorservice.dstore/src/org/eclipse/rse/connectorservice/dstore/DStoreConnectorService.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) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.connectorservice.dstore; @@ -44,7 +45,6 @@ import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.rse.connectorservice.dstore.util.ConnectionStatusListener; import org.eclipse.rse.connectorservice.dstore.util.StatusMonitor; import org.eclipse.rse.connectorservice.dstore.util.StatusMonitorFactory; -import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.SystemBasePlugin; import org.eclipse.rse.core.comm.ISystemKeystoreProvider; @@ -1291,49 +1291,6 @@ public class DStoreConnectorService extends StandardConnectorService implements } } -// /** -// * @see org.eclipse.rse.core.subsystems.AbstractConnectorService#getPasswordInformation() -// */ -// public SystemSignonInformation getPasswordInformation() -// { -// // For Windows we want to avoid the signon prompt (because we never -// // really authenticate with the remote system and this would be deceiving -// // for the end user -// -// if (getPrimarySubSystem().getHost().getSystemType().getName().equals(IRSESystemType.SYSTEMTYPE_WINDOWS)) -// { -// String userid = getPrimarySubSystem().getUserId(); -// if (userid == null) -// { -// userid = "remoteuser"; //$NON-NLS-1$ -// } -// SystemSignonInformation info = new SystemSignonInformation(getPrimarySubSystem().getHost().getHostName(), -// userid, "", IRSESystemType.SYSTEMTYPE_WINDOWS); //$NON-NLS-1$ -// return info; -// } -// else -// { -// return super.getPasswordInformation(); -// } -// } - -// /** -// * @see AbstractConnectorService#hasPassword(boolean) -// */ -// public boolean isPasswordCached() -// { -// // For Windows we never prompt for userid / password so we don't need -// // to clear the password cache -// if (getPrimarySubSystem().getHost().getSystemType().getName().equals(IRSESystemType.SYSTEMTYPE_WINDOWS)) -// { -// return false; -// } -// else -// { -// return super.isPasswordCached(); -// } -// } - public boolean supportsRemoteServerLaunching() { return true; @@ -1350,8 +1307,7 @@ public class DStoreConnectorService extends StandardConnectorService implements public boolean supportsPassword() { boolean result = super.supportsPassword(); IHost host = getHost(); - String systemType = host.getSystemType().getName(); - if (systemType.equals(IRSESystemType.SYSTEMTYPE_WINDOWS)) { + if (host.getSystemType().isWindows()) { result = false; } return result; @@ -1362,9 +1318,7 @@ public class DStoreConnectorService extends StandardConnectorService implements */ public boolean supportsUserId() { boolean result = super.supportsUserId(); - IHost host = getHost(); - String systemType = host.getSystemType().getName(); - if (systemType.equals(IRSESystemType.SYSTEMTYPE_WINDOWS)) { + if (getHost().getSystemType().isWindows()) { result = false; } return result; diff --git a/rse/plugins/org.eclipse.rse.connectorservice.dstore/src/org/eclipse/rse/internal/connectorservice/dstore/RexecDstoreServer.java b/rse/plugins/org.eclipse.rse.connectorservice.dstore/src/org/eclipse/rse/internal/connectorservice/dstore/RexecDstoreServer.java index 105aa904d15..3f44e9136bc 100644 --- a/rse/plugins/org.eclipse.rse.connectorservice.dstore/src/org/eclipse/rse/internal/connectorservice/dstore/RexecDstoreServer.java +++ b/rse/plugins/org.eclipse.rse.connectorservice.dstore/src/org/eclipse/rse/internal/connectorservice/dstore/RexecDstoreServer.java @@ -12,6 +12,7 @@ * * Contributors: * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.internal.connectorservice.dstore; @@ -360,7 +361,7 @@ public class RexecDstoreServer implements IServerLauncher this.propertyInfo = propertyInfo; // set path... this.cwd = ((IRemoteServerLauncher)propertyInfo).getServerPath(); - char separatorChar = signonInfo.getSystemType().equals("Windows") ? '\\' : '/'; //$NON-NLS-1$ + char separatorChar = signonInfo.getSystemType().isWindows() ? '\\' : '/'; //$NON-NLS-1$ if (cwd.length() > 0 && cwd.charAt(cwd.length() - 1) != separatorChar) cwd += separatorChar; // set script... diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSESystemType.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSESystemType.java index 1788e6bd050..e6ce8b7a5ad 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSESystemType.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/IRSESystemType.java @@ -13,6 +13,7 @@ * Contributors: * Uwe Stieber (Wind River) - Extended system type -> subsystemConfiguration association. * Martin Oberhuber (Wind River) - [185098] Provide constants for all well-known system types + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.core; @@ -24,7 +25,8 @@ import org.osgi.framework.Bundle; * Interface for a system type. Constants are defined for various system types. * These constants are kept in sync with definitions in plugin.xml. * - * This interface is not intended to be implemented by clients. + * This interface is not intended to be implemented directly by clients. + * Clients should extend the abstract base class {@link RSESystemType} instead. */ public interface IRSESystemType extends IAdaptable { @@ -35,7 +37,7 @@ public interface IRSESystemType extends IAdaptable { public static final String SYSTEMTYPE_LINUX = "Linux"; //$NON-NLS-1$ /** - * Linus system type, "org.eclipse.rse.systemtype.linux". + * Linux system type, "org.eclipse.rse.systemtype.linux". */ public static final String SYSTEMTYPE_LINUX_ID = "org.eclipse.rse.systemtype.linux"; //$NON-NLS-1$ @@ -133,9 +135,7 @@ public interface IRSESystemType extends IAdaptable { */ public static final String SYSTEMTYPE_WINDOWS = "Windows"; //$NON-NLS-1$ - /** - * Windows system type, "org.eclipse.rse.systemtype.windows". - */ + /** Windows system type, "org.eclipse.rse.systemtype.windows". */ public static final String SYSTEMTYPE_WINDOWS_ID = "org.eclipse.rse.systemtype.windows"; //$NON-NLS-1$ /** Discovery system type, "org.eclipse.rse.systemtype.discovery". */ @@ -147,6 +147,28 @@ public interface IRSESystemType extends IAdaptable { /** Telnet Only system type, "org.eclipse.rse.systemtype.telnet". */ public static final String SYSTEMTYPE_TELNET_ONLY_ID = "org.eclipse.rse.systemtype.telnet"; //$NON-NLS-1$ + /** + * System type Property Key (value: "isWindows") indicating whether + * a system type is declared in plugin.xml to refers to a Windows + * system. + * On a Windows system, the following properties are expected: + * + * @see #getProperty(String, boolean) + */ + public static final String PROPERTY_IS_WINDOWS = "isWindows"; //$NON-NLS-1$ + + /** + * System type Property Key (value: "isCaseSensitive") indicating + * whether a given system type is in general case sensitive. + * @see #getProperty(String, boolean) + */ + public static final String PROPERTY_IS_CASE_SENSITIVE = "isCaseSensitive"; //$NON-NLS-1$ + /** * Returns the id of the system type. * @return the id of the system type @@ -182,6 +204,36 @@ public interface IRSESystemType extends IAdaptable { * @return the value associated with the given key or null if none */ public String getProperty(String key); + + /** + * Returns the boolean property of this system type with the given key. + * The default value is returned if there is no such key. + * + * @param key the name of the property to return + * @param defaultValue the default value to expect if the property is not set + * @return the boolean value associated with the given key or the specified default value + */ + public boolean getProperty(String key, boolean defaultValue); + + /** + * Tests whether the system type refers to the local system. + * This is a shortcut for getId().equals(SYSTEMTYPE_LOCAL_ID) + * Extenders (contributors of custom system types) may override. + * @return true if the system type refers to the local system. + */ + public boolean isLocal(); + + /** + * Tests whether the system type refers to the Windows system. + * This is a shortcut for + *
 
+	 *   getId().equals(SYSTEMTYPE_WINDOWS_ID) || 
+	 *   isLocal() && System.getProperty("os.name").toLowerCase().startsWith("win")
+	 * 
+ * Extenders (contributors of custom system types) may override. + * @return true if the system type refers to a Windows system. + */ + public boolean isWindows(); /** * Returns the bundle which is responsible for the definition of this system type. 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 2f0da158958..e8cb5ce4a67 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 @@ -15,6 +15,7 @@ * - updated to use new RSEPreferencesManager * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.core; @@ -32,7 +33,6 @@ 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; /** @@ -78,28 +78,15 @@ public class PasswordPersistenceManager { /** * Default System Type */ - private static class DefaultSystemType implements IRSESystemType + private static class DefaultSystemType extends RSESystemType implements IRSESystemType { + private static final String DEFAULT_ID = "DEFAULT"; //$NON-NLS-1$ private DefaultSystemType() { - } - public Bundle getDefiningBundle() { - return null; - } - public String getDescription() { - return getLabel(); + super(DEFAULT_ID, DEFAULT_ID, RSECoreMessages.DefaultSystemType_Label, null, null); } 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; + return DEFAULT_ID; } public String[] getSubsystemConfigurationIds() { return null; diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSESystemType.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSESystemType.java new file mode 100644 index 00000000000..b66117b3cc4 --- /dev/null +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/core/RSESystemType.java @@ -0,0 +1,178 @@ +/******************************************************************************** + * 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: + * Uwe Stieber (Wind River) - Dynamic system type provider extension. + * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() + ********************************************************************************/ +package org.eclipse.rse.core; + +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.runtime.PlatformObject; +import org.osgi.framework.Bundle; + +/** + * Abstract base class holding core functionality of a system type. + * + * Extenders must override {@link IRSESystemType#getSubsystemConfigurationIds()} + * according to their strategy of finding subsystem configuration id's that + * match their system type. + * + * Extenders may override any other method. + */ +public abstract class RSESystemType extends PlatformObject implements IRSESystemType { + + protected String id = null; + protected String name = null; + protected String label = null; + protected String description = null; + protected Bundle definingBundle = null; + protected Map properties; + + /** + * Default constructor. + * Only subclasses may call this if set the id, name, label, + * description and properties attributes themselves. + */ + protected RSESystemType() + { + super(); + } + + /** + * Constructor for an object representing a system type. + * @param id unique id of this system type. Must be system unique. + * @param name a name of this system type to be used for internal checks. + * @param label a user-visible label of this system type. + * May be null and falls back to the name in this case. + * @param description a user-visible description of this system type. + * May be null and falls back to the label in this case. + */ + public RSESystemType(String id, String name, String label, String description, Bundle definingBundle) + { + super(); + this.id = id; + this.name = name; + this.label = label == null ? name : label; + this.description = description == null ? "" : description; //$NON-NLS-1$ + this.definingBundle = definingBundle; + this.properties = new HashMap(); + } + + /** + * 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(); + } + + /* (non-Javadoc) + * @see org.eclipse.rse.core.IRSESystemType#getId() + */ + public String getId() { + return id; + } + + /* (non-Javadoc) + * @see org.eclipse.rse.core.IRSESystemType#getLabel() + */ + public String getLabel() { + // For default RSE system types, the UI label is equal to the + // 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#getNameOfSystemTypeDeprecated() + */ + public String getName() { + return name; + } + + /* (non-Javadoc) + * @see org.eclipse.rse.core.IRSESystemType#getDescription() + */ + public String getDescription() { + return description; + } + + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.IRSESystemType#getDefiningBundle() + */ + public Bundle getDefiningBundle() { + return definingBundle; + } + + /* (non-Javadoc) + * @see org.eclipse.rse.core.IRSESystemType#getProperty(java.lang.String) + */ + public String getProperty(String key) { + return (String) (properties.get(key)); + } + + /* (non-Javadoc) + * @see org.eclipse.rse.core.IRSESystemType#getProperty(java.lang.String, boolean) + */ + public boolean getProperty(String key, boolean defaultValue) { + Object val = properties.get(key); + if (val instanceof String) { + return Boolean.valueOf((String)val).booleanValue(); + } + return defaultValue; + } + + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.IRSESystemType#isLocal() + */ + public boolean isLocal() { + return IRSESystemType.SYSTEMTYPE_LOCAL_ID.equals(getId()); + } + + /* + * (non-Javadoc) + * @see org.eclipse.rse.core.IRSESystemType#isLocal() + */ + public boolean isWindows() { + return IRSESystemType.SYSTEMTYPE_WINDOWS_ID.equals(getId()) + || (isLocal() && System.getProperty("os.name").toLowerCase().startsWith("win")) //$NON-NLS-1$ //$NON-NLS-2$ + || getProperty(IRSESystemType.PROPERTY_IS_WINDOWS, false); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + public String toString() { + return getLabel() + " (" + getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ + } +} \ No newline at end of file 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 3b36bd7fa18..1950558fbd5 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 @@ -19,6 +19,7 @@ * David Dykstal (IBM) - 142806: refactoring persistence framework * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.core.model; @@ -215,7 +216,7 @@ public class Host extends RSEModelObject implements IHost { 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$ + || (systemType.isLocal() && !systemType.isWindows()); setForceUserIdToUpperCase(forceUC); setUserIdCaseSensitive(caseSensitiveUID); } 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 b39aa554ba3..4f35b0cc935 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 @@ -14,6 +14,7 @@ * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.core.model; @@ -56,12 +57,16 @@ public class SystemStartHere * SAME AS: getSystemRegistry().getConnectionsBySystemType(systemType) * @param systemType One of the system types defined via system type extension point: * * @see org.eclipse.rse.core.IRSESystemType * @see org.eclipse.rse.core.model.ISystemRegistry#getHostsBySystemType(String) diff --git a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSECoreRegistry.java b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSECoreRegistry.java index abea334a665..a7b23c6b7be 100644 --- a/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSECoreRegistry.java +++ b/rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSECoreRegistry.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 @@ -12,6 +12,7 @@ * * Contributors: * Uwe Stieber (Wind River) - Added system types provider extension. + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.internal.core; @@ -146,7 +147,7 @@ public class RSECoreRegistry implements IRSECoreRegistry { IConfigurationElement element = elements[i]; if (element.getName().equals(ELEMENT_SYTEM_TYPE)) { - IRSESystemType type = new RSESystemType(element); + IRSESystemType type = new RSEStaticSystemType(element); if (!typeIds.contains(type.getId())) { types.add(type); typeIds.add(type.getId()); 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/RSEStaticSystemType.java similarity index 66% rename from rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSESystemType.java rename to rse/plugins/org.eclipse.rse.core/src/org/eclipse/rse/internal/core/RSEStaticSystemType.java index 876d6409d70..77466e1d88c 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/RSEStaticSystemType.java @@ -13,26 +13,24 @@ * Contributors: * Uwe Stieber (Wind River) - Dynamic system type provider extension. * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.internal.core; import java.util.HashMap; import java.util.LinkedList; import java.util.List; -import java.util.Map; import org.eclipse.core.runtime.IConfigurationElement; 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; +import org.eclipse.rse.core.RSESystemType; /** - * Class representing a system type. + * Class representing a system type statically contributed through plugin.xml. */ -public class RSESystemType extends PlatformObject implements IRSESystemType { +public class RSEStaticSystemType extends RSESystemType { private static final String ATTR_ID = "id"; //$NON-NLS-1$ private static final String ATTR_NAME = "name"; //$NON-NLS-1$ @@ -44,20 +42,14 @@ public class RSESystemType extends PlatformObject implements IRSESystemType { private static final String ATTR_VALUE = "value"; //$NON-NLS-1$ private static final String ATTR_SUBSYSTEMCONFIGURATIONS = "subsystemConfigurationIds"; //$NON-NLS-1$ - private String id = null; - private String name = null; - private String label = null; - private String description = null; - private Map properties; - private Bundle definingBundle = null; private String[] subsystemConfigurationIds; - + /** * Constructor for an object representing a system type. * @param element the configuration element describing the system type */ - public RSESystemType(IConfigurationElement element) { - + public RSEStaticSystemType(IConfigurationElement element) { + super(); id = element.getAttribute(ATTR_ID); name = element.getAttribute(ATTR_NAME); if (id==null) { @@ -94,27 +86,6 @@ 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 @@ -132,53 +103,6 @@ public class RSESystemType extends PlatformObject implements IRSESystemType { } } - /* (non-Javadoc) - * @see org.eclipse.rse.core.IRSESystemType#getId() - */ - public String getId() { - return id; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.IRSESystemType#getLabel() - */ - public String getLabel() { - // For default RSE system types, the UI label is equal to the - // 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#getNameOfSystemTypeDeprecated() - */ - public String getName() { - return name; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.IRSESystemType#getDescription() - */ - public String getDescription() { - return description; - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.IRSESystemType#getProperty(java.lang.String) - */ - public String getProperty(String key) { - return (String) (properties.get(key)); - } - - /* (non-Javadoc) - * @see org.eclipse.rse.core.IRSESystemType#getDefiningBundle() - */ - public Bundle getDefiningBundle() { - return definingBundle; - } - /* (non-Javadoc) * @see org.eclipse.rse.core.IRSESystemType#getSubsystemConfigurationIds() */ @@ -186,10 +110,4 @@ public class RSESystemType extends PlatformObject implements IRSESystemType { return subsystemConfigurationIds; } - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - public String toString() { - return getLabel() + " (" + getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - } -} \ No newline at end of file +} diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemEditableRemoteFile.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemEditableRemoteFile.java index 612bea53e96..df7cef77f15 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemEditableRemoteFile.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemEditableRemoteFile.java @@ -14,6 +14,7 @@ * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods * Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.files.ui.resources; @@ -40,8 +41,8 @@ import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.dialogs.ProgressMonitorDialog; +import org.eclipse.rse.core.IRSESystemType; 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.ISubSystem; import org.eclipse.rse.internal.files.ui.actions.SystemDownloadConflictAction; @@ -80,11 +81,8 @@ import org.eclipse.ui.part.FileEditorInput; import org.eclipse.ui.texteditor.IDocumentProvider; import org.eclipse.ui.texteditor.ITextEditor; - public class SystemEditableRemoteFile implements ISystemEditableRemoteObject, IPartListener, IResourceChangeListener, IResourceDeltaVisitor { - - private IRemoteFile remoteFile; private String remotePath; private IRemoteFileSubSystem subsystem; @@ -294,10 +292,10 @@ public class SystemEditableRemoteFile implements ISystemEditableRemoteObject, IP if (remotePath == null) { // derive the path from the temporary file path - IHost connection = fs.getHost(); + IRSESystemType systemType = fs.getHost().getSystemType(); // on windows systems, we need to take into account drives and different separators - boolean isWindows = connection.getSystemType().getName().equals("Local") || fs.getHost().getSystemType().getName().equals("Windows"); //$NON-NLS-1$ //$NON-NLS-2$ + boolean isWindows = systemType.isWindows(); char fileSeparator = isWindows ? '\\' : '/'; StringBuffer tempRemotePath = new StringBuffer(""); //$NON-NLS-1$ @@ -908,7 +906,7 @@ public class SystemEditableRemoteFile implements ISystemEditableRemoteObject, IP */ public String getWorkspaceRemotePath(String remotePath) { - if (subsystem != null && subsystem.getHost().getSystemType().getName().equals("Local")) //$NON-NLS-1$ + if (subsystem != null && subsystem.getHost().getSystemType().isLocal()) { return SystemRemoteEditManager.getInstance().getWorkspacePathFor(subsystem.getHost().getHostName(), remotePath); } @@ -918,7 +916,7 @@ public class SystemEditableRemoteFile implements ISystemEditableRemoteObject, IP public String getActualHostFor(String remotePath) { String hostname = subsystem.getHost().getHostName(); - if (subsystem != null && subsystem.getHost().getSystemType().getName().equals("Local")) //$NON-NLS-1$ + if (subsystem != null && subsystem.getHost().getSystemType().isLocal()) { String result = SystemRemoteEditManager.getInstance().getActualHostFor(hostname, remotePath); if (!result.equals(hostname)) @@ -1319,7 +1317,7 @@ public class SystemEditableRemoteFile implements ISystemEditableRemoteObject, IP try { - if (remoteFile.getSystemConnection().getSystemType().getName().equals("Local")) //$NON-NLS-1$ + if (remoteFile.getSystemConnection().getSystemType().isLocal()) { // Open local files "in-place", i.e. don't copy them to the // RemoteSystemsTempFiles project first diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemTempFileListener.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemTempFileListener.java index d0c0efe1ae6..e8094c86100 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemTempFileListener.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemTempFileListener.java @@ -14,6 +14,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) - [177523] Unify singleton getter methods + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.files.ui.resources; @@ -33,6 +34,7 @@ import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.dialogs.ProgressMonitorDialog; import org.eclipse.jface.operation.IRunnableContext; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.RSECorePlugin; import org.eclipse.rse.core.SystemBasePlugin; import org.eclipse.rse.core.events.ISystemResourceChangeEvents; @@ -55,14 +57,12 @@ import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.progress.UIJob; import org.eclipse.ui.progress.WorkbenchJob; - /** * This class manages listening for resource changes within our temp file project * It is used for listening to saves made in the editor so that we can upload * changes to the remote files. */ public abstract class SystemTempFileListener implements IResourceChangeListener { - private ArrayList _changedResources; private ArrayList _ignoredFiles = new ArrayList(); private boolean _isSynching; @@ -525,10 +525,10 @@ public abstract class SystemTempFileListener implements IResourceChangeListener if (uploadPath == null) { // derive the path from the temporary file path - IHost connection = fs.getHost(); + IRSESystemType systemType = fs.getHost().getSystemType(); // on windows systems, we need to take into account drives and different separators - boolean isWindows = connection.getSystemType().getName().equals("Local") || fs.getHost().getSystemType().getName().equals("Windows"); //$NON-NLS-1$ //$NON-NLS-2$ + boolean isWindows = systemType.isWindows(); char fileSeparator = isWindows ? '\\' : '/'; StringBuffer remotePath = new StringBuffer(""); //$NON-NLS-1$ diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemUniversalTempFileListener.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemUniversalTempFileListener.java index b07239d1241..7486522c493 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemUniversalTempFileListener.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/SystemUniversalTempFileListener.java @@ -14,6 +14,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) - [177523] Unify singleton getter methods + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.files.ui.resources; @@ -38,7 +39,6 @@ import org.eclipse.rse.ui.view.ISystemEditableRemoteObject; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; - /** * This class manages listening for resource changes within our temp file project * It is used for listening to saves made in the editor so that we can upload @@ -47,7 +47,6 @@ import org.eclipse.swt.widgets.Shell; */ public class SystemUniversalTempFileListener extends SystemTempFileListener { - private static SystemUniversalTempFileListener _instance = null; private ArrayList _editedFiles = new ArrayList(); @@ -133,7 +132,7 @@ public class SystemUniversalTempFileListener extends SystemTempFileListener else { // for mounting... - if (fs.getHost().getSystemType().getName().equals("Local")) //$NON-NLS-1$ + if (fs.getHost().getSystemType().isLocal()) { boolean isMounted = properties.getRemoteFileMounted(); if (isMounted) diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java index 0e99a1c59be..9b542188e7b 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/files/ui/resources/UniversalFileTransferUtility.java @@ -17,6 +17,7 @@ * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API * Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.files.ui.resources; @@ -81,7 +82,6 @@ import org.eclipse.rse.ui.messages.SystemMessageDialog; import org.eclipse.swt.widgets.Display; import org.eclipse.ui.PlatformUI; - /** * Utility class for doing file transfers on universal systems */ @@ -353,7 +353,7 @@ public class UniversalFileTransferUtility IResource tempFolder = null; if (doCompressedTransfer && doSuperTransferProperty && !srcFileOrFolder.isRoot() - && !(srcFileOrFolder.getParentRemoteFileSubSystem().getHost().getSystemType().getName().equals("Local"))) //$NON-NLS-1$ + && !(srcFileOrFolder.getParentRemoteFileSubSystem().getHost().getSystemType().isLocal())) { try { @@ -820,7 +820,7 @@ public class UniversalFileTransferUtility boolean doSuperTransferProperty = RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemFilePreferencesConstants.DOSUPERTRANSFER); if (doCompressedTransfer && doSuperTransferProperty && !srcFileOrFolder.isRoot() - && !(srcFileOrFolder.getParentRemoteFileSubSystem().getHost().getSystemType().getName().equals("Local"))) //$NON-NLS-1$ + && !(srcFileOrFolder.getParentRemoteFileSubSystem().getHost().getSystemType().isLocal())) { try { @@ -923,7 +923,7 @@ public class UniversalFileTransferUtility { IHost connection = connections[i]; IRemoteFileSubSystem anFS = RemoteFileUtility.getFileSubSystem(connection); - if (anFS.getHost().getSystemType().getName().equals("Local")) //$NON-NLS-1$ + if (anFS.getHost().getSystemType().isLocal()) { return anFS; } @@ -1138,7 +1138,7 @@ public class UniversalFileTransferUtility } - boolean isTargetLocal = newTargetFolder.getParentRemoteFileSubSystem().getHost().getSystemType().getName().equals("Local"); //$NON-NLS-1$ + boolean isTargetLocal = newTargetFolder.getParentRemoteFileSubSystem().getHost().getSystemType().isLocal(); boolean destInArchive = (newTargetFolder instanceof IVirtualRemoteFile) || newTargetFolder.isArchive(); if (doCompressedTransfer && doSuperTransferPreference && !destInArchive && !isTargetLocal) @@ -1353,7 +1353,7 @@ public class UniversalFileTransferUtility directory.refreshLocal(IResource.DEPTH_ONE, monitor); - boolean isTargetLocal = newTargetFolder.getParentRemoteFileSubSystem().getHost().getSystemType().getName().equals("Local"); //$NON-NLS-1$ + boolean isTargetLocal = newTargetFolder.getParentRemoteFileSubSystem().getHost().getSystemType().isLocal(); boolean destInArchive = (newTargetFolder instanceof IVirtualRemoteFile) || newTargetFolder.isArchive(); boolean doSuperTransferPreference = RSEUIPlugin.getDefault().getPreferenceStore().getBoolean(ISystemFilePreferencesConstants.DOSUPERTRANSFER); @@ -1777,7 +1777,7 @@ public class UniversalFileTransferUtility path = path.append(separator + actualHost + separator); String absolutePath = srcFileOrFolder.getAbsolutePath(); - if (srcFileOrFolder.getSystemConnection().getSystemType().getName().equals("Local")) //$NON-NLS-1$ + if (srcFileOrFolder.getSystemConnection().getSystemType().isLocal()) { absolutePath = editMgr.getWorkspacePathFor(actualHost, srcFileOrFolder.getAbsolutePath()); } @@ -1957,7 +1957,7 @@ public class UniversalFileTransferUtility public static String getActualHostFor(ISubSystem subsystem, String remotePath) { String hostname = subsystem.getHost().getHostName(); - if (subsystem.getHost().getSystemType().getName().equals("Local")) //$NON-NLS-1$ + if (subsystem.getHost().getSystemType().isLocal()) { String result = SystemRemoteEditManager.getInstance().getActualHostFor(hostname, remotePath); return result; @@ -1991,7 +1991,7 @@ public class UniversalFileTransferUtility protected static boolean isRemoteFileMounted(ISubSystem subsystem, String remotePath) { String hostname = subsystem.getHost().getHostName(); - if (subsystem.getHost().getSystemType().getName().equals("Local")) //$NON-NLS-1$ + if (subsystem.getHost().getSystemType().isLocal()) { String result = SystemRemoteEditManager.getInstance().getActualHostFor(hostname, remotePath); if (!result.equals(hostname)) @@ -2015,7 +2015,7 @@ public class UniversalFileTransferUtility protected static String getWorkspaceRemotePath(ISubSystem subsystem, String remotePath) { - if (subsystem != null && subsystem.getHost().getSystemType().getName().equals("Local")) { //$NON-NLS-1$ + if (subsystem != null && subsystem.getHost().getSystemType().isLocal()) { return SystemRemoteEditManager.getInstance().getWorkspacePathFor(subsystem.getHost().getHostName(), remotePath); } diff --git a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java index 2b7f7de7900..63ee27d8b2c 100644 --- a/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java +++ b/rse/plugins/org.eclipse.rse.files.ui/src/org/eclipse/rse/internal/files/ui/view/SystemViewRemoteFileAdapter.java @@ -17,6 +17,7 @@ * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API * Martin Oberhuber (Wind River) - [183824] Forward SystemMessageException from IRemoteFileSubsystem + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.internal.files.ui.view; @@ -1535,7 +1536,7 @@ public class SystemViewRemoteFileAdapter { IHost connection = connections[i]; IRemoteFileSubSystem anFS = RemoteFileUtility.getFileSubSystem(connection); - if ( anFS != null && IRSESystemType.SYSTEMTYPE_LOCAL_ID.equals(anFS.getHost().getSystemType().getId())) + if ( anFS != null && anFS.getHost().getSystemType().isLocal()) { return anFS; } diff --git a/rse/plugins/org.eclipse.rse.processes.ui/src/org/eclipse/rse/internal/processes/ui/dialogs/SystemKillDialog.java b/rse/plugins/org.eclipse.rse.processes.ui/src/org/eclipse/rse/internal/processes/ui/dialogs/SystemKillDialog.java index c9a94cb7718..49fe10aaf36 100644 --- a/rse/plugins/org.eclipse.rse.processes.ui/src/org/eclipse/rse/internal/processes/ui/dialogs/SystemKillDialog.java +++ b/rse/plugins/org.eclipse.rse.processes.ui/src/org/eclipse/rse/internal/processes/ui/dialogs/SystemKillDialog.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) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.internal.processes.ui.dialogs; @@ -47,7 +47,6 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableColumn; - /** * Dialog for confirming killing of a process or group of processes. User * selects the type of signal to be sent to the process. @@ -128,7 +127,7 @@ public class SystemKillDialog extends SystemPromptDialog if (promptLabel == null) { Object input = getInputObject(); - if (input != null && input instanceof IStructuredSelection) { + if (input instanceof IStructuredSelection) { int size = ((IStructuredSelection)input).size(); if (size > 1) { diff --git a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/FileClassifier.java b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/FileClassifier.java index 11bf0d90ba8..17c0a259907 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/FileClassifier.java +++ b/rse/plugins/org.eclipse.rse.services.dstore/miners/org/eclipse/rse/internal/dstore/universal/miners/filesystem/FileClassifier.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 @@ -12,6 +12,7 @@ * * Contributors: * Martin Oberhuber (Wind River) - Fix 154874 - handle files with space or $ in the name + * Martin Oberhuber (Wind River) - [186640] Fix case sensitive issue comparing z/OS ********************************************************************************/ package org.eclipse.rse.internal.dstore.universal.miners.filesystem; @@ -137,7 +138,7 @@ public class FileClassifier extends Thread { _systemSupportsClassify = false; } - else if (osName.equals("z/OS")) { //$NON-NLS-1$ + else if (osName.equals("z/os")) { //$NON-NLS-1$ _systemSupportsClassFilesOnly = true; } diff --git a/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/actions/SystemCommandAction.java b/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/actions/SystemCommandAction.java index fe6f4a4f069..baa7feded1b 100644 --- a/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/actions/SystemCommandAction.java +++ b/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/actions/SystemCommandAction.java @@ -14,6 +14,7 @@ * Martin Oberhuber (Wind River) - Fix 154874 - handle files with space or $ in the name * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API * Martin Oberhuber (Wind River) - [174945] Remove obsolete icons from rse.shells.ui + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.internal.shells.ui.actions; @@ -518,8 +519,7 @@ public class SystemCommandAction extends SystemBaseAction } String cdCmd = "cd " + PathUtility.enQuoteUnix(path); //$NON-NLS-1$ - if ((cmdSubSystem.getHost().getSystemType().equals("Local") && System.getProperty("os.name").toLowerCase().startsWith("win")) //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - || cmdSubSystem.getHost().getSystemType().equals("Windows")) //$NON-NLS-1$ + if (cmdSubSystem.getHost().getSystemType().isWindows()) { cdCmd = "cd /d \"" + path + '\"'; //$NON-NLS-1$ } diff --git a/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/view/CommandsViewPage.java b/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/view/CommandsViewPage.java index 5d492d4b0f9..2e77564bf1c 100644 --- a/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/view/CommandsViewPage.java +++ b/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/view/CommandsViewPage.java @@ -16,6 +16,7 @@ * Martin Oberhuber (Wind River) - [180562] dont implement ISystemThemeConstants * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.internal.shells.ui.view; @@ -378,9 +379,7 @@ FocusListener ISubSystem cmdSubSystem = adapter.getSubSystem(element); String cdCmd = "cd " + PathUtility.enQuoteUnix(path); //$NON-NLS-1$ - if (cmdSubSystem.getHost().getSystemType().getName().equals("Local") //$NON-NLS-1$ - && System.getProperty("os.name").toLowerCase().startsWith("win") //$NON-NLS-1$ //$NON-NLS-2$ - || cmdSubSystem.getHost().getSystemType().getName().equals("Windows")) //$NON-NLS-1$ + if (cmdSubSystem.getHost().getSystemType().isWindows()) { cdCmd = "cd /d \"" + path + '\"'; //$NON-NLS-1$ } @@ -397,9 +396,7 @@ FocusListener ISubSystem cmdSubSystem = adapter.getSubSystem(element); String cdCmd = "cd " + PathUtility.enQuoteUnix(path); //$NON-NLS-1$ - if (cmdSubSystem.getHost().getSystemType().getName().equals("Local") //$NON-NLS-1$ - && System.getProperty("os.name").toLowerCase().startsWith("win") //$NON-NLS-1$ //$NON-NLS-2$ - || cmdSubSystem.getHost().getSystemType().getName().equals("Windows")) //$NON-NLS-1$ + if (cmdSubSystem.getHost().getSystemType().isWindows()) { cdCmd = "cd /d \"" + path + '\"'; //$NON-NLS-1$ } diff --git a/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/view/SystemCommandsViewPart.java b/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/view/SystemCommandsViewPart.java index 5ecbcbd4af6..0d3d463d171 100644 --- a/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/view/SystemCommandsViewPart.java +++ b/rse/plugins/org.eclipse.rse.shells.ui/src/org/eclipse/rse/internal/shells/ui/view/SystemCommandsViewPart.java @@ -15,6 +15,7 @@ * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API * Martin Oberhuber (Wind River) - [174945] Remove obsolete icons from rse.shells.ui + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.internal.shells.ui.view; @@ -520,7 +521,7 @@ public class SystemCommandsViewPart for (int i = 0; i < connections.length; i++) { IHost connection = connections[i]; - if (registry.isAnySubSystemConnected(connection) || connection.getSystemType().getName().equals("Local")) //$NON-NLS-1$ + if (registry.isAnySubSystemConnected(connection) || connection.getSystemType().isLocal()) { IRemoteCmdSubSystem[] cmdSubSystems = RemoteCommandHelpers.getCmdSubSystems(connection); if (cmdSubSystems.length == 1) @@ -647,7 +648,7 @@ public class SystemCommandsViewPart for (int i = 0; i < connections.length; i++) { IHost connection = connections[i]; - if (registry.isAnySubSystemConnected(connection) || connection.getSystemType().getName().equals("Local")) //$NON-NLS-1$ + if (registry.isAnySubSystemConnected(connection) || connection.getSystemType().isLocal()) { IRemoteCmdSubSystem[] cmdSubSystems = RemoteCommandHelpers.getCmdSubSystems(connection); if (cmdSubSystems.length > 0) diff --git a/rse/plugins/org.eclipse.rse.subsystems.shells.core/src/org/eclipse/rse/subsystems/shells/core/model/RemoteCommandShell.java b/rse/plugins/org.eclipse.rse.subsystems.shells.core/src/org/eclipse/rse/subsystems/shells/core/model/RemoteCommandShell.java index 16a58d9542e..8db56ddb1c5 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.shells.core/src/org/eclipse/rse/subsystems/shells/core/model/RemoteCommandShell.java +++ b/rse/plugins/org.eclipse.rse.subsystems.shells.core/src/org/eclipse/rse/subsystems/shells/core/model/RemoteCommandShell.java @@ -12,6 +12,7 @@ * * Contributors: * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.subsystems.shells.core.model; @@ -33,11 +34,8 @@ import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCommandShell; import org.eclipse.rse.subsystems.shells.core.subsystems.RemoteCmdSubSystem; import org.eclipse.rse.ui.RSEUIPlugin; - public abstract class RemoteCommandShell implements IAdaptable, IRemoteCommandShell { - - protected String _id; protected String _name; protected String _type; @@ -47,8 +45,6 @@ public abstract class RemoteCommandShell implements IAdaptable, IRemoteCommandSh protected IRemoteCmdSubSystem _cmdSubSystem; protected ArrayList _cmdHistory; protected IProject _project; - - public RemoteCommandShell(IRemoteCmdSubSystem cmdSubSystem) { @@ -294,10 +290,7 @@ public abstract class RemoteCommandShell implements IAdaptable, IRemoteCommandSh protected boolean isWindows() { - String type = getCommandSubSystem().getHost().getSystemType().getName(); - - return (type.equals("Windows") || //$NON-NLS-1$ - type.equals("Local") && System.getProperty("os.name").toLowerCase().startsWith("win")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + return getCommandSubSystem().getHost().getSystemType().isWindows(); } diff --git a/rse/plugins/org.eclipse.rse.subsystems.shells.core/src/org/eclipse/rse/subsystems/shells/core/subsystems/RemoteCmdSubSystem.java b/rse/plugins/org.eclipse.rse.subsystems.shells.core/src/org/eclipse/rse/subsystems/shells/core/subsystems/RemoteCmdSubSystem.java index 0a5a4b1fd87..cd3458c3c39 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.shells.core/src/org/eclipse/rse/subsystems/shells/core/subsystems/RemoteCmdSubSystem.java +++ b/rse/plugins/org.eclipse.rse.subsystems.shells.core/src/org/eclipse/rse/subsystems/shells/core/subsystems/RemoteCmdSubSystem.java @@ -14,6 +14,7 @@ * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.subsystems.shells.core.subsystems; @@ -51,7 +52,6 @@ import org.eclipse.rse.ui.RSEUIPlugin; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; - /** * This is the abstraction of a subsystem specialized for remote execution of * commands. @@ -59,7 +59,6 @@ import org.eclipse.swt.widgets.Shell; public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmdSubSystem, ICommunicationsListener { - private static String COMMAND_SHELLS_MEMENTO = "commandshells"; //$NON-NLS-1$ private static String ENVIRONMENT_VARS = "EnvironmentVariables"; //$NON-NLS-1$ @@ -316,9 +315,7 @@ public abstract class RemoteCmdSubSystem extends SubSystem implements IRemoteCmd public boolean isWindows() { - String type = getSystemType(); - return (type.equals("Windows") || type.equals("Local") //$NON-NLS-1$ //$NON-NLS-2$ - && System.getProperty("os.name").toLowerCase().startsWith("win")); //$NON-NLS-1$ //$NON-NLS-2$ + return getHost().getSystemType().isWindows(); } /** diff --git a/rse/plugins/org.eclipse.rse.subsystems.shells.core/src/org/eclipse/rse/subsystems/shells/core/subsystems/servicesubsystem/ShellServiceSubSystem.java b/rse/plugins/org.eclipse.rse.subsystems.shells.core/src/org/eclipse/rse/subsystems/shells/core/subsystems/servicesubsystem/ShellServiceSubSystem.java index 5a61599dd88..7cd1a18018f 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.shells.core/src/org/eclipse/rse/subsystems/shells/core/subsystems/servicesubsystem/ShellServiceSubSystem.java +++ b/rse/plugins/org.eclipse.rse.subsystems.shells.core/src/org/eclipse/rse/subsystems/shells/core/subsystems/servicesubsystem/ShellServiceSubSystem.java @@ -13,6 +13,7 @@ * Contributors: * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.subsystems.shells.core.subsystems.servicesubsystem; @@ -34,14 +35,11 @@ import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCmdSubSystem; import org.eclipse.rse.subsystems.shells.core.subsystems.IRemoteCommandShell; import org.eclipse.rse.subsystems.shells.core.subsystems.RemoteCmdSubSystem; - - public final class ShellServiceSubSystem extends RemoteCmdSubSystem implements IShellServiceSubSystem { protected String _userHome = null; protected IShellService _hostService; - public ShellServiceSubSystem(IHost host, IConnectorService connectorService, IShellService hostService) { super(host, connectorService); @@ -62,14 +60,15 @@ public final class ShellServiceSubSystem extends RemoteCmdSubSystem implements I { if (_userHome == null) { - if (getSystemType().equals(IRSESystemType.SYSTEMTYPE_WINDOWS)) - { - _userHome = "c:\\"; //$NON-NLS-1$ - } - else if (getSystemType().equals(IRSESystemType.SYSTEMTYPE_LOCAL)) + IRSESystemType type = getHost().getSystemType(); + if (type.isLocal()) { _userHome = System.getProperty("user.home"); //$NON-NLS-1$ } + else if (type.isWindows()) + { + _userHome = "c:\\"; //$NON-NLS-1$ + } else { // Assume UNIX compatible file system diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemConnectAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemConnectAction.java index bb1140b9ccf..9c7ae8027f8 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemConnectAction.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemConnectAction.java @@ -12,6 +12,7 @@ * * Contributors: * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.internal.ui.actions; @@ -20,7 +21,6 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.subsystems.ISubSystem; import org.eclipse.rse.internal.ui.SystemResources; import org.eclipse.rse.ui.ISystemContextMenuConstants; @@ -28,9 +28,6 @@ import org.eclipse.rse.ui.RSEUIPlugin; import org.eclipse.rse.ui.actions.SystemBaseAction; import org.eclipse.swt.widgets.Shell; -//import org.eclipse.rse.core.ui.SystemMessage; - - /** * This is the action for connecting to the remote subsystem */ @@ -49,7 +46,7 @@ public class SystemConnectAction extends SystemBaseAction public IStatus run(IProgressMonitor monitor) { try { - if (_subsystem.getHost().getSystemType().getId().equals(IRSESystemType.SYSTEMTYPE_WINDOWS_ID)) + if (_subsystem.getHost().getSystemType().isWindows()) _subsystem.connect(monitor, false); else _subsystem.connect(monitor, true); diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemWorkOfflineAction.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemWorkOfflineAction.java index 95464192da0..4638bd53c37 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemWorkOfflineAction.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/internal/ui/actions/SystemWorkOfflineAction.java @@ -12,12 +12,12 @@ * * Contributors: * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.internal.ui.actions; import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.SystemBasePlugin; import org.eclipse.rse.core.model.IHost; import org.eclipse.rse.core.model.ISystemRegistry; @@ -102,7 +102,7 @@ public class SystemWorkOfflineAction extends SystemBaseAction } // 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) && !conn.getSystemType().isLocal()) { // backout changes, likely because user cancelled the disconnect setChecked(false); 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 4a2217fa865..3263ed26e24 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 @@ -14,6 +14,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) - [184095] Replace systemTypeName by IRSESystemType + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.internal.ui.propertypages; @@ -131,7 +132,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_ID.equals(conn.getSystemType().getId())) + if(sr.isAnySubSystemConnected(conn) && !conn.getSystemType().isLocal()) { // backout changes, likely because user cancelled the disconnect sr.setHostOffline(conn, false); 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 8bdca17660e..fcb80237b7f 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 @@ -21,6 +21,7 @@ * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType * Martin Oberhuber (Wind River) - [177523] Unify singleton getter methods * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.internal.ui.view; @@ -712,7 +713,7 @@ public class SystemViewConnectionAdapter if (element instanceof IHost) { IHost sysCon = (IHost) element; - if (sysCon.getSystemType().getId().equals(IRSESystemType.SYSTEMTYPE_LOCAL_ID)) return existsMoreThanOneLocalConnection(); + if (sysCon.getSystemType().isLocal()) return existsMoreThanOneLocalConnection(); ISystemRegistry sr = RSEUIPlugin.getTheSystemRegistry(); return !sr.isAnySubSystemConnected((IHost)element); } 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 949e4e6e59f..7d70df6c99c 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 @@ -12,6 +12,7 @@ * * Contributors: * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.ui.dialogs; @@ -108,24 +109,16 @@ public class EnvironmentVariablesPromptDialog extends SystemPromptDialog impleme // Set name and value limits for known system types if (systemType != null) { - if (systemType.equals("iSeries")) //$NON-NLS-1$ + if (systemType.getId().equals(IRSESystemType.SYSTEMTYPE_ISERIES_ID)) { nameTextField.setTextLimit(128); valueTextField.setTextLimit(1024); } - else if (systemType.equals("Windows")) //$NON-NLS-1$ + else if (systemType.isWindows()) { nameTextField.setTextLimit(300); valueTextField.setTextLimit(1024); } - else if (systemType.equals("Local")) //$NON-NLS-1$ - { - if (System.getProperty("os.name").toLowerCase().indexOf("win") != -1) //$NON-NLS-1$ //$NON-NLS-2$ - { - nameTextField.setTextLimit(300); - valueTextField.setTextLimit(1024); - } - } } return parent; diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteDialog.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteDialog.java index bce499be117..efea3ee6748 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteDialog.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/dialogs/SystemDeleteDialog.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) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.ui.dialogs; @@ -145,7 +145,7 @@ public class SystemDeleteDialog extends SystemPromptDialog if (promptLabel == null) { Object input = getInputObject(); - if (input != null && input instanceof IStructuredSelection) { + if (input instanceof IStructuredSelection) { int size = ((IStructuredSelection)input).size(); if (size > 1) { diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemViewAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemViewAdapter.java index e0ea3b35f23..ff023753196 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemViewAdapter.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/AbstractSystemViewAdapter.java @@ -16,6 +16,7 @@ * Martin Oberhuber (Wind River) - [168975] Move RSE Events API to Core * Martin Oberhuber (Wind River) - [182454] improve getAbsoluteName() documentation * Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API + * Martin Oberhuber (Wind River) - [186640] Add IRSESystemTyep.isLocal() ********************************************************************************/ package org.eclipse.rse.ui.view; @@ -1450,6 +1451,29 @@ public abstract class AbstractSystemViewAdapter implements ISystemViewElementAda } return false; } + else if (name.equalsIgnoreCase("systemTypeId")) //$NON-NLS-1$ + { + ISubSystem ss = getSubSystem(target); + String[] values = tokenize(value); + if (ss == null) + { + if (!(target instanceof IHost)) + return false; + String connSysTypeId = ((IHost)target).getSystemType().getId(); + for (int idx=0; idx