mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 12:55:40 +02:00
Cleanup: Fix some warnings
This commit is contained in:
parent
5ef6efe70a
commit
ca86c90468
15 changed files with 108 additions and 84 deletions
|
@ -38,7 +38,6 @@ import org.eclipse.tm.internal.terminal.provisional.api.Logger;
|
||||||
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
|
import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
|
||||||
import org.eclipse.tm.terminal.connector.serial.nls.Messages;
|
import org.eclipse.tm.terminal.connector.serial.nls.Messages;
|
||||||
|
|
||||||
@SuppressWarnings("restriction")
|
|
||||||
public class SerialConnectWorker extends Thread {
|
public class SerialConnectWorker extends Thread {
|
||||||
/* default */ final ITerminalControl fControl;
|
/* default */ final ITerminalControl fControl;
|
||||||
private final SerialConnector fConn;
|
private final SerialConnector fConn;
|
||||||
|
|
|
@ -38,7 +38,6 @@ import org.eclipse.tm.internal.terminal.provisional.api.provider.TerminalConnect
|
||||||
import org.eclipse.tm.terminal.connector.serial.activator.UIPlugin;
|
import org.eclipse.tm.terminal.connector.serial.activator.UIPlugin;
|
||||||
import org.eclipse.tm.terminal.connector.serial.nls.Messages;
|
import org.eclipse.tm.terminal.connector.serial.nls.Messages;
|
||||||
|
|
||||||
@SuppressWarnings("restriction")
|
|
||||||
public class SerialConnector extends TerminalConnectorImpl {
|
public class SerialConnector extends TerminalConnectorImpl {
|
||||||
private OutputStream fOutputStream;
|
private OutputStream fOutputStream;
|
||||||
private InputStream fInputStream;
|
private InputStream fInputStream;
|
||||||
|
|
|
@ -33,7 +33,6 @@ import org.eclipse.tm.terminal.connector.serial.nls.Messages;
|
||||||
/**
|
/**
|
||||||
* UNDER CONSTRUCTION
|
* UNDER CONSTRUCTION
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("restriction")
|
|
||||||
public class SerialPortHandler implements SerialPortEventListener, CommPortOwnershipListener {
|
public class SerialPortHandler implements SerialPortEventListener, CommPortOwnershipListener {
|
||||||
|
|
||||||
/* default */ final ITerminalControl fControl;
|
/* default */ final ITerminalControl fControl;
|
||||||
|
|
|
@ -11,25 +11,25 @@
|
||||||
* Helmut Haigermoser and Ted Williams.
|
* Helmut Haigermoser and Ted Williams.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Michael Scharf (Wind River) - extracted from TerminalProperties
|
* Michael Scharf (Wind River) - extracted from TerminalProperties
|
||||||
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified
|
* Martin Oberhuber (Wind River) - fixed copyright headers and beautified
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.tm.terminal.connector.serial.connector;
|
package org.eclipse.tm.terminal.connector.serial.connector;
|
||||||
|
|
||||||
import gnu.io.CommPortIdentifier;
|
import gnu.io.CommPortIdentifier;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Vector;
|
|
||||||
|
|
||||||
public class SerialProperties {
|
public class SerialProperties {
|
||||||
protected List fSerialPortTable;
|
protected List<String> fSerialPortTable;
|
||||||
protected List fBaudRateTable;
|
protected List<String> fBaudRateTable;
|
||||||
protected List fDataBitsTable;
|
protected List<String> fDataBitsTable;
|
||||||
protected List fStopBitsTable;
|
protected List<String> fStopBitsTable;
|
||||||
protected List fParityTable;
|
protected List<String> fParityTable;
|
||||||
protected List fFlowControlTable;
|
protected List<String> fFlowControlTable;
|
||||||
protected String fDefaultConnType;
|
protected String fDefaultConnType;
|
||||||
protected String fDefaultSerialPort;
|
protected String fDefaultSerialPort;
|
||||||
protected String fDefaultBaudRate;
|
protected String fDefaultBaudRate;
|
||||||
|
@ -41,27 +41,27 @@ public class SerialProperties {
|
||||||
public SerialProperties() {
|
public SerialProperties() {
|
||||||
setupProperties();
|
setupProperties();
|
||||||
}
|
}
|
||||||
public List getSerialPortTable() {
|
public List<String> getSerialPortTable() {
|
||||||
return fSerialPortTable;
|
return fSerialPortTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getBaudRateTable() {
|
public List<String> getBaudRateTable() {
|
||||||
return fBaudRateTable;
|
return fBaudRateTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getDataBitsTable() {
|
public List<String> getDataBitsTable() {
|
||||||
return fDataBitsTable;
|
return fDataBitsTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getStopBitsTable() {
|
public List<String> getStopBitsTable() {
|
||||||
return fStopBitsTable;
|
return fStopBitsTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getParityTable() {
|
public List<String> getParityTable() {
|
||||||
return fParityTable;
|
return fParityTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getFlowControlTable() {
|
public List<String> getFlowControlTable() {
|
||||||
return fFlowControlTable;
|
return fFlowControlTable;
|
||||||
}
|
}
|
||||||
public String getDefaultConnType() {
|
public String getDefaultConnType() {
|
||||||
|
@ -95,12 +95,12 @@ public class SerialProperties {
|
||||||
return "5"; //$NON-NLS-1$
|
return "5"; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
protected void setupProperties() {
|
protected void setupProperties() {
|
||||||
fSerialPortTable = new Vector();
|
fSerialPortTable = new ArrayList<String>();
|
||||||
fBaudRateTable = new Vector();
|
fBaudRateTable = new ArrayList<String>();
|
||||||
fDataBitsTable = new Vector();
|
fDataBitsTable = new ArrayList<String>();
|
||||||
fStopBitsTable = new Vector();
|
fStopBitsTable = new ArrayList<String>();
|
||||||
fParityTable = new Vector();
|
fParityTable = new ArrayList<String>();
|
||||||
fFlowControlTable = new Vector();
|
fFlowControlTable = new ArrayList<String>();
|
||||||
fDefaultConnType = ""; //$NON-NLS-1$
|
fDefaultConnType = ""; //$NON-NLS-1$
|
||||||
fDefaultSerialPort = ""; //$NON-NLS-1$
|
fDefaultSerialPort = ""; //$NON-NLS-1$
|
||||||
fDefaultBaudRate = ""; //$NON-NLS-1$
|
fDefaultBaudRate = ""; //$NON-NLS-1$
|
||||||
|
@ -138,15 +138,15 @@ public class SerialProperties {
|
||||||
fFlowControlTable.add("RTS/CTS"); //$NON-NLS-1$
|
fFlowControlTable.add("RTS/CTS"); //$NON-NLS-1$
|
||||||
fFlowControlTable.add("Xon/Xoff"); //$NON-NLS-1$
|
fFlowControlTable.add("Xon/Xoff"); //$NON-NLS-1$
|
||||||
|
|
||||||
fDefaultBaudRate = (String) fBaudRateTable.get(4);
|
fDefaultBaudRate = fBaudRateTable.get(4);
|
||||||
fDefaultDataBits = (String) fDataBitsTable.get(3);
|
fDefaultDataBits = fDataBitsTable.get(3);
|
||||||
fDefaultStopBits = (String) fStopBitsTable.get(0);
|
fDefaultStopBits = fStopBitsTable.get(0);
|
||||||
fDefaultParity = (String) fParityTable.get(0);
|
fDefaultParity = fParityTable.get(0);
|
||||||
fDefaultFlowControl = (String) fFlowControlTable.get(0);
|
fDefaultFlowControl = fFlowControlTable.get(0);
|
||||||
|
|
||||||
Enumeration portIdEnum= CommPortIdentifier.getPortIdentifiers();
|
Enumeration<CommPortIdentifier> portIdEnum= CommPortIdentifier.getPortIdentifiers();
|
||||||
while (portIdEnum.hasMoreElements()) {
|
while (portIdEnum.hasMoreElements()) {
|
||||||
CommPortIdentifier identifier = (CommPortIdentifier) portIdEnum.nextElement();
|
CommPortIdentifier identifier = portIdEnum.nextElement();
|
||||||
String strName = identifier.getName();
|
String strName = identifier.getName();
|
||||||
int nPortType = identifier.getPortType();
|
int nPortType = identifier.getPortType();
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ public class SerialProperties {
|
||||||
Collections.sort(fSerialPortTable);
|
Collections.sort(fSerialPortTable);
|
||||||
|
|
||||||
if (!fSerialPortTable.isEmpty()) {
|
if (!fSerialPortTable.isEmpty()) {
|
||||||
fDefaultSerialPort = (String) fSerialPortTable.get(0);
|
fDefaultSerialPort = fSerialPortTable.get(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,8 @@ public class SerialSettings implements ISerialSettings {
|
||||||
protected String fTimeout;
|
protected String fTimeout;
|
||||||
final private SerialProperties fProperties=new SerialProperties();
|
final private SerialProperties fProperties=new SerialProperties();
|
||||||
|
|
||||||
public String getSerialPort() {
|
@Override
|
||||||
|
public String getSerialPort() {
|
||||||
return fSerialPort;
|
return fSerialPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +43,8 @@ public class SerialSettings implements ISerialSettings {
|
||||||
return fBaudRate;
|
return fBaudRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBaudRate() {
|
@Override
|
||||||
|
public int getBaudRate() {
|
||||||
int nBaudRate;
|
int nBaudRate;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -62,7 +64,8 @@ public class SerialSettings implements ISerialSettings {
|
||||||
return fDataBits;
|
return fDataBits;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDataBits() {
|
@Override
|
||||||
|
public int getDataBits() {
|
||||||
if (fDataBits.equals("5")) { //$NON-NLS-1$
|
if (fDataBits.equals("5")) { //$NON-NLS-1$
|
||||||
return SerialPort.DATABITS_5;
|
return SerialPort.DATABITS_5;
|
||||||
} else if (fDataBits.equals("6")) { //$NON-NLS-1$
|
} else if (fDataBits.equals("6")) { //$NON-NLS-1$
|
||||||
|
@ -82,7 +85,8 @@ public class SerialSettings implements ISerialSettings {
|
||||||
return fStopBits;
|
return fStopBits;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getStopBits() {
|
@Override
|
||||||
|
public int getStopBits() {
|
||||||
if (fStopBits.equals("1_5")) { //$NON-NLS-1$
|
if (fStopBits.equals("1_5")) { //$NON-NLS-1$
|
||||||
return SerialPort.STOPBITS_1_5;
|
return SerialPort.STOPBITS_1_5;
|
||||||
} else if (fStopBits.equals("2")) { //$NON-NLS-1$
|
} else if (fStopBits.equals("2")) { //$NON-NLS-1$
|
||||||
|
@ -100,7 +104,8 @@ public class SerialSettings implements ISerialSettings {
|
||||||
return fParity;
|
return fParity;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getParity() {
|
@Override
|
||||||
|
public int getParity() {
|
||||||
if (fParity.equals("Even")) //$NON-NLS-1$
|
if (fParity.equals("Even")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
return SerialPort.PARITY_EVEN;
|
return SerialPort.PARITY_EVEN;
|
||||||
|
@ -127,7 +132,8 @@ public class SerialSettings implements ISerialSettings {
|
||||||
return fFlowControl;
|
return fFlowControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFlowControl() {
|
@Override
|
||||||
|
public int getFlowControl() {
|
||||||
if (fFlowControl.equals("RTS/CTS")) //$NON-NLS-1$
|
if (fFlowControl.equals("RTS/CTS")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
return SerialPort.FLOWCONTROL_RTSCTS_IN;
|
return SerialPort.FLOWCONTROL_RTSCTS_IN;
|
||||||
|
@ -144,7 +150,8 @@ public class SerialSettings implements ISerialSettings {
|
||||||
fFlowControl = strFlow;
|
fFlowControl = strFlow;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSummary() {
|
@Override
|
||||||
|
public String getSummary() {
|
||||||
return getSerialPort() + ", " + //$NON-NLS-1$
|
return getSerialPort() + ", " + //$NON-NLS-1$
|
||||||
getBaudRateString() + ", " + //$NON-NLS-1$
|
getBaudRateString() + ", " + //$NON-NLS-1$
|
||||||
getDataBitsString() + ", " + //$NON-NLS-1$
|
getDataBitsString() + ", " + //$NON-NLS-1$
|
||||||
|
@ -153,7 +160,8 @@ public class SerialSettings implements ISerialSettings {
|
||||||
getFlowControlString();
|
getFlowControlString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load(ISettingsStore store) {
|
@Override
|
||||||
|
public void load(ISettingsStore store) {
|
||||||
fSerialPort = store.get("SerialPort", fProperties.getDefaultSerialPort());//$NON-NLS-1$
|
fSerialPort = store.get("SerialPort", fProperties.getDefaultSerialPort());//$NON-NLS-1$
|
||||||
fBaudRate = store.get("BaudRate", fProperties.getDefaultBaudRate());//$NON-NLS-1$
|
fBaudRate = store.get("BaudRate", fProperties.getDefaultBaudRate());//$NON-NLS-1$
|
||||||
fDataBits = store.get("DataBits", fProperties.getDefaultDataBits());//$NON-NLS-1$
|
fDataBits = store.get("DataBits", fProperties.getDefaultDataBits());//$NON-NLS-1$
|
||||||
|
@ -163,7 +171,8 @@ public class SerialSettings implements ISerialSettings {
|
||||||
fTimeout = store.get("Timeout",fProperties.getDefaultTimeout()); //$NON-NLS-1$
|
fTimeout = store.get("Timeout",fProperties.getDefaultTimeout()); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save(ISettingsStore store) {
|
@Override
|
||||||
|
public void save(ISettingsStore store) {
|
||||||
store.put("SerialPort", fSerialPort); //$NON-NLS-1$
|
store.put("SerialPort", fSerialPort); //$NON-NLS-1$
|
||||||
store.put("BaudRate", fBaudRate); //$NON-NLS-1$
|
store.put("BaudRate", fBaudRate); //$NON-NLS-1$
|
||||||
store.put("DataBits", fDataBits); //$NON-NLS-1$
|
store.put("DataBits", fDataBits); //$NON-NLS-1$
|
||||||
|
@ -176,7 +185,8 @@ public class SerialSettings implements ISerialSettings {
|
||||||
return fProperties;
|
return fProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getTimeout() {
|
@Override
|
||||||
|
public int getTimeout() {
|
||||||
try {
|
try {
|
||||||
return Integer.parseInt(fTimeout);
|
return Integer.parseInt(fTimeout);
|
||||||
} catch (NumberFormatException numberFormatException) {
|
} catch (NumberFormatException numberFormatException) {
|
||||||
|
|
|
@ -132,7 +132,8 @@ protected Control createDialogArea(Composite parent) {
|
||||||
*
|
*
|
||||||
* @param parent the parent of the widgets
|
* @param parent the parent of the widgets
|
||||||
*/
|
*/
|
||||||
protected void createPasswordFields(Composite parent) {
|
@SuppressWarnings("unused")
|
||||||
|
protected void createPasswordFields(Composite parent) {
|
||||||
texts=new Text[prompt.length];
|
texts=new Text[prompt.length];
|
||||||
|
|
||||||
for(int i=0; i<prompt.length; i++){
|
for(int i=0; i<prompt.length; i++){
|
||||||
|
|
|
@ -50,7 +50,7 @@ import com.jcraft.jsch.UserInfo;
|
||||||
|
|
||||||
public class SshConnection extends Thread {
|
public class SshConnection extends Thread {
|
||||||
private static int fgNo;
|
private static int fgNo;
|
||||||
private final ITerminalControl fControl;
|
/* default */ final ITerminalControl fControl;
|
||||||
private final SshConnector fConn;
|
private final SshConnector fConn;
|
||||||
private Session fSession;
|
private Session fSession;
|
||||||
private boolean fDisconnectHasBeenCalled;
|
private boolean fDisconnectHasBeenCalled;
|
||||||
|
@ -192,7 +192,7 @@ public class SshConnection extends Thread {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized boolean isSessionConnected() {
|
/* default */ synchronized boolean isSessionConnected() {
|
||||||
return !fDisconnectHasBeenCalled && fSession != null && fSession.isConnected();
|
return !fDisconnectHasBeenCalled && fSession != null && fSession.isConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,8 +238,8 @@ public class SshConnection extends Thread {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MyUserInfo implements UserInfo, UIKeyboardInteractive {
|
private class MyUserInfo implements UserInfo, UIKeyboardInteractive {
|
||||||
private final String fConnectionId;
|
/* default */ final String fConnectionId;
|
||||||
private final String fUser;
|
/* default */ final String fUser;
|
||||||
private String fPassword;
|
private String fPassword;
|
||||||
private String fPassphrase;
|
private String fPassphrase;
|
||||||
private int fAttemptCount;
|
private int fAttemptCount;
|
||||||
|
|
|
@ -43,7 +43,6 @@ import org.eclipse.tm.terminal.view.ui.panels.AbstractExtendedConfigurationPanel
|
||||||
/**
|
/**
|
||||||
* SSH wizard configuration panel implementation.
|
* SSH wizard configuration panel implementation.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("restriction")
|
|
||||||
public class SshWizardConfigurationPanel extends AbstractExtendedConfigurationPanel {
|
public class SshWizardConfigurationPanel extends AbstractExtendedConfigurationPanel {
|
||||||
|
|
||||||
private static final String SAVE_USER = "saveUser"; //$NON-NLS-1$
|
private static final String SAVE_USER = "saveUser"; //$NON-NLS-1$
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class SshLauncherDelegate extends AbstractLauncherDelegate {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
|
* @see org.eclipse.core.runtime.PlatformObject#getAdapter(java.lang.Class)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Object getAdapter(Class adapter) {
|
public Object getAdapter(Class adapter) {
|
||||||
if (IMementoHandler.class.equals(adapter)) {
|
if (IMementoHandler.class.equals(adapter)) {
|
||||||
return mementoHandler;
|
return mementoHandler;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
* Helmut Haigermoser and Ted Williams.
|
* Helmut Haigermoser and Ted Williams.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Michael Scharf (Wind River) - extracted from TerminalNetworkPortMap
|
* Michael Scharf (Wind River) - extracted from TerminalNetworkPortMap
|
||||||
* 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;
|
||||||
|
@ -52,8 +52,8 @@ public class NetworkPortMap {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getNameTable() {
|
public List<String> getNameTable() {
|
||||||
List names=new ArrayList();
|
List<String> names=new ArrayList<String>();
|
||||||
for (int i = 0; i < fPortMap.length; i++) {
|
for (int i = 0; i < fPortMap.length; i++) {
|
||||||
names.add(fPortMap[i][0]);
|
names.add(fPortMap[i][0]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,8 @@ class TelnetConnectWorker extends Thread {
|
||||||
fConn = conn;
|
fConn = conn;
|
||||||
fControl.setState(TerminalState.CONNECTING);
|
fControl.setState(TerminalState.CONNECTING);
|
||||||
}
|
}
|
||||||
public void run() {
|
@Override
|
||||||
|
public void run() {
|
||||||
// Retry the connect with after a little pause in case the
|
// Retry the connect with after a little pause in case the
|
||||||
// remote telnet server isn't ready. ConnectExceptions might
|
// remote telnet server isn't ready. ConnectExceptions might
|
||||||
// happen if the telnet server process did not initialized itself.
|
// happen if the telnet server process did not initialized itself.
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
* Michael Scharf (Wind River) - [209665] Add ability to log byte streams from terminal
|
* Michael Scharf (Wind River) - [209665] Add ability to log byte streams from terminal
|
||||||
* Alex Panchenko (Xored) - [277061] TelnetConnection.isConnected() should check if socket was not closed
|
* Alex Panchenko (Xored) - [277061] TelnetConnection.isConnected() should check if socket was not closed
|
||||||
* Uwe Stieber (Wind River) - [281329] Telnet connection not handling "SocketException: Connection reset" correct
|
* Uwe Stieber (Wind River) - [281329] Telnet connection not handling "SocketException: Connection reset" correct
|
||||||
* Nils Hagge (Siemens AG) - [276023] close socket streams after connection is disconnected
|
* Nils Hagge (Siemens AG) - [276023] close socket streams after connection is disconnected
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.tm.terminal.connector.telnet.connector;
|
package org.eclipse.tm.terminal.connector.telnet.connector;
|
||||||
|
|
||||||
|
@ -294,7 +294,8 @@ public class TelnetConnection extends Thread implements TelnetCodes {
|
||||||
* them), and passes the remaining bytes to a TerminalDisplay object for
|
* them), and passes the remaining bytes to a TerminalDisplay object for
|
||||||
* display.
|
* display.
|
||||||
*/
|
*/
|
||||||
public void run() {
|
@Override
|
||||||
|
public void run() {
|
||||||
Logger.log("Entered"); //$NON-NLS-1$
|
Logger.log("Entered"); //$NON-NLS-1$
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -314,16 +315,16 @@ public class TelnetConnection extends Thread implements TelnetCodes {
|
||||||
// closed.
|
// closed.
|
||||||
terminalControl.setState(TerminalState.CLOSED);
|
terminalControl.setState(TerminalState.CLOSED);
|
||||||
break;
|
break;
|
||||||
} else {
|
}
|
||||||
// Process any TELNET protocol data that we receive. Don't
|
|
||||||
// send any TELNET protocol data until we are sure the remote
|
|
||||||
// endpoint is a TELNET server.
|
|
||||||
|
|
||||||
int nProcessedBytes = processTelnetProtocol(nRawBytes);
|
// Process any TELNET protocol data that we receive. Don't
|
||||||
|
// send any TELNET protocol data until we are sure the remote
|
||||||
|
// endpoint is a TELNET server.
|
||||||
|
|
||||||
if (nProcessedBytes > 0) {
|
int nProcessedBytes = processTelnetProtocol(nRawBytes);
|
||||||
terminalControl.getRemoteToTerminalOutputStream().write(processedBytes, 0, nProcessedBytes);
|
|
||||||
}
|
if (nProcessedBytes > 0) {
|
||||||
|
terminalControl.getRemoteToTerminalOutputStream().write(processedBytes, 0, nProcessedBytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SocketException ex) {
|
} catch (SocketException ex) {
|
||||||
|
|
|
@ -590,7 +590,8 @@ class TelnetOption implements TelnetCodes
|
||||||
// is _bad_ (it hangs the GUI).
|
// is _bad_ (it hangs the GUI).
|
||||||
|
|
||||||
Thread t=new Thread() {
|
Thread t=new Thread() {
|
||||||
public void run() {
|
@Override
|
||||||
|
public void run() {
|
||||||
try {
|
try {
|
||||||
outputStream.write(NAWSDataFinal);
|
outputStream.write(NAWSDataFinal);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
|
|
|
@ -23,7 +23,8 @@ public class TelnetSettings implements ITelnetSettings {
|
||||||
protected String fNetworkPort;
|
protected String fNetworkPort;
|
||||||
protected String fTimeout;
|
protected String fTimeout;
|
||||||
private final TelnetProperties fProperties=new TelnetProperties();
|
private final TelnetProperties fProperties=new TelnetProperties();
|
||||||
public String getHost() {
|
@Override
|
||||||
|
public String getHost() {
|
||||||
return fHost;
|
return fHost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +36,8 @@ public class TelnetSettings implements ITelnetSettings {
|
||||||
return fNetworkPort;
|
return fNetworkPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getNetworkPort() {
|
@Override
|
||||||
|
public int getNetworkPort() {
|
||||||
try {
|
try {
|
||||||
return Integer.parseInt(fNetworkPort);
|
return Integer.parseInt(fNetworkPort);
|
||||||
} catch (NumberFormatException numberFormatException) {
|
} catch (NumberFormatException numberFormatException) {
|
||||||
|
@ -47,17 +49,20 @@ public class TelnetSettings implements ITelnetSettings {
|
||||||
fNetworkPort = strNetworkPort;
|
fNetworkPort = strNetworkPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSummary() {
|
@Override
|
||||||
|
public String getSummary() {
|
||||||
return getHost() + ":" + getNetworkPortString(); //$NON-NLS-1$
|
return getHost() + ":" + getNetworkPortString(); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load(ISettingsStore store) {
|
@Override
|
||||||
|
public void load(ISettingsStore store) {
|
||||||
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$
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save(ISettingsStore store) {
|
@Override
|
||||||
|
public void save(ISettingsStore store) {
|
||||||
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$
|
||||||
|
@ -66,7 +71,8 @@ public class TelnetSettings implements ITelnetSettings {
|
||||||
public TelnetProperties getProperties() {
|
public TelnetProperties getProperties() {
|
||||||
return fProperties;
|
return fProperties;
|
||||||
}
|
}
|
||||||
public int getTimeout() {
|
@Override
|
||||||
|
public int getTimeout() {
|
||||||
try {
|
try {
|
||||||
return Integer.parseInt(fTimeout);
|
return Integer.parseInt(fTimeout);
|
||||||
} catch (NumberFormatException numberFormatException) {
|
} catch (NumberFormatException numberFormatException) {
|
||||||
|
|
|
@ -38,21 +38,23 @@ import org.eclipse.swt.widgets.Text;
|
||||||
import org.eclipse.tm.internal.terminal.provisional.api.AbstractSettingsPage;
|
import org.eclipse.tm.internal.terminal.provisional.api.AbstractSettingsPage;
|
||||||
|
|
||||||
public class TelnetSettingsPage extends AbstractSettingsPage {
|
public class TelnetSettingsPage extends AbstractSettingsPage {
|
||||||
private Text fHostText;
|
/* default */ Text fHostText;
|
||||||
private Combo fNetworkPortCombo;
|
/* default */ Combo fNetworkPortCombo;
|
||||||
private Text fTimeout;
|
/* default */ Text fTimeout;
|
||||||
private final TelnetSettings fTerminalSettings;
|
private final TelnetSettings fTerminalSettings;
|
||||||
|
|
||||||
public TelnetSettingsPage(TelnetSettings settings) {
|
public TelnetSettingsPage(TelnetSettings settings) {
|
||||||
fTerminalSettings=settings;
|
fTerminalSettings=settings;
|
||||||
}
|
}
|
||||||
public void saveSettings() {
|
@Override
|
||||||
|
public void saveSettings() {
|
||||||
fTerminalSettings.setHost(fHostText.getText());
|
fTerminalSettings.setHost(fHostText.getText());
|
||||||
fTerminalSettings.setTimeout(fTimeout.getText());
|
fTerminalSettings.setTimeout(fTimeout.getText());
|
||||||
fTerminalSettings.setNetworkPort(getNetworkPort());
|
fTerminalSettings.setNetworkPort(getNetworkPort());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadSettings() {
|
@Override
|
||||||
|
public void loadSettings() {
|
||||||
if(fTerminalSettings!=null) {
|
if(fTerminalSettings!=null) {
|
||||||
setHost(fTerminalSettings.getHost());
|
setHost(fTerminalSettings.getHost());
|
||||||
setTimeout(fTerminalSettings.getTimeoutString());
|
setTimeout(fTerminalSettings.getTimeoutString());
|
||||||
|
@ -95,7 +97,8 @@ public class TelnetSettingsPage extends AbstractSettingsPage {
|
||||||
return fTerminalSettings.getProperties().getNetworkPortMap();
|
return fTerminalSettings.getProperties().getNetworkPortMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean validateSettings() {
|
@Override
|
||||||
|
public boolean validateSettings() {
|
||||||
String message = null;
|
String message = null;
|
||||||
int messageType = IMessageProvider.NONE;
|
int messageType = IMessageProvider.NONE;
|
||||||
boolean valid = true;
|
boolean valid = true;
|
||||||
|
@ -144,7 +147,8 @@ public class TelnetSettingsPage extends AbstractSettingsPage {
|
||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createControl(Composite parent) {
|
@Override
|
||||||
|
public void createControl(Composite parent) {
|
||||||
Composite composite = new Composite(parent, SWT.NONE);
|
Composite composite = new Composite(parent, SWT.NONE);
|
||||||
GridLayout gridLayout = new GridLayout(2, false);
|
GridLayout gridLayout = new GridLayout(2, false);
|
||||||
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
|
GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
|
||||||
|
@ -162,7 +166,8 @@ public class TelnetSettingsPage extends AbstractSettingsPage {
|
||||||
fHostText = new Text(composite, SWT.BORDER);
|
fHostText = new Text(composite, SWT.BORDER);
|
||||||
fHostText.setLayoutData(gridData);
|
fHostText.setLayoutData(gridData);
|
||||||
fHostText.addModifyListener(new ModifyListener() {
|
fHostText.addModifyListener(new ModifyListener() {
|
||||||
public void modifyText(ModifyEvent e) {
|
@Override
|
||||||
|
public void modifyText(ModifyEvent e) {
|
||||||
fireListeners(fHostText);
|
fireListeners(fHostText);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -177,18 +182,20 @@ public class TelnetSettingsPage extends AbstractSettingsPage {
|
||||||
fNetworkPortCombo = new Combo(composite, SWT.DROP_DOWN);
|
fNetworkPortCombo = new Combo(composite, SWT.DROP_DOWN);
|
||||||
fNetworkPortCombo.setLayoutData(gridData);
|
fNetworkPortCombo.setLayoutData(gridData);
|
||||||
fNetworkPortCombo.addModifyListener(new ModifyListener() {
|
fNetworkPortCombo.addModifyListener(new ModifyListener() {
|
||||||
public void modifyText(ModifyEvent e) {
|
@Override
|
||||||
|
public void modifyText(ModifyEvent e) {
|
||||||
fireListeners(fNetworkPortCombo);
|
fireListeners(fNetworkPortCombo);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
fNetworkPortCombo.addSelectionListener(new SelectionAdapter() {
|
fNetworkPortCombo.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
fireListeners(fNetworkPortCombo);
|
fireListeners(fNetworkPortCombo);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
createControlDecoration(fNetworkPortCombo);
|
createControlDecoration(fNetworkPortCombo);
|
||||||
|
|
||||||
List table = getNetworkPortMap().getNameTable();
|
List<String> table = getNetworkPortMap().getNameTable();
|
||||||
Collections.sort(table);
|
Collections.sort(table);
|
||||||
loadCombo(fNetworkPortCombo, table);
|
loadCombo(fNetworkPortCombo, table);
|
||||||
|
|
||||||
|
@ -196,7 +203,8 @@ public class TelnetSettingsPage extends AbstractSettingsPage {
|
||||||
fTimeout = new Text(composite, SWT.BORDER);
|
fTimeout = new Text(composite, SWT.BORDER);
|
||||||
fTimeout.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
fTimeout.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||||
fTimeout.addModifyListener(new ModifyListener() {
|
fTimeout.addModifyListener(new ModifyListener() {
|
||||||
public void modifyText(ModifyEvent e) {
|
@Override
|
||||||
|
public void modifyText(ModifyEvent e) {
|
||||||
fireListeners(fTimeout);
|
fireListeners(fTimeout);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -204,9 +212,9 @@ public class TelnetSettingsPage extends AbstractSettingsPage {
|
||||||
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
}
|
}
|
||||||
private void loadCombo(Combo ctlCombo, List table) {
|
private void loadCombo(Combo ctlCombo, List<String> table) {
|
||||||
for (Iterator iter = table.iterator(); iter.hasNext();) {
|
for (Iterator<String> iter = table.iterator(); iter.hasNext();) {
|
||||||
String label = (String) iter.next();
|
String label = iter.next();
|
||||||
ctlCombo.add(label);
|
ctlCombo.add(label);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue