mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 12:55:40 +02:00
Bug 494108 - [telnet] Telnet line-ending should be configurable
This commit is contained in:
parent
159afcfd92
commit
092e089d40
12 changed files with 125 additions and 60 deletions
|
@ -8,7 +8,7 @@ Bundle-Vendor: %providerName
|
||||||
Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
|
Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
|
||||||
org.eclipse.core.runtime;bundle-version="3.8.0",
|
org.eclipse.core.runtime;bundle-version="3.8.0",
|
||||||
org.eclipse.equinox.security;bundle-version="1.1.100",
|
org.eclipse.equinox.security;bundle-version="1.1.100",
|
||||||
org.eclipse.tm.terminal.view.core;bundle-version="4.0.0";resolution:=optional,
|
org.eclipse.tm.terminal.view.core;bundle-version="4.1.0";resolution:=optional,
|
||||||
org.eclipse.tm.terminal.view.ui;bundle-version="4.1.0";resolution:=optional,
|
org.eclipse.tm.terminal.view.ui;bundle-version="4.1.0";resolution:=optional,
|
||||||
org.eclipse.tm.terminal.control;bundle-version="4.0.0",
|
org.eclipse.tm.terminal.control;bundle-version="4.0.0",
|
||||||
org.eclipse.ui;bundle-version="3.8.0"
|
org.eclipse.ui;bundle-version="3.8.0"
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2015 Wind River Systems, Inc. and others.
|
* Copyright (c) 2006, 2016 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Michael Scharf (Wind River) - initial API and implementation
|
* Michael Scharf (Wind River) - initial API and implementation
|
||||||
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified
|
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
@ -14,9 +14,13 @@ package org.eclipse.tm.terminal.connector.telnet.connector;
|
||||||
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
|
import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore;
|
||||||
|
|
||||||
public interface ITelnetSettings {
|
public interface ITelnetSettings {
|
||||||
|
static final String EOL_CRNUL = "CR+NUL"; //$NON-NLS-1$
|
||||||
|
static final String EOL_CRLF = "CR+LF"; //$NON-NLS-1$
|
||||||
|
|
||||||
String getHost();
|
String getHost();
|
||||||
int getNetworkPort();
|
int getNetworkPort();
|
||||||
int getTimeout();
|
int getTimeout();
|
||||||
|
String getEndOfLine();
|
||||||
String getSummary();
|
String getSummary();
|
||||||
void load(ISettingsStore store);
|
void load(ISettingsStore store);
|
||||||
void save(ISettingsStore store);
|
void save(ISettingsStore store);
|
||||||
|
|
|
@ -34,6 +34,32 @@ import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
|
||||||
import org.eclipse.tm.internal.terminal.provisional.api.provider.TerminalConnectorImpl;
|
import org.eclipse.tm.internal.terminal.provisional.api.provider.TerminalConnectorImpl;
|
||||||
|
|
||||||
public class TelnetConnector extends TerminalConnectorImpl {
|
public class TelnetConnector extends TerminalConnectorImpl {
|
||||||
|
|
||||||
|
static final class TelnetOutputStream extends FilterOutputStream {
|
||||||
|
final static byte CR = 13;
|
||||||
|
final static byte LF = 10;
|
||||||
|
final static byte NUL = 0;
|
||||||
|
final static byte[] CRNUL = { CR, NUL };
|
||||||
|
final static byte[] CRLF = { CR, LF };
|
||||||
|
final byte[] EOL;
|
||||||
|
|
||||||
|
public TelnetOutputStream(OutputStream outputStream, String endOfLine) {
|
||||||
|
super(outputStream);
|
||||||
|
if (ITelnetSettings.EOL_CRLF.equals(endOfLine))
|
||||||
|
EOL = CRLF;
|
||||||
|
else
|
||||||
|
EOL = CRNUL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(int b) throws IOException {
|
||||||
|
if (b == CR)
|
||||||
|
out.write(EOL);
|
||||||
|
else
|
||||||
|
out.write(b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private OutputStream fOutputStream;
|
private OutputStream fOutputStream;
|
||||||
private InputStream fInputStream;
|
private InputStream fInputStream;
|
||||||
private Socket fSocket;
|
private Socket fSocket;
|
||||||
|
@ -115,25 +141,8 @@ public class TelnetConnector extends TerminalConnectorImpl {
|
||||||
fOutputStream = null;
|
fOutputStream = null;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// send LF after CR (telnet end-of-line sequence - RFC 854)
|
// translate CR to telnet end-of-line sequence - RFC 854
|
||||||
fOutputStream = new FilterOutputStream(outputStream) {
|
fOutputStream = new TelnetOutputStream(outputStream, fSettings.getEndOfLine());
|
||||||
final byte CR = 13;
|
|
||||||
final byte LF = 10;
|
|
||||||
final byte[] CRLF = { CR, LF };
|
|
||||||
int last = -1;
|
|
||||||
@Override
|
|
||||||
public void write(int b) throws IOException {
|
|
||||||
if (b == LF && last == CR) {
|
|
||||||
last = b;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
last = b;
|
|
||||||
if (b == CR)
|
|
||||||
out.write(CRLF);
|
|
||||||
else
|
|
||||||
out.write(b);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
Socket getSocket() {
|
Socket getSocket() {
|
||||||
return fSocket;
|
return fSocket;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2006, 2015 Wind River Systems, Inc. and others.
|
* Copyright (c) 2006, 2016 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Michael Scharf (Wind River) - initial API and implementation
|
* Michael Scharf (Wind River) - initial API and implementation
|
||||||
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified
|
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
@ -21,5 +21,6 @@ public class TelnetMessages extends NLS {
|
||||||
public static String HOST;
|
public static String HOST;
|
||||||
public static String CONNECTION_CLOSED_BY_FOREIGN_HOST;
|
public static String CONNECTION_CLOSED_BY_FOREIGN_HOST;
|
||||||
public static String TIMEOUT;
|
public static String TIMEOUT;
|
||||||
|
public static String END_OF_LINE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Copyright (c) 2005, 2015 Wind River Systems, Inc. and others.
|
# Copyright (c) 2005, 2016 Wind River Systems, Inc. and others.
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are made available under the terms of the Eclipse Public License v1.0
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
# which accompanies this distribution, and is available at
|
# which accompanies this distribution, and is available at
|
||||||
|
@ -18,3 +18,4 @@ PORT = Port
|
||||||
HOST = Host
|
HOST = Host
|
||||||
CONNECTION_CLOSED_BY_FOREIGN_HOST= Connection closed by foreign host.
|
CONNECTION_CLOSED_BY_FOREIGN_HOST= Connection closed by foreign host.
|
||||||
TIMEOUT = Timeout (sec)
|
TIMEOUT = Timeout (sec)
|
||||||
|
END_OF_LINE = End of Line
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2003, 2015 Wind River Systems, Inc. and others.
|
* Copyright (c) 2003, 2016 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
* Helmut Haigermoser and Ted Williams.
|
* Helmut Haigermoser and Ted Williams.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Michael Scharf (Wind River) - extracted from TerminalSettings
|
* Michael Scharf (Wind River) - extracted from TerminalSettings
|
||||||
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified
|
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.tm.terminal.connector.telnet.connector;
|
package org.eclipse.tm.terminal.connector.telnet.connector;
|
||||||
|
@ -22,6 +22,7 @@ public class TelnetSettings implements ITelnetSettings {
|
||||||
protected String fHost;
|
protected String fHost;
|
||||||
protected String fNetworkPort;
|
protected String fNetworkPort;
|
||||||
protected String fTimeout;
|
protected String fTimeout;
|
||||||
|
protected String fEndOfLine = EOL_CRNUL;
|
||||||
private final TelnetProperties fProperties=new TelnetProperties();
|
private final TelnetProperties fProperties=new TelnetProperties();
|
||||||
@Override
|
@Override
|
||||||
public String getHost() {
|
public String getHost() {
|
||||||
|
@ -59,6 +60,7 @@ public class TelnetSettings implements ITelnetSettings {
|
||||||
fHost = store.get("Host", fProperties.getDefaultHost());//$NON-NLS-1$
|
fHost = store.get("Host", fProperties.getDefaultHost());//$NON-NLS-1$
|
||||||
fNetworkPort = store.get("NetworkPort", fProperties.getDefaultNetworkPort());//$NON-NLS-1$
|
fNetworkPort = store.get("NetworkPort", fProperties.getDefaultNetworkPort());//$NON-NLS-1$
|
||||||
fTimeout = store.get("Timeout","10");//$NON-NLS-1$ //$NON-NLS-2$
|
fTimeout = store.get("Timeout","10");//$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
fEndOfLine = store.get("EndOfLine", EOL_CRNUL);//$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -66,6 +68,7 @@ public class TelnetSettings implements ITelnetSettings {
|
||||||
store.put("Host", fHost);//$NON-NLS-1$
|
store.put("Host", fHost);//$NON-NLS-1$
|
||||||
store.put("NetworkPort", fNetworkPort);//$NON-NLS-1$
|
store.put("NetworkPort", fNetworkPort);//$NON-NLS-1$
|
||||||
store.put("Timeout", fTimeout);//$NON-NLS-1$
|
store.put("Timeout", fTimeout);//$NON-NLS-1$
|
||||||
|
store.put("EndOfLine", fEndOfLine);//$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public TelnetProperties getProperties() {
|
public TelnetProperties getProperties() {
|
||||||
|
@ -86,4 +89,13 @@ public class TelnetSettings implements ITelnetSettings {
|
||||||
public void setTimeout(String timeout) {
|
public void setTimeout(String timeout) {
|
||||||
fTimeout = timeout;
|
fTimeout = timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setEndOfLine(String eol) {
|
||||||
|
fEndOfLine = EOL_CRLF.equals(eol) ? EOL_CRLF : EOL_CRNUL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getEndOfLine() {
|
||||||
|
return fEndOfLine;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2003, 2015 Wind River Systems, Inc. and others.
|
* Copyright (c) 2003, 2016 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -18,6 +18,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.tm.terminal.connector.telnet.connector;
|
package org.eclipse.tm.terminal.connector.telnet.connector;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -41,6 +42,7 @@ public class TelnetSettingsPage extends AbstractSettingsPage {
|
||||||
/* default */ Text fHostText;
|
/* default */ Text fHostText;
|
||||||
/* default */ Combo fNetworkPortCombo;
|
/* default */ Combo fNetworkPortCombo;
|
||||||
/* default */ Text fTimeout;
|
/* default */ Text fTimeout;
|
||||||
|
/* default */ Combo fEndOfLineCombo;
|
||||||
private final TelnetSettings fTerminalSettings;
|
private final TelnetSettings fTerminalSettings;
|
||||||
|
|
||||||
public TelnetSettingsPage(TelnetSettings settings) {
|
public TelnetSettingsPage(TelnetSettings settings) {
|
||||||
|
@ -51,6 +53,7 @@ public class TelnetSettingsPage extends AbstractSettingsPage {
|
||||||
fTerminalSettings.setHost(fHostText.getText());
|
fTerminalSettings.setHost(fHostText.getText());
|
||||||
fTerminalSettings.setTimeout(fTimeout.getText());
|
fTerminalSettings.setTimeout(fTimeout.getText());
|
||||||
fTerminalSettings.setNetworkPort(getNetworkPort());
|
fTerminalSettings.setNetworkPort(getNetworkPort());
|
||||||
|
fTerminalSettings.setEndOfLine(getEndOfLine());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -59,6 +62,7 @@ public class TelnetSettingsPage extends AbstractSettingsPage {
|
||||||
setHost(fTerminalSettings.getHost());
|
setHost(fTerminalSettings.getHost());
|
||||||
setTimeout(fTerminalSettings.getTimeoutString());
|
setTimeout(fTerminalSettings.getTimeoutString());
|
||||||
setNetworkPort(fTerminalSettings.getNetworkPortString());
|
setNetworkPort(fTerminalSettings.getNetworkPortString());
|
||||||
|
setEndOfLine(fTerminalSettings.getEndOfLine());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void setHost(String strHost) {
|
private void setHost(String strHost) {
|
||||||
|
@ -96,7 +100,13 @@ public class TelnetSettingsPage extends AbstractSettingsPage {
|
||||||
private NetworkPortMap getNetworkPortMap() {
|
private NetworkPortMap getNetworkPortMap() {
|
||||||
return fTerminalSettings.getProperties().getNetworkPortMap();
|
return fTerminalSettings.getProperties().getNetworkPortMap();
|
||||||
}
|
}
|
||||||
|
private void setEndOfLine(String eol) {
|
||||||
|
int idx = fEndOfLineCombo.indexOf(eol);
|
||||||
|
fEndOfLineCombo.select(idx >= 0 ? idx : 0);
|
||||||
|
}
|
||||||
|
private String getEndOfLine() {
|
||||||
|
return fEndOfLineCombo.getText();
|
||||||
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean validateSettings() {
|
public boolean validateSettings() {
|
||||||
String message = null;
|
String message = null;
|
||||||
|
@ -210,6 +220,18 @@ public class TelnetSettingsPage extends AbstractSettingsPage {
|
||||||
});
|
});
|
||||||
createControlDecoration(fTimeout);
|
createControlDecoration(fTimeout);
|
||||||
|
|
||||||
|
new Label(composite, SWT.RIGHT).setText(TelnetMessages.END_OF_LINE + ":"); //$NON-NLS-1$
|
||||||
|
gridData = new GridData(GridData.FILL_HORIZONTAL);
|
||||||
|
fEndOfLineCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
|
||||||
|
fEndOfLineCombo.setLayoutData(gridData);
|
||||||
|
fEndOfLineCombo.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
fireListeners(fEndOfLineCombo);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
loadCombo(fEndOfLineCombo, Arrays.asList(ITelnetSettings.EOL_CRNUL, ITelnetSettings.EOL_CRLF));
|
||||||
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
}
|
}
|
||||||
private void loadCombo(Combo ctlCombo, List<String> table) {
|
private void loadCombo(Combo ctlCombo, List<String> table) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved.
|
* Copyright (c) 2011, 2016 Wind River Systems, Inc. and others. All rights reserved.
|
||||||
* This program and the accompanying materials are made available under the terms
|
* 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
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
@ -104,6 +104,10 @@ public class TelnetWizardConfigurationPanel extends AbstractExtendedConfiguratio
|
||||||
value = v != null ? v.toString() : null;
|
value = v != null ? v.toString() : null;
|
||||||
if (value != null) telnetSettings.setTimeout(value);
|
if (value != null) telnetSettings.setTimeout(value);
|
||||||
|
|
||||||
|
v = data.get(ITerminalsConnectorConstants.PROP_TELNET_EOL);
|
||||||
|
value = v != null ? v.toString() : null;
|
||||||
|
if (value != null) telnetSettings.setEndOfLine(value);
|
||||||
|
|
||||||
value = (String)data.get(ITerminalsConnectorConstants.PROP_ENCODING);
|
value = (String)data.get(ITerminalsConnectorConstants.PROP_ENCODING);
|
||||||
if (value != null) setEncoding(value);
|
if (value != null) setEncoding(value);
|
||||||
|
|
||||||
|
@ -124,6 +128,7 @@ public class TelnetWizardConfigurationPanel extends AbstractExtendedConfiguratio
|
||||||
data.put(ITerminalsConnectorConstants.PROP_IP_HOST,telnetSettings.getHost());
|
data.put(ITerminalsConnectorConstants.PROP_IP_HOST,telnetSettings.getHost());
|
||||||
data.put(ITerminalsConnectorConstants.PROP_IP_PORT, Integer.valueOf(telnetSettings.getNetworkPort()));
|
data.put(ITerminalsConnectorConstants.PROP_IP_PORT, Integer.valueOf(telnetSettings.getNetworkPort()));
|
||||||
data.put(ITerminalsConnectorConstants.PROP_TIMEOUT, Integer.valueOf(telnetSettings.getTimeout()));
|
data.put(ITerminalsConnectorConstants.PROP_TIMEOUT, Integer.valueOf(telnetSettings.getTimeout()));
|
||||||
|
data.put(ITerminalsConnectorConstants.PROP_TELNET_EOL, telnetSettings.getEndOfLine());
|
||||||
data.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
|
data.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,6 +149,9 @@ public class TelnetWizardConfigurationPanel extends AbstractExtendedConfiguratio
|
||||||
if (hostSettings.get(ITerminalsConnectorConstants.PROP_TIMEOUT) != null) {
|
if (hostSettings.get(ITerminalsConnectorConstants.PROP_TIMEOUT) != null) {
|
||||||
telnetSettings.setTimeout(hostSettings.get(ITerminalsConnectorConstants.PROP_TIMEOUT));
|
telnetSettings.setTimeout(hostSettings.get(ITerminalsConnectorConstants.PROP_TIMEOUT));
|
||||||
}
|
}
|
||||||
|
if (hostSettings.get(ITerminalsConnectorConstants.PROP_TELNET_EOL) != null) {
|
||||||
|
telnetSettings.setEndOfLine(hostSettings.get(ITerminalsConnectorConstants.PROP_TELNET_EOL));
|
||||||
|
}
|
||||||
if (hostSettings.get(ITerminalsConnectorConstants.PROP_ENCODING) != null) {
|
if (hostSettings.get(ITerminalsConnectorConstants.PROP_ENCODING) != null) {
|
||||||
setEncoding(hostSettings.get(ITerminalsConnectorConstants.PROP_ENCODING));
|
setEncoding(hostSettings.get(ITerminalsConnectorConstants.PROP_ENCODING));
|
||||||
}
|
}
|
||||||
|
@ -164,24 +172,20 @@ public class TelnetWizardConfigurationPanel extends AbstractExtendedConfiguratio
|
||||||
protected void saveSettingsForHost(boolean add){
|
protected void saveSettingsForHost(boolean add){
|
||||||
String host = getHostFromSettings();
|
String host = getHostFromSettings();
|
||||||
if(host != null && host.length() != 0) {
|
if(host != null && host.length() != 0) {
|
||||||
if (hostSettingsMap.containsKey(host)) {
|
Map<String, String> hostSettings = hostSettingsMap.get(host);
|
||||||
Map<String, String> hostSettings=hostSettingsMap.get(host);
|
if (hostSettings == null && !add) {
|
||||||
hostSettings.put(ITerminalsConnectorConstants.PROP_IP_HOST, telnetSettings.getHost());
|
hostSettings=new HashMap<String, String>();
|
||||||
hostSettings.put(ITerminalsConnectorConstants.PROP_IP_PORT, Integer.toString(telnetSettings.getNetworkPort()));
|
|
||||||
hostSettings.put(ITerminalsConnectorConstants.PROP_TIMEOUT, Integer.toString(telnetSettings.getTimeout()));
|
|
||||||
if (getEncoding() != null) {
|
|
||||||
hostSettings.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
|
|
||||||
}
|
|
||||||
} else if (add) {
|
|
||||||
Map<String, String> hostSettings=new HashMap<String, String>();
|
|
||||||
hostSettings.put(ITerminalsConnectorConstants.PROP_IP_HOST, telnetSettings.getHost());
|
|
||||||
hostSettings.put(ITerminalsConnectorConstants.PROP_IP_PORT, Integer.toString(telnetSettings.getNetworkPort()));
|
|
||||||
hostSettings.put(ITerminalsConnectorConstants.PROP_TIMEOUT, Integer.toString(telnetSettings.getTimeout()));
|
|
||||||
if (getEncoding() != null) {
|
|
||||||
hostSettings.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
|
|
||||||
}
|
|
||||||
hostSettingsMap.put(host, hostSettings);
|
hostSettingsMap.put(host, hostSettings);
|
||||||
}
|
}
|
||||||
|
if (hostSettings != null) {
|
||||||
|
hostSettings.put(ITerminalsConnectorConstants.PROP_IP_HOST, telnetSettings.getHost());
|
||||||
|
hostSettings.put(ITerminalsConnectorConstants.PROP_IP_PORT, Integer.toString(telnetSettings.getNetworkPort()));
|
||||||
|
hostSettings.put(ITerminalsConnectorConstants.PROP_TIMEOUT, Integer.toString(telnetSettings.getTimeout()));
|
||||||
|
hostSettings.put(ITerminalsConnectorConstants.PROP_TELNET_EOL, telnetSettings.getEndOfLine());
|
||||||
|
if (getEncoding() != null) {
|
||||||
|
hostSettings.put(ITerminalsConnectorConstants.PROP_ENCODING, getEncoding());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2011, 2015 Wind River Systems, Inc. and others. All rights reserved.
|
* Copyright (c) 2011, 2016 Wind River Systems, Inc. and others. All rights reserved.
|
||||||
* This program and the accompanying materials are made available under the terms
|
* 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
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
@ -134,6 +134,7 @@ public class TelnetLauncherDelegate extends AbstractLauncherDelegate {
|
||||||
String port = value != null ? value.toString() : null;
|
String port = value != null ? value.toString() : null;
|
||||||
value = properties.get(ITerminalsConnectorConstants.PROP_TIMEOUT);
|
value = properties.get(ITerminalsConnectorConstants.PROP_TIMEOUT);
|
||||||
String timeout = value != null ? value.toString() : null;
|
String timeout = value != null ? value.toString() : null;
|
||||||
|
String endOfLine = (String)properties.get(ITerminalsConnectorConstants.PROP_TELNET_EOL);
|
||||||
|
|
||||||
int portOffset = 0;
|
int portOffset = 0;
|
||||||
if (properties.get(ITerminalsConnectorConstants.PROP_IP_PORT_OFFSET) instanceof Integer) {
|
if (properties.get(ITerminalsConnectorConstants.PROP_IP_PORT_OFFSET) instanceof Integer) {
|
||||||
|
@ -156,6 +157,7 @@ public class TelnetLauncherDelegate extends AbstractLauncherDelegate {
|
||||||
if (timeout != null) {
|
if (timeout != null) {
|
||||||
telnetSettings.setTimeout(timeout);
|
telnetSettings.setTimeout(timeout);
|
||||||
}
|
}
|
||||||
|
telnetSettings.setEndOfLine(endOfLine);
|
||||||
// And save the settings to the store
|
// And save the settings to the store
|
||||||
telnetSettings.save(store);
|
telnetSettings.save(store);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %pluginName
|
Bundle-Name: %pluginName
|
||||||
Bundle-SymbolicName: org.eclipse.tm.terminal.view.core;singleton:=true
|
Bundle-SymbolicName: org.eclipse.tm.terminal.view.core;singleton:=true
|
||||||
Bundle-Version: 4.0.0.qualifier
|
Bundle-Version: 4.1.0.qualifier
|
||||||
Bundle-Activator: org.eclipse.tm.terminal.view.core.activator.CoreBundleActivator
|
Bundle-Activator: org.eclipse.tm.terminal.view.core.activator.CoreBundleActivator
|
||||||
Bundle-Vendor: %providerName
|
Bundle-Vendor: %providerName
|
||||||
Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
|
Require-Bundle: org.eclipse.core.expressions;bundle-version="3.4.400",
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<relativePath>../../admin/pom-build.xml</relativePath>
|
<relativePath>../../admin/pom-build.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<version>4.0.0-SNAPSHOT</version>
|
<version>4.1.0-SNAPSHOT</version>
|
||||||
<artifactId>org.eclipse.tm.terminal.view.core</artifactId>
|
<artifactId>org.eclipse.tm.terminal.view.core</artifactId>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2011 - 2015 Wind River Systems, Inc. and others. All rights reserved.
|
* Copyright (c) 2011, 2016 Wind River Systems, Inc. and others. All rights reserved.
|
||||||
* This program and the accompanying materials are made available under the terms
|
* 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
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
@ -319,4 +319,14 @@ public interface ITerminalsConnectorConstants {
|
||||||
* Property Type: {@link String}
|
* Property Type: {@link String}
|
||||||
*/
|
*/
|
||||||
public static final String PROP_SERIAL_FLOW_CONTROL = "serial.flowcontrol"; //$NON-NLS-1$
|
public static final String PROP_SERIAL_FLOW_CONTROL = "serial.flowcontrol"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
// ***** Telnet specific properties *****
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The end-of-line sequence to be sent to the server on "Enter".
|
||||||
|
* <p>
|
||||||
|
* Property Type: {@link String}
|
||||||
|
*/
|
||||||
|
public static final String PROP_TELNET_EOL = "telnet.eol"; //$NON-NLS-1$
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue