mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 18:56:02 +02:00
Terminals: Bug 460065 - The SSH Terminal "disconnect" icon disappears
when a selection is made
This commit is contained in:
parent
cf87ee533b
commit
5d84a80a39
8 changed files with 14 additions and 57 deletions
|
@ -67,13 +67,6 @@ public interface ITerminalsConnectorConstants {
|
|||
*/
|
||||
public static final String PROP_FORCE_NEW = "terminal.forceNew"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Property: Flag to signal if the terminal tab shall have a disconnect button or not.
|
||||
* <p>
|
||||
* Property Type: {@link Boolean}
|
||||
*/
|
||||
public static final String PROP_HAS_DISCONNECT_BUTTON = "hasDisconnectButton"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Property: Terminals launcher delegate id.
|
||||
* <p>
|
||||
|
|
|
@ -68,11 +68,6 @@ public class SerialLauncherDelegate extends AbstractLauncherDelegate {
|
|||
properties.put(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle);
|
||||
}
|
||||
|
||||
// Serial terminals do have a disconnect button
|
||||
if (!properties.containsKey(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON)) {
|
||||
properties.put(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON, Boolean.TRUE);
|
||||
}
|
||||
|
||||
// Get the terminal service
|
||||
ITerminalService terminal = TerminalServiceFactory.getService();
|
||||
// If not available, we cannot fulfill this request
|
||||
|
|
|
@ -75,11 +75,6 @@ public class SshLauncherDelegate extends AbstractLauncherDelegate {
|
|||
properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, Boolean.TRUE);
|
||||
}
|
||||
|
||||
// SSH terminals do have a disconnect button
|
||||
if (!properties.containsKey(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON)) {
|
||||
properties.put(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON, Boolean.TRUE);
|
||||
}
|
||||
|
||||
// Get the terminal service
|
||||
ITerminalService terminal = TerminalServiceFactory.getService();
|
||||
// If not available, we cannot fulfill this request
|
||||
|
|
|
@ -75,11 +75,6 @@ public class TelnetLauncherDelegate extends AbstractLauncherDelegate {
|
|||
properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, Boolean.TRUE);
|
||||
}
|
||||
|
||||
// Telnet terminals do have a disconnect button
|
||||
if (!properties.containsKey(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON)) {
|
||||
properties.put(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON, Boolean.TRUE);
|
||||
}
|
||||
|
||||
// Get the terminal service
|
||||
ITerminalService terminal = TerminalServiceFactory.getService();
|
||||
// If not available, we cannot fulfill this request
|
||||
|
|
|
@ -128,7 +128,7 @@
|
|||
class="org.eclipse.tcf.te.ui.terminals.internal.PropertyTester"
|
||||
id="org.eclipse.tcf.te.ui.terminals.PropertyTester"
|
||||
namespace="org.eclipse.tcf.te.ui.terminals"
|
||||
properties="hasApplicableLauncherDelegates,hasDisconnectButton,canDisconnect"
|
||||
properties="hasApplicableLauncherDelegates,canDisconnect"
|
||||
type="java.lang.Object">
|
||||
</propertyTester>
|
||||
</extension>
|
||||
|
@ -175,16 +175,6 @@
|
|||
label="%command.disconnect.label"
|
||||
style="push"
|
||||
tooltip="%command.disconnect.tooltip">
|
||||
<visibleWhen checkEnabled="false">
|
||||
<with variable="selection">
|
||||
<count value="1"/>
|
||||
<iterate operator="and" ifEmpty="false">
|
||||
<adapt type="org.eclipse.swt.custom.CTabItem">
|
||||
<test property="org.eclipse.tcf.te.ui.terminals.hasDisconnectButton" value="true"/>
|
||||
</adapt>
|
||||
</iterate>
|
||||
</with>
|
||||
</visibleWhen>
|
||||
</command>
|
||||
</menuContribution>
|
||||
<menuContribution locationURI="popup:org.eclipse.tcf.te.ui.terminals.TerminalsView?after=additions">
|
||||
|
@ -263,13 +253,9 @@
|
|||
class="org.eclipse.tcf.te.ui.terminals.internal.handler.DisconnectTerminalCommandHandler"
|
||||
commandId="org.eclipse.tcf.te.ui.terminals.command.disconnect">
|
||||
<enabledWhen>
|
||||
<with variable="selection">
|
||||
<count value="1"/>
|
||||
<iterate operator="and" ifEmpty="false">
|
||||
<adapt type="org.eclipse.swt.custom.CTabItem">
|
||||
<test property="org.eclipse.tcf.te.ui.terminals.canDisconnect" value="true"/>
|
||||
</adapt>
|
||||
</iterate>
|
||||
<with variable="activePart">
|
||||
<instanceof value="org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView"/>
|
||||
<test property="org.eclipse.tcf.te.ui.terminals.canDisconnect" value="true"/>
|
||||
</with>
|
||||
</enabledWhen>
|
||||
</handler>
|
||||
|
|
|
@ -12,8 +12,9 @@ package org.eclipse.tcf.te.ui.terminals.internal;
|
|||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.swt.custom.CTabItem;
|
||||
import org.eclipse.tcf.te.core.terminals.interfaces.constants.ITerminalsConnectorConstants;
|
||||
import org.eclipse.tcf.te.ui.terminals.interfaces.ITerminalsView;
|
||||
import org.eclipse.tcf.te.ui.terminals.launcher.LauncherDelegateManager;
|
||||
import org.eclipse.tcf.te.ui.terminals.tabs.TabFolderManager;
|
||||
import org.eclipse.tm.internal.terminal.control.ITerminalViewControl;
|
||||
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
|
||||
|
||||
|
@ -34,18 +35,15 @@ public class PropertyTester extends org.eclipse.core.expressions.PropertyTester
|
|||
return expectedValue.equals(Boolean.valueOf(LauncherDelegateManager.getInstance().getApplicableLauncherDelegates(selection).length > 0));
|
||||
}
|
||||
|
||||
if ("hasDisconnectButton".equals(property) && receiver instanceof CTabItem) { //$NON-NLS-1$
|
||||
CTabItem tabItem = (CTabItem)receiver;
|
||||
if (!tabItem.isDisposed()) {
|
||||
Boolean hasDisconnectButton = (Boolean) tabItem.getData(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON);
|
||||
return expectedValue.equals(hasDisconnectButton);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if ("canDisconnect".equals(property) && receiver instanceof ITerminalsView) { //$NON-NLS-1$
|
||||
CTabItem tabItem = null;
|
||||
|
||||
if ("canDisconnect".equals(property) && receiver instanceof CTabItem) { //$NON-NLS-1$
|
||||
CTabItem tabItem = (CTabItem)receiver;
|
||||
if (!tabItem.isDisposed() && tabItem.getData() instanceof ITerminalViewControl) {
|
||||
TabFolderManager manager = (TabFolderManager) ((ITerminalsView)receiver).getAdapter(TabFolderManager.class);
|
||||
if (manager != null) {
|
||||
tabItem = manager.getActiveTabItem();
|
||||
}
|
||||
|
||||
if (tabItem != null && !tabItem.isDisposed() && tabItem.getData() instanceof ITerminalViewControl) {
|
||||
ITerminalViewControl terminal = (ITerminalViewControl)tabItem.getData();
|
||||
TerminalState state = terminal.getState();
|
||||
return expectedValue.equals(Boolean.valueOf(state != TerminalState.CLOSED));
|
||||
|
|
|
@ -302,9 +302,6 @@ public class TerminalService implements ITerminalService {
|
|||
if (properties.get(ITerminalsConnectorConstants.PROP_FORCE_NEW) instanceof Boolean) {
|
||||
flags.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, (Boolean)properties.get(ITerminalsConnectorConstants.PROP_FORCE_NEW));
|
||||
}
|
||||
if (properties.get(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON) instanceof Boolean) {
|
||||
flags.put(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON, (Boolean)properties.get(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON));
|
||||
}
|
||||
// Open the new console
|
||||
CTabItem item;
|
||||
if (secondaryId != null)
|
||||
|
|
|
@ -283,8 +283,6 @@ public class TabFolderManager extends PlatformObject implements ISelectionProvid
|
|||
item.setData(terminal);
|
||||
// Associated the custom data node with the tab item (if any)
|
||||
if (data != null) item.setData("customData", data); //$NON-NLS-1$
|
||||
// Set the property that marks the item has a disconnect button or not if selected
|
||||
item.setData(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON, flags != null && flags.containsKey(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON) ? flags.get(ITerminalsConnectorConstants.PROP_HAS_DISCONNECT_BUTTON) : Boolean.FALSE);
|
||||
|
||||
// Overwrite the text canvas help id
|
||||
String contextHelpId = getParentView().getContextHelpId();
|
||||
|
|
Loading…
Add table
Reference in a new issue