1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

Bug 507989 - Allow choosing of o.e.remote connection type

Collect the list of connection types that support the command shell
service and pass that to the RemoteConnectionWidget so that you can
select which one you want.

Also adds a fix to the connection manager that was closing the
terminal of read returned 0 bytes. That's generally not an end of
file condition, especially with Serial Ports. There ugliness to them
where you can't close the port while it's blocked on the read, which
means it needs to return once in a while.

Fix setting of title and force new to match the other delegates.

Change-Id: I6b78d789ca28284379d8f1136062ec180e1a8f5c
Signed-off-by: Doug Schaefer <dschaefer@blackberry.com>
This commit is contained in:
Doug Schaefer 2016-11-22 16:22:57 -05:00
parent 9bbe84d17e
commit c0335a085e
3 changed files with 32 additions and 18 deletions

View file

@ -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);
}
}

View file

@ -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<IRemoteServicesManager> ref = context.getServiceReference(IRemoteServicesManager.class);
IRemoteServicesManager manager = context.getService(ref);
@SuppressWarnings("unchecked")
List<IRemoteConnectionType> types = manager.getConnectionTypesSupporting(IRemoteCommandShellService.class);
fRemoteConnectionWidget = new RemoteConnectionWidget(composite, SWT.NONE, null, 0, types);
fRemoteConnectionWidget.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {

View file

@ -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<String, Object> 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);