1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 02:36:01 +02:00

Cleanup some Jsch files

Source->Cleanup for files changed by child commit.

Change-Id: I787b623fc0832df3bf98cc1b89edc69f461235e2
This commit is contained in:
Roland Schulz 2014-10-02 19:39:02 -04:00 committed by John Eblen
parent d83bd777dc
commit 5ee4fa818a
6 changed files with 115 additions and 105 deletions

View file

@ -193,7 +193,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#addConnectionChangeListener
* (org.eclipse.remote.core.IRemoteConnectionChangeListener)
*/
@ -245,7 +245,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#close()
*/
@Override
@ -267,7 +267,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/
@Override
@ -277,7 +277,7 @@ public class JSchConnection implements IRemoteConnection {
/**
* Execute the command and return the result as a string.
*
*
* @param cmd
* command to execute
* @param monitor
@ -293,7 +293,7 @@ public class JSchConnection implements IRemoteConnection {
/**
* Notify all fListeners when this connection's status changes.
*
*
* @param event
*/
@Override
@ -317,7 +317,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#forwardLocalPort(int, java.lang.String, int)
*/
@Override
@ -334,7 +334,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#forwardLocalPort(java.lang .String, int,
* org.eclipse.core.runtime.IProgressMonitor)
*/
@ -370,7 +370,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#forwardRemotePort(int, java.lang.String, int)
*/
@Override
@ -387,7 +387,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#forwardRemotePort(java. lang.String, int,
* org.eclipse.core.runtime.IProgressMonitor)
*/
@ -422,7 +422,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#getAddress()
*/
@Override
@ -432,7 +432,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#getAttributes()
*/
@Override
@ -442,7 +442,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteServices#getCommandShell(int)
*/
@Override
@ -452,7 +452,7 @@ public class JSchConnection implements IRemoteConnection {
/**
* Get the result of executing a pwd command.
*
*
* @return current working directory
*/
private String getCwd(IProgressMonitor monitor) {
@ -467,7 +467,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#getEnv()
*/
@Override
@ -477,7 +477,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#getEnv(java.lang.String)
*/
@Override
@ -487,9 +487,9 @@ public class JSchConnection implements IRemoteConnection {
/**
* Open an exec channel to the remote host.
*
*
* @return exec channel or null if the progress monitor was cancelled
*
*
* @throws RemoteConnectionException
* if a channel could not be opened
*/
@ -503,7 +503,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteServices#getFileManager()
*/
@Override
@ -525,7 +525,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#getName()
*/
@Override
@ -543,7 +543,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#getPort()
*/
@Override
@ -553,7 +553,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteServices#getProcessBuilder(java.util.List)
*/
@Override
@ -563,7 +563,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteServices#getProcessBuilder(java.lang.String[])
*/
@Override
@ -573,7 +573,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#getProperty(java.lang.String )
*/
@Override
@ -583,7 +583,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#getRemoteServices()
*/
@Override
@ -593,7 +593,7 @@ public class JSchConnection implements IRemoteConnection {
/**
* Open an sftp channel to the remote host. Always use the second session if available.
*
*
* @return sftp channel or null if the progress monitor was cancelled
* @throws RemoteConnectionException
* if a channel could not be opened
@ -618,7 +618,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#getUsername()
*/
@Override
@ -628,7 +628,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#getWorkingCopy()
*/
@Override
@ -638,7 +638,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#getWorkingDirectory()
*/
@Override
@ -654,7 +654,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#isOpen()
*/
@Override
@ -688,9 +688,9 @@ public class JSchConnection implements IRemoteConnection {
}
/**
*
*
* Load the following hard-coded properties at runtime:
*
*
* <dl>
* <dt>file.separator
* <dd>File separator character of the (remote) connection. Hardcoded "/" (forward slash).
@ -735,7 +735,7 @@ public class JSchConnection implements IRemoteConnection {
* <li>For everything else - "unknown"</li>
* </ul>
* <dl>
*
*
*/
private void loadProperties(IProgressMonitor monitor) throws RemoteConnectionException {
SubMonitor subMon = SubMonitor.convert(monitor, 100);
@ -805,7 +805,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#open()
*/
@Override
@ -817,8 +817,8 @@ public class JSchConnection implements IRemoteConnection {
if (subMon.isCanceled()) {
throw new RemoteConnectionException(Messages.JSchConnection_Connection_was_cancelled);
}
//getCwd checks the exec channel before checkConfiguration checks the sftp channel
fWorkingDir = getCwd(subMon.newChild(10));
// getCwd checks the exec channel before checkConfiguration checks the sftp channel
fWorkingDir = getCwd(subMon.newChild(10));
if (!checkConfiguration(session, subMon.newChild(20))) {
newSession(fManager.getUserAuthenticator(this), subMon.newChild(10));
loadEnv(subMon.newChild(10));
@ -840,7 +840,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#removeConnectionChangeListener
* (org.eclipse.remote.core.IRemoteConnectionChangeListener)
*/
@ -851,7 +851,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#removeLocalPortForwarding(int)
*/
@Override
@ -868,7 +868,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#removeRemotePortForwarding(int)
*/
@Override
@ -885,7 +885,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#setWorkingDirectory(java.lang.String)
*/
@Override
@ -897,7 +897,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#supportsTCPPortForwarding()
*/
@Override
@ -907,7 +907,7 @@ public class JSchConnection implements IRemoteConnection {
/*
* (non-Javadoc)
*
*
* @see java.lang.Object#toString()
*/
@Override

View file

@ -88,6 +88,21 @@ public class JSchConnectionAttributes {
return fAttributes;
}
public boolean getBoolean(String key, boolean def) {
if (fAttributes.containsKey(key)) {
return Boolean.parseBoolean(fAttributes.get(key));
}
return def;
}
public int getInt(String key, int def) {
try {
return Integer.parseInt(fAttributes.get(key));
} catch (NumberFormatException e) {
return def;
}
}
public String getName() {
if (fNewName == null) {
return fName;
@ -108,21 +123,6 @@ public class JSchConnectionAttributes {
return def;
}
public int getInt(String key, int def) {
try {
return Integer.parseInt(fAttributes.get(key));
} catch (NumberFormatException e) {
return def;
}
}
public boolean getBoolean(String key, boolean def) {
if (fAttributes.containsKey(key)) {
return Boolean.parseBoolean(fAttributes.get(key));
}
return def;
}
public Map<String, String> getSecureAttributes() {
return fSecureAttributes;
}
@ -166,6 +166,11 @@ public class JSchConnectionAttributes {
}
}
public void remove() {
clearPreferences();
flushPreferences();
}
public void save() {
clearPreferences();
if (fNewName != null) {
@ -176,11 +181,6 @@ public class JSchConnectionAttributes {
flushPreferences();
}
public void remove() {
clearPreferences();
flushPreferences();
}
private void savePreferences() {
Preferences node = getPreferences();
synchronized (fAttributes) {

View file

@ -34,7 +34,7 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#getAddress()
*/
@Override
@ -44,7 +44,7 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#getAttributes()
*/
@Override
@ -59,7 +59,7 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#getName()
*/
@Override
@ -69,16 +69,17 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnectionWorkingCopy#getOriginal()
*/
@Override
public IRemoteConnection getOriginal() {
return fOriginal;
}
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.internal.jsch.core.JSchConnection#getPassphrase()
*/
@Override
@ -88,7 +89,7 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.internal.jsch.core.JSchConnection#getPassword()
*/
@Override
@ -98,7 +99,7 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#getPort()
*/
@Override
@ -108,7 +109,7 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.internal.jsch.core.JSchConnection#getTimeout()
*/
@Override
@ -118,7 +119,7 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#getUsername()
*/
@Override
@ -128,7 +129,7 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnection#getWorkingCopy()
*/
@Override
@ -138,16 +139,17 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnectionWorkingCopy#isDirty()
*/
@Override
public boolean isDirty() {
return fIsDirty;
}
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.internal.jsch.core.JSchConnection#isPasswordAuth()
*/
@Override
@ -157,9 +159,10 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnectionWorkingCopy#save()
*/
@Override
public IRemoteConnection save() {
JSchConnectionAttributes info = fOriginal.getInfo();
info.getAttributes().clear();
@ -179,9 +182,10 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnectionWorkingCopy#setAddress(java.lang.String)
*/
@Override
public void setAddress(String address) {
fIsDirty = true;
fWorkingAttributes.setAttribute(JSchConnectionAttributes.ADDRESS_ATTR, address);
@ -189,9 +193,10 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnectionWorkingCopy#setAttribute(java.lang.String, java.lang.String)
*/
@Override
public void setAttribute(String key, String value) {
fIsDirty = true;
fWorkingAttributes.setAttribute(key, value);
@ -209,14 +214,15 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnectionWorkingCopy#setName(java.lang.String)
*/
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnectionWorkingCopy#setName(java.lang.String)
*/
@Override
public void setName(String name) {
fIsDirty = true;
fWorkingAttributes.setName(name);
@ -229,9 +235,10 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnectionWorkingCopy#setPassword(java.lang.String)
*/
@Override
public void setPassword(String password) {
fIsDirty = true;
fWorkingAttributes.setSecureAttribute(JSchConnectionAttributes.PASSWORD_ATTR, password);
@ -239,9 +246,10 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnectionWorkingCopy#setPort(int)
*/
@Override
public void setPort(int port) {
fIsDirty = true;
fWorkingAttributes.setAttribute(JSchConnectionAttributes.PORT_ATTR, Integer.toString(port));
@ -259,9 +267,10 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
/*
* (non-Javadoc)
*
*
* @see org.eclipse.remote.core.IRemoteConnectionWorkingCopy#setUsername(java.lang.String)
*/
@Override
public void setUsername(String userName) {
fIsDirty = true;
fWorkingAttributes.setAttribute(JSchConnectionAttributes.USERNAME_ATTR, userName);

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* IBM Corporation - Initial Implementation
*

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* IBM Corporation - Initial Implementation
*
@ -21,10 +21,6 @@ public class Messages extends NLS {
NLS.initializeMessages(BUNDLE_ID, Messages.class);
}
private Messages() {
// cannot create new instance
}
public static String JSchConnectionPage_A_connection_with_that_name_already_exists;
public static String JSchConnectionPage_Edit_Connection;
public static String JSchConnectionPage_Edit_properties_of_an_existing_connection;
@ -55,4 +51,8 @@ public class Messages extends NLS {
public static String JSchNewConnectionPage_User_name_cannot_be_empty;
public static String JSchUIConnectionManager_Connection_Error;
public static String JSchUIConnectionManager_Could_not_open_connection;
private Messages() {
// cannot create new instance
}
}

View file

@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Contributors:
* IBM Corporation - Initial Implementation
*
@ -38,13 +38,13 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.events.ExpansionEvent;
import org.eclipse.ui.forms.events.IExpansionListener;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.swt.widgets.Control;
public class JSchConnectionPage extends WizardPage {
private class DataModifyListener implements ModifyListener {
@ -83,9 +83,9 @@ public class JSchConnectionPage extends WizardPage {
/**
* Create controls for the bottom (hideable) composite
*
*
* @param mold
*
*
*/
private void createAdvancedControls(final Composite parent) {
ExpandableComposite expComp = new ExpandableComposite(parent, ExpandableComposite.TWISTIE);
@ -198,7 +198,8 @@ public class JSchConnectionPage extends WizardPage {
fPasswordButton.setSelection(true);
fPublicKeyButton.setSelection(false);
controls.setTabList(new Control[]{fHostText, fUserText, fPasswordButton, fPasswordText, fPublicKeyButton, fFileWidget, fPassphraseText});
controls.setTabList(new Control[] { fHostText, fUserText, fPasswordButton, fPasswordText, fPublicKeyButton, fFileWidget,
fPassphraseText });
}
@Override
@ -253,7 +254,7 @@ public class JSchConnectionPage extends WizardPage {
/**
* Check if the connection name is invalid. This only applies to new connections (when fConnection is null).
*
*
* @param name
* connection name
* @return true if the name is invalid, false otherwise
@ -364,6 +365,18 @@ public class JSchConnectionPage extends WizardPage {
fInitialAttributes.put(JSchConnectionAttributes.PORT_ATTR, Integer.toString(port));
}
private void setTextFieldWidthInChars(Text text, int chars) {
text.setTextLimit(chars);
Object data = text.getLayoutData();
if (data instanceof GridData) {
GC gc = new GC(text);
FontMetrics fm = gc.getFontMetrics();
int width = chars * fm.getAverageCharWidth();
gc.dispose();
((GridData) data).widthHint = width;
}
}
public void setUsername(String username) {
fInitialAttributes.put(JSchConnectionAttributes.USERNAME_ATTR, username);
}
@ -473,16 +486,4 @@ public class JSchConnectionPage extends WizardPage {
}
return null;
}
private void setTextFieldWidthInChars(Text text, int chars) {
text.setTextLimit(chars);
Object data = text.getLayoutData();
if (data instanceof GridData) {
GC gc = new GC(text);
FontMetrics fm = gc.getFontMetrics();
int width = chars * fm.getAverageCharWidth();
gc.dispose();
((GridData) data).widthHint = width;
}
}
}