mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-04 14:55:41 +02:00
Bug 150902: Disconnect contextmenu should not be shown for "Local" systems
This commit is contained in:
parent
ea4e43aff4
commit
6cd999a5e9
3 changed files with 41 additions and 4 deletions
|
@ -569,6 +569,13 @@ public interface ISystemRegistry extends ISchedulingRule
|
||||||
ISystemProfile targetProfile, String newName)
|
ISystemProfile targetProfile, String newName)
|
||||||
throws Exception;
|
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
|
* Return true if any of the subsystems for the given connection are currently connected
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -125,11 +125,15 @@ public class SystemViewConnectionAdapter
|
||||||
{
|
{
|
||||||
IHost sysCon = (IHost) selection.getFirstElement();
|
IHost sysCon = (IHost) selection.getFirstElement();
|
||||||
ISystemRegistry sysReg = RSEUIPlugin.getTheSystemRegistry();
|
ISystemRegistry sysReg = RSEUIPlugin.getTheSystemRegistry();
|
||||||
|
boolean anySupportsConnect = sysReg.isAnySubSystemSupportsConnect(sysCon);
|
||||||
|
|
||||||
|
if (anySupportsConnect) {
|
||||||
boolean anyConnected = sysReg.isAnySubSystemConnected(sysCon);
|
boolean anyConnected = sysReg.isAnySubSystemConnected(sysCon);
|
||||||
boolean allConnected = sysReg.areAllSubSystemsConnected(sysCon);
|
boolean allConnected = sysReg.areAllSubSystemsConnected(sysCon);
|
||||||
if (!allConnected) menu.add(menuGroup, connectAction);
|
if (!allConnected) menu.add(menuGroup, connectAction);
|
||||||
if (anyConnected) menu.add(menuGroup, disconnectAction);
|
if (anyConnected) menu.add(menuGroup, disconnectAction);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void createActions()
|
private void createActions()
|
||||||
{
|
{
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package org.eclipse.rse.model;
|
package org.eclipse.rse.model;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
|
@ -2619,6 +2620,31 @@ public class SystemRegistry implements ISystemRegistryUI, ISystemModelChangeEven
|
||||||
return newConn;
|
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
|
* Return true if any of the subsystems for the given connection are currently connected
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue