mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-02 05:45:58 +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;
|
||||||
|
|
|
@ -18,18 +18,18 @@ 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,6 +30,7 @@ public class SerialSettings implements ISerialSettings {
|
||||||
protected String fTimeout;
|
protected String fTimeout;
|
||||||
final private SerialProperties fProperties=new SerialProperties();
|
final private SerialProperties fProperties=new SerialProperties();
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getSerialPort() {
|
public String getSerialPort() {
|
||||||
return fSerialPort;
|
return fSerialPort;
|
||||||
}
|
}
|
||||||
|
@ -42,6 +43,7 @@ public class SerialSettings implements ISerialSettings {
|
||||||
return fBaudRate;
|
return fBaudRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getBaudRate() {
|
public int getBaudRate() {
|
||||||
int nBaudRate;
|
int nBaudRate;
|
||||||
|
|
||||||
|
@ -62,6 +64,7 @@ public class SerialSettings implements ISerialSettings {
|
||||||
return fDataBits;
|
return fDataBits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getDataBits() {
|
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;
|
||||||
|
@ -82,6 +85,7 @@ public class SerialSettings implements ISerialSettings {
|
||||||
return fStopBits;
|
return fStopBits;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getStopBits() {
|
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;
|
||||||
|
@ -100,6 +104,7 @@ public class SerialSettings implements ISerialSettings {
|
||||||
return fParity;
|
return fParity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getParity() {
|
public int getParity() {
|
||||||
if (fParity.equals("Even")) //$NON-NLS-1$
|
if (fParity.equals("Even")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
|
@ -127,6 +132,7 @@ public class SerialSettings implements ISerialSettings {
|
||||||
return fFlowControl;
|
return fFlowControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getFlowControl() {
|
public int getFlowControl() {
|
||||||
if (fFlowControl.equals("RTS/CTS")) //$NON-NLS-1$
|
if (fFlowControl.equals("RTS/CTS")) //$NON-NLS-1$
|
||||||
{
|
{
|
||||||
|
@ -144,6 +150,7 @@ public class SerialSettings implements ISerialSettings {
|
||||||
fFlowControl = strFlow;
|
fFlowControl = strFlow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getSummary() {
|
public String getSummary() {
|
||||||
return getSerialPort() + ", " + //$NON-NLS-1$
|
return getSerialPort() + ", " + //$NON-NLS-1$
|
||||||
getBaudRateString() + ", " + //$NON-NLS-1$
|
getBaudRateString() + ", " + //$NON-NLS-1$
|
||||||
|
@ -153,6 +160,7 @@ public class SerialSettings implements ISerialSettings {
|
||||||
getFlowControlString();
|
getFlowControlString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void load(ISettingsStore store) {
|
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$
|
||||||
|
@ -163,6 +171,7 @@ public class SerialSettings implements ISerialSettings {
|
||||||
fTimeout = store.get("Timeout",fProperties.getDefaultTimeout()); //$NON-NLS-1$
|
fTimeout = store.get("Timeout",fProperties.getDefaultTimeout()); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void save(ISettingsStore store) {
|
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$
|
||||||
|
@ -176,6 +185,7 @@ public class SerialSettings implements ISerialSettings {
|
||||||
return fProperties;
|
return fProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getTimeout() {
|
public int getTimeout() {
|
||||||
try {
|
try {
|
||||||
return Integer.parseInt(fTimeout);
|
return Integer.parseInt(fTimeout);
|
||||||
|
|
|
@ -132,6 +132,7 @@ protected Control createDialogArea(Composite parent) {
|
||||||
*
|
*
|
||||||
* @param parent the parent of the widgets
|
* @param parent the parent of the widgets
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("unused")
|
||||||
protected void createPasswordFields(Composite parent) {
|
protected void createPasswordFields(Composite parent) {
|
||||||
texts=new Text[prompt.length];
|
texts=new Text[prompt.length];
|
||||||
|
|
||||||
|
|
|
@ -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$
|
||||||
|
|
|
@ -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,6 +35,7 @@ class TelnetConnectWorker extends Thread {
|
||||||
fConn = conn;
|
fConn = conn;
|
||||||
fControl.setState(TerminalState.CONNECTING);
|
fControl.setState(TerminalState.CONNECTING);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void run() {
|
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
|
||||||
|
|
|
@ -294,6 +294,7 @@ 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.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Logger.log("Entered"); //$NON-NLS-1$
|
Logger.log("Entered"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -314,7 +315,8 @@ 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
|
// Process any TELNET protocol data that we receive. Don't
|
||||||
// send any TELNET protocol data until we are sure the remote
|
// send any TELNET protocol data until we are sure the remote
|
||||||
// endpoint is a TELNET server.
|
// endpoint is a TELNET server.
|
||||||
|
@ -325,7 +327,6 @@ public class TelnetConnection extends Thread implements TelnetCodes {
|
||||||
terminalControl.getRemoteToTerminalOutputStream().write(processedBytes, 0, nProcessedBytes);
|
terminalControl.getRemoteToTerminalOutputStream().write(processedBytes, 0, nProcessedBytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} catch (SocketException ex) {
|
} catch (SocketException ex) {
|
||||||
String message = ex.getMessage();
|
String message = ex.getMessage();
|
||||||
|
|
||||||
|
|
|
@ -590,6 +590,7 @@ class TelnetOption implements TelnetCodes
|
||||||
// is _bad_ (it hangs the GUI).
|
// is _bad_ (it hangs the GUI).
|
||||||
|
|
||||||
Thread t=new Thread() {
|
Thread t=new Thread() {
|
||||||
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
outputStream.write(NAWSDataFinal);
|
outputStream.write(NAWSDataFinal);
|
||||||
|
|
|
@ -23,6 +23,7 @@ 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();
|
||||||
|
@Override
|
||||||
public String getHost() {
|
public String getHost() {
|
||||||
return fHost;
|
return fHost;
|
||||||
}
|
}
|
||||||
|
@ -35,6 +36,7 @@ public class TelnetSettings implements ITelnetSettings {
|
||||||
return fNetworkPort;
|
return fNetworkPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getNetworkPort() {
|
public int getNetworkPort() {
|
||||||
try {
|
try {
|
||||||
return Integer.parseInt(fNetworkPort);
|
return Integer.parseInt(fNetworkPort);
|
||||||
|
@ -47,16 +49,19 @@ public class TelnetSettings implements ITelnetSettings {
|
||||||
fNetworkPort = strNetworkPort;
|
fNetworkPort = strNetworkPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getSummary() {
|
public String getSummary() {
|
||||||
return getHost() + ":" + getNetworkPortString(); //$NON-NLS-1$
|
return getHost() + ":" + getNetworkPortString(); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void load(ISettingsStore store) {
|
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$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void save(ISettingsStore store) {
|
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$
|
||||||
|
@ -66,6 +71,7 @@ public class TelnetSettings implements ITelnetSettings {
|
||||||
public TelnetProperties getProperties() {
|
public TelnetProperties getProperties() {
|
||||||
return fProperties;
|
return fProperties;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public int getTimeout() {
|
public int getTimeout() {
|
||||||
try {
|
try {
|
||||||
return Integer.parseInt(fTimeout);
|
return Integer.parseInt(fTimeout);
|
||||||
|
|
|
@ -38,20 +38,22 @@ 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;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
public void saveSettings() {
|
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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void loadSettings() {
|
public void loadSettings() {
|
||||||
if(fTerminalSettings!=null) {
|
if(fTerminalSettings!=null) {
|
||||||
setHost(fTerminalSettings.getHost());
|
setHost(fTerminalSettings.getHost());
|
||||||
|
@ -95,6 +97,7 @@ public class TelnetSettingsPage extends AbstractSettingsPage {
|
||||||
return fTerminalSettings.getProperties().getNetworkPortMap();
|
return fTerminalSettings.getProperties().getNetworkPortMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean validateSettings() {
|
public boolean validateSettings() {
|
||||||
String message = null;
|
String message = null;
|
||||||
int messageType = IMessageProvider.NONE;
|
int messageType = IMessageProvider.NONE;
|
||||||
|
@ -144,6 +147,7 @@ public class TelnetSettingsPage extends AbstractSettingsPage {
|
||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void createControl(Composite parent) {
|
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);
|
||||||
|
@ -162,6 +166,7 @@ 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() {
|
||||||
|
@Override
|
||||||
public void modifyText(ModifyEvent e) {
|
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() {
|
||||||
|
@Override
|
||||||
public void modifyText(ModifyEvent e) {
|
public void modifyText(ModifyEvent e) {
|
||||||
fireListeners(fNetworkPortCombo);
|
fireListeners(fNetworkPortCombo);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
fNetworkPortCombo.addSelectionListener(new SelectionAdapter() {
|
fNetworkPortCombo.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
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,6 +203,7 @@ 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() {
|
||||||
|
@Override
|
||||||
public void modifyText(ModifyEvent e) {
|
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