1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 06:45:43 +02:00

Bug 150902: Disconnect contextmenu should not be shown for "Local" systems

This commit is contained in:
Kushal Munir 2006-10-25 03:58:42 +00:00
parent ea4e43aff4
commit 6cd999a5e9
3 changed files with 41 additions and 4 deletions

View file

@ -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 <code>true</code> if any subsystem supports connecting, <code>false</code> otherwise.
*/
public boolean isAnySubSystemSupportsConnect(IHost conn);
/**
* Return true if any of the subsystems for the given connection are currently connected

View file

@ -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()

View file

@ -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
*/