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 44f2fdba12e..381035e0252 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 @@ -21,6 +21,7 @@ import java.util.Vector; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.jobs.ISchedulingRule; +import org.eclipse.rse.core.IRSESystemType; import org.eclipse.rse.core.filters.ISystemFilterPool; import org.eclipse.rse.core.filters.ISystemFilterStartHere; import org.eclipse.rse.core.subsystems.IConnectorService; @@ -36,6 +37,8 @@ import org.eclipse.rse.core.subsystems.ISubSystemConfigurationProxy; * The idea here is that connections are grouped by system profile. At any * time, there is a user-specified number of profiles "active" and connections * from each active profile are worked with. + *
+ * This interface is not intended to be implemented by clients. */ public interface ISystemRegistry extends ISchedulingRule { @@ -109,6 +112,12 @@ 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. + */ + public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(IRSESystemType systemType); + /** * Return all subsystem factories which support the given system type. If the type is null, * returns all. @@ -368,6 +377,15 @@ public interface ISystemRegistry extends ISchedulingRule { */ public IHost[] getHostsBySubSystemConfigurationCategory(String factoryCategory); + /** + * Returns all connections for all active profiles, for the given system type. + * If the specified system type is null, an empty array is returned. + * + * @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. */ diff --git a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRegistry.java b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRegistry.java index 155c0e51a1b..3a441057c94 100644 --- a/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRegistry.java +++ b/rse/plugins/org.eclipse.rse.ui/model/org/eclipse/rse/model/SystemRegistry.java @@ -602,6 +602,16 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven return factories; } + /* (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#getSubSystemConfigurationsBySystemType(org.eclipse.rse.core.IRSESystemType) + */ + public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(IRSESystemType systemType) { + return getSubSystemConfigurationsBySystemType(systemType != null ? systemType.getName() : null); + } + + /* (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#getSubSystemConfigurationsBySystemType(java.lang.String) + */ public ISubSystemConfiguration[] getSubSystemConfigurationsBySystemType(String systemType) { return getSubSystemConfigurationsBySystemType(systemType, false); @@ -1757,6 +1767,28 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven return conns; } + /* (non-Javadoc) + * @see org.eclipse.rse.core.model.ISystemRegistry#getHostsBySystemType(org.eclipse.rse.core.IRSESystemType) + */ + public IHost[] getHostsBySystemType(IRSESystemType systemType) { + List connections = new ArrayList(); + + if (systemType != null) { + IHost[] candidates = getHosts(); + for (int i = 0; i < candidates.length; i++) { + IHost candidate = candidates[i]; + //FIXME: If IHost.getSystemType() returns the id or the IRSESystemType + // object, this comparisation must be adapted. + IRSESystemType candidateType = RSECorePlugin.getDefault().getRegistry().getSystemType(candidate.getSystemType()); + if (systemType.equals(candidateType)) { + connections.add(candidate); + } + } + } + + return (IHost[])connections.toArray(new IHost[connections.size()]); + } + /** * Return all connections for all active profiles, for the given system type. * Never returns null!