Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,18 @@ public String getDefaultNetworkPort() {

public String findPortName(String strPort) {
for (int i = 0; i < fPortMap.length; i++) {
if (fPortMap[i][1].equals(strPort))
if (fPortMap[i][1].equals(strPort)) {
return fPortMap[i][0];
}
}
return null;
}

public String findPort(String strPortName) {
for (int i = 0; i < fPortMap.length; i++) {
if (fPortMap[i][0].equals(strPortName))
if (fPortMap[i][0].equals(strPortName)) {
return fPortMap[i][1];
}
}
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ public void run() {

while (remaining >= 0) {
// Pause before we re-try if the remaining tries are less than the initial value
if (remaining < 10)
if (remaining < 10) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
/* ignored on purpose */ }
}

try {
int nTimeout = fConn.getTelnetSettings().getTimeout() * 1000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,14 @@ public boolean isRemoteTelnetServer() {
*/
public void setTerminalSize(int newWidth, int newHeight) {
Logger.log("Setting new size: width = " + newWidth + ", height = " + newHeight); //$NON-NLS-1$ //$NON-NLS-2$
if (!isConnected() || !isRemoteTelnetServer())
if (!isConnected() || !isRemoteTelnetServer()) {
return;
}
boolean sizeChanged = false;

if (newWidth != width || newHeight != height)
if (newWidth != width || newHeight != height) {
sizeChanged = true;
}

width = newWidth;
height = newHeight;
Expand Down Expand Up @@ -543,8 +545,9 @@ protected int processTelnetProtocol(int count) {

// First, zero out the array of received subnegotiation butes.

for (int i = 0; i < receivedSubnegotiation.length; ++i)
for (int i = 0; i < receivedSubnegotiation.length; ++i) {
receivedSubnegotiation[i] = 0;
}

// Forget about any previous subnegotiation errors.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,20 @@ static final class TelnetOutputStream extends FilterOutputStream {

public TelnetOutputStream(OutputStream outputStream, String endOfLine) {
super(outputStream);
if (ITelnetSettings.EOL_CRLF.equals(endOfLine))
if (ITelnetSettings.EOL_CRLF.equals(endOfLine)) {
EOL = CRLF;
else
} else {
EOL = CRNUL;
}
}

@Override
public void write(int b) throws IOException {
if (b == CR)
if (b == CR) {
out.write(EOL);
else
} else {
out.write(b);
}
}
}

Expand Down Expand Up @@ -119,8 +121,9 @@ public void doDisconnect() {

@Override
public boolean isLocalEcho() {
if (fTelnetConnection == null)
if (fTelnetConnection == null) {
return false;
}
return fTelnetConnection.localEcho();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,10 @@ public boolean isDesired() {
* we desire this option to be disabled.
*/
public void setDesired(boolean newValue) {
if (newValue)
if (newValue) {
Logger.log("Setting " + (local ? "local" : "remote") + " option " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
optionName() + " as desired."); //$NON-NLS-1$
}

desired = newValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,17 @@ public void loadSettings() {
}

private void setHost(String strHost) {
if (strHost == null)
if (strHost == null) {
strHost = ""; //$NON-NLS-1$
}
fHostText.setText(strHost);

}

private void setTimeout(String timeout) {
if (timeout == null || timeout.length() == 0)
if (timeout == null || timeout.length() == 0) {
timeout = "5"; //$NON-NLS-1$
}
fTimeout.setText(timeout);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ public void setupPanel(Composite parent) {
panel.setLayoutData(data);

// Create the host selection combo
if (isWithoutSelection())
if (isWithoutSelection()) {
createHostsUI(panel, true);
}

TelnetConnector conn = new TelnetConnector();
telnetSettings = (TelnetSettings) conn.getTelnetSettings();
Expand All @@ -72,8 +73,9 @@ public void setupPanel(Composite parent) {

// Add the listener to the settings page
telnetSettingsPage.addListener(control -> {
if (getContainer() != null)
if (getContainer() != null) {
getContainer().validate();
}
});

// Create the encoding selection combo
Expand All @@ -84,39 +86,46 @@ public void setupPanel(Composite parent) {

@Override
public void setupData(Map<String, Object> data) {
if (data == null || telnetSettings == null || telnetSettingsPage == null)
if (data == null || telnetSettings == null || telnetSettingsPage == null) {
return;
}

String value = (String) data.get(ITerminalsConnectorConstants.PROP_IP_HOST);
if (value != null)
if (value != null) {
telnetSettings.setHost(value);
}

Object v = data.get(ITerminalsConnectorConstants.PROP_IP_PORT);
value = v != null ? v.toString() : null;
if (value != null)
if (value != null) {
telnetSettings.setNetworkPort(value);
}

v = data.get(ITerminalsConnectorConstants.PROP_TIMEOUT);
value = v != null ? v.toString() : null;
if (value != null)
if (value != null) {
telnetSettings.setTimeout(value);
}

v = data.get(ITerminalsConnectorConstants.PROP_TELNET_EOL);
value = v != null ? v.toString() : null;
if (value != null)
if (value != null) {
telnetSettings.setEndOfLine(value);
}

value = (String) data.get(ITerminalsConnectorConstants.PROP_ENCODING);
if (value != null)
if (value != null) {
setEncoding(value);
}

telnetSettingsPage.loadSettings();
}

@Override
public void extractData(Map<String, Object> data) {
if (data == null)
if (data == null) {
return;
}

// set the terminal connector id for ssh
data.put(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ public void execute(Map<String, Object> properties, ITerminalService.Done done)
private String getTerminalTitle(Map<String, Object> properties) {
// Try to see if the user set a title explicitly via the properties map.
String title = getDefaultTerminalTitle(properties);
if (title != null)
if (title != null) {
return title;
}

//No title,try to calculate the title
String host = (String) properties.get(ITerminalsConnectorConstants.PROP_IP_HOST);
Expand Down Expand Up @@ -114,8 +115,9 @@ public ITerminalConnector createTerminalConnector(Map<String, Object> properties

// Check for the terminal connector id
String connectorId = (String) properties.get(ITerminalsConnectorConstants.PROP_TERMINAL_CONNECTOR_ID);
if (connectorId == null)
if (connectorId == null) {
connectorId = "org.eclipse.terminal.connector.telnet.TelnetConnector"; //$NON-NLS-1$
}

// Extract the telnet properties
String host = (String) properties.get(ITerminalsConnectorConstants.PROP_IP_HOST);
Expand All @@ -128,8 +130,9 @@ public ITerminalConnector createTerminalConnector(Map<String, Object> properties
int portOffset = 0;
if (properties.get(ITerminalsConnectorConstants.PROP_IP_PORT_OFFSET) instanceof Integer) {
portOffset = ((Integer) properties.get(ITerminalsConnectorConstants.PROP_IP_PORT_OFFSET)).intValue();
if (portOffset < 0)
if (portOffset < 0) {
portOffset = 0;
}
}

// The real port to connect to is port + portOffset
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public void saveState(IMemento memento, Map<String, Object> properties) {
(String) properties.get(ITerminalsConnectorConstants.PROP_IP_HOST));
Object value = properties.get(ITerminalsConnectorConstants.PROP_IP_PORT);
memento.putInteger(ITerminalsConnectorConstants.PROP_IP_PORT,
value instanceof Integer ? ((Integer) value).intValue() : -1);
value instanceof Integer i ? i.intValue() : -1);
value = properties.get(ITerminalsConnectorConstants.PROP_TIMEOUT);
memento.putInteger(ITerminalsConnectorConstants.PROP_TIMEOUT,
value instanceof Integer ? ((Integer) value).intValue() : -1);
value instanceof Integer i ? i.intValue() : -1);
memento.putString(ITerminalsConnectorConstants.PROP_ENCODING,
(String) properties.get(ITerminalsConnectorConstants.PROP_ENCODING));
}
Expand Down
Loading