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 fa96a9b5808..d2bbb58585d 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 @@ -568,6 +568,13 @@ public interface ISystemRegistry extends ISchedulingRule public IHost moveHost(IProgressMonitor monitor, IHost conn, ISystemProfile targetProfile, String newName) throws Exception; + + /** + * Return true if any subsystem supports connecting. + * @param conn the connection. + * @return true if any subsystem supports connecting, false otherwise. + */ + public boolean isAnySubSystemSupportsConnect(IHost conn); /** * Return true if any of the subsystems for the given connection are currently connected diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewConnectionAdapter.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewConnectionAdapter.java index 8b8c8e29db1..28746bd3d5b 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewConnectionAdapter.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemViewConnectionAdapter.java @@ -125,10 +125,14 @@ public class SystemViewConnectionAdapter { IHost sysCon = (IHost) selection.getFirstElement(); ISystemRegistry sysReg = RSEUIPlugin.getTheSystemRegistry(); - boolean anyConnected = sysReg.isAnySubSystemConnected(sysCon); - boolean allConnected = sysReg.areAllSubSystemsConnected(sysCon); - if (!allConnected) menu.add(menuGroup, connectAction); - if (anyConnected) menu.add(menuGroup, disconnectAction); + boolean anySupportsConnect = sysReg.isAnySubSystemSupportsConnect(sysCon); + + if (anySupportsConnect) { + boolean anyConnected = sysReg.isAnySubSystemConnected(sysCon); + boolean allConnected = sysReg.areAllSubSystemsConnected(sysCon); + if (!allConnected) menu.add(menuGroup, connectAction); + if (anyConnected) menu.add(menuGroup, disconnectAction); + } } private void createActions() 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 347d22ff3a7..35d249b44b6 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 @@ -17,6 +17,7 @@ package org.eclipse.rse.model; import java.io.File; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import java.util.Vector; @@ -2619,6 +2620,31 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven return newConn; } + /** + * @see org.eclipse.rse.core.model.ISystemRegistry#isAnySubSystemSupportsConnect(org.eclipse.rse.core.model.IHost) + */ + public boolean isAnySubSystemSupportsConnect(IHost conn) { + Vector v = getSubSystemFactories(conn); + + if (v != null) { + Iterator iter = v.iterator(); + + while (iter.hasNext()) { + Object obj = iter.next(); + + if (obj instanceof ISubSystemConfiguration) { + ISubSystemConfiguration config = (ISubSystemConfiguration)obj; + + if (config.supportsSubSystemConnect()) { + return true; + } + } + } + } + + return false; + } + /** * Return true if any of the subsystems for the given connection are currently connected */