diff --git a/plugins/org.eclipse.tm.terminal.connector.remote/src/org/eclipse/tm/terminal/connector/remote/internal/RemoteConnectionManager.java b/plugins/org.eclipse.tm.terminal.connector.remote/src/org/eclipse/tm/terminal/connector/remote/internal/RemoteConnectionManager.java index 0811508f426..c7dd6161ef9 100644 --- a/plugins/org.eclipse.tm.terminal.connector.remote/src/org/eclipse/tm/terminal/connector/remote/internal/RemoteConnectionManager.java +++ b/plugins/org.eclipse.tm.terminal.connector.remote/src/org/eclipse/tm/terminal/connector/remote/internal/RemoteConnectionManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015 IBM Corporation and others. + * Copyright (c) 2015,2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -169,8 +169,8 @@ public class RemoteConnectionManager extends Job { private void readData(InputStream in) throws IOException { byte[] buf = new byte[32 * 1024]; int n; - while ((n = in.read(buf, 0, buf.length)) > 0) { - if (parser == null || parser.parse(buf)) { + while ((n = in.read(buf, 0, buf.length)) >= 0) { + if (n != 0 && (parser == null || parser.parse(buf))) { control.getRemoteToTerminalOutputStream().write(buf, 0, n); } } diff --git a/plugins/org.eclipse.tm.terminal.connector.remote/src/org/eclipse/tm/terminal/connector/remote/internal/RemoteSettingsPage.java b/plugins/org.eclipse.tm.terminal.connector.remote/src/org/eclipse/tm/terminal/connector/remote/internal/RemoteSettingsPage.java index 2ea7ecdb0f2..d8d944bdd34 100644 --- a/plugins/org.eclipse.tm.terminal.connector.remote/src/org/eclipse/tm/terminal/connector/remote/internal/RemoteSettingsPage.java +++ b/plugins/org.eclipse.tm.terminal.connector.remote/src/org/eclipse/tm/terminal/connector/remote/internal/RemoteSettingsPage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015 IBM Corporation and others. + * Copyright (c) 2015,2016 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,6 +7,11 @@ *******************************************************************************/ package org.eclipse.tm.terminal.connector.remote.internal; +import java.util.List; + +import org.eclipse.remote.core.IRemoteCommandShellService; +import org.eclipse.remote.core.IRemoteConnectionType; +import org.eclipse.remote.core.IRemoteServicesManager; import org.eclipse.remote.ui.widgets.RemoteConnectionWidget; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; @@ -15,6 +20,9 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.tm.internal.terminal.provisional.api.AbstractSettingsPage; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.framework.ServiceReference; @SuppressWarnings("restriction") public class RemoteSettingsPage extends AbstractSettingsPage { @@ -69,7 +77,13 @@ public class RemoteSettingsPage extends AbstractSettingsPage { composite.setLayout(gridLayout); composite.setLayoutData(gridData); - fRemoteConnectionWidget = new RemoteConnectionWidget(composite, SWT.NONE, null, 0); + BundleContext context = FrameworkUtil.getBundle(this.getClass()).getBundleContext(); + ServiceReference ref = context.getServiceReference(IRemoteServicesManager.class); + IRemoteServicesManager manager = context.getService(ref); + @SuppressWarnings("unchecked") + List types = manager.getConnectionTypesSupporting(IRemoteCommandShellService.class); + + fRemoteConnectionWidget = new RemoteConnectionWidget(composite, SWT.NONE, null, 0, types); fRemoteConnectionWidget.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { diff --git a/plugins/org.eclipse.tm.terminal.connector.remote/src/org/eclipse/tm/terminal/connector/remote/launcher/RemoteLauncherDelegate.java b/plugins/org.eclipse.tm.terminal.connector.remote/src/org/eclipse/tm/terminal/connector/remote/launcher/RemoteLauncherDelegate.java index 587d425a786..d5f8d7abe4b 100644 --- a/plugins/org.eclipse.tm.terminal.connector.remote/src/org/eclipse/tm/terminal/connector/remote/launcher/RemoteLauncherDelegate.java +++ b/plugins/org.eclipse.tm.terminal.connector.remote/src/org/eclipse/tm/terminal/connector/remote/launcher/RemoteLauncherDelegate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015 Wind River Systems, Inc. and others. All rights reserved. + * Copyright (c) 2015,2016 Wind River Systems, Inc. and others. All rights reserved. * This program and the accompanying materials are made available under the terms * of the Eclipse Public License v1.0 which accompanies this distribution, and is * available at http://www.eclipse.org/legal/epl-v10.html @@ -66,6 +66,18 @@ public class RemoteLauncherDelegate extends AbstractLauncherDelegate { public void execute(Map properties, ITerminalService.Done done) { Assert.isNotNull(properties); + // Set the terminal tab title + String terminalTitle = getTerminalTitle(properties); + if (terminalTitle != null) { + properties.put(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle); + } + + // Force a new terminal tab each time it is launched, if not set otherwise from outside + // TODO need a command shell service routing to get this + if (!properties.containsKey(ITerminalsConnectorConstants.PROP_FORCE_NEW)) { + properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, Boolean.TRUE); + } + // Get the terminal service ITerminalService terminal = TerminalServiceFactory.getService(); // If not available, we cannot fulfill this request @@ -145,18 +157,6 @@ public class RemoteLauncherDelegate extends AbstractLauncherDelegate { connector.load(store); } - // Set the terminal tab title - String terminalTitle = getTerminalTitle(properties); - if (terminalTitle != null) { - properties.put(ITerminalsConnectorConstants.PROP_TITLE, terminalTitle); - } - - // For Telnet terminals, force a new terminal tab each time it is launched, - // if not set otherwise from outside - if (!properties.containsKey(ITerminalsConnectorConstants.PROP_FORCE_NEW)) { - properties.put(ITerminalsConnectorConstants.PROP_FORCE_NEW, Boolean.TRUE); - } - if (!properties.containsKey(ITerminalsConnectorConstants.PROP_ENCODING)) { IRemoteServicesManager svcMgr = Activator.getService(IRemoteServicesManager.class);