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

View file

@ -88,6 +88,21 @@ public class JSchConnectionAttributes {
return fAttributes; 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() { public String getName() {
if (fNewName == null) { if (fNewName == null) {
return fName; return fName;
@ -108,21 +123,6 @@ public class JSchConnectionAttributes {
return def; 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() { public Map<String, String> getSecureAttributes() {
return fSecureAttributes; return fSecureAttributes;
} }
@ -166,6 +166,11 @@ public class JSchConnectionAttributes {
} }
} }
public void remove() {
clearPreferences();
flushPreferences();
}
public void save() { public void save() {
clearPreferences(); clearPreferences();
if (fNewName != null) { if (fNewName != null) {
@ -176,11 +181,6 @@ public class JSchConnectionAttributes {
flushPreferences(); flushPreferences();
} }
public void remove() {
clearPreferences();
flushPreferences();
}
private void savePreferences() { private void savePreferences() {
Preferences node = getPreferences(); Preferences node = getPreferences();
synchronized (fAttributes) { synchronized (fAttributes) {

View file

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

View file

@ -4,7 +4,7 @@
* 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:
* IBM Corporation - Initial Implementation * IBM Corporation - Initial Implementation
* *
@ -21,10 +21,6 @@ public class Messages extends NLS {
NLS.initializeMessages(BUNDLE_ID, Messages.class); 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_A_connection_with_that_name_already_exists;
public static String JSchConnectionPage_Edit_Connection; public static String JSchConnectionPage_Edit_Connection;
public static String JSchConnectionPage_Edit_properties_of_an_existing_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 JSchNewConnectionPage_User_name_cannot_be_empty;
public static String JSchUIConnectionManager_Connection_Error; public static String JSchUIConnectionManager_Connection_Error;
public static String JSchUIConnectionManager_Could_not_open_connection; 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 * 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:
* IBM Corporation - Initial Implementation * IBM Corporation - Initial Implementation
* *
@ -38,13 +38,13 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.events.ExpansionEvent; import org.eclipse.ui.forms.events.ExpansionEvent;
import org.eclipse.ui.forms.events.IExpansionListener; import org.eclipse.ui.forms.events.IExpansionListener;
import org.eclipse.ui.forms.widgets.ExpandableComposite; import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.swt.widgets.Control;
public class JSchConnectionPage extends WizardPage { public class JSchConnectionPage extends WizardPage {
private class DataModifyListener implements ModifyListener { private class DataModifyListener implements ModifyListener {
@ -83,9 +83,9 @@ public class JSchConnectionPage extends WizardPage {
/** /**
* Create controls for the bottom (hideable) composite * Create controls for the bottom (hideable) composite
* *
* @param mold * @param mold
* *
*/ */
private void createAdvancedControls(final Composite parent) { private void createAdvancedControls(final Composite parent) {
ExpandableComposite expComp = new ExpandableComposite(parent, ExpandableComposite.TWISTIE); ExpandableComposite expComp = new ExpandableComposite(parent, ExpandableComposite.TWISTIE);
@ -198,7 +198,8 @@ public class JSchConnectionPage extends WizardPage {
fPasswordButton.setSelection(true); fPasswordButton.setSelection(true);
fPublicKeyButton.setSelection(false); 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 @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). * Check if the connection name is invalid. This only applies to new connections (when fConnection is null).
* *
* @param name * @param name
* connection name * connection name
* @return true if the name is invalid, false otherwise * @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)); 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) { public void setUsername(String username) {
fInitialAttributes.put(JSchConnectionAttributes.USERNAME_ATTR, username); fInitialAttributes.put(JSchConnectionAttributes.USERNAME_ATTR, username);
} }
@ -473,16 +486,4 @@ public class JSchConnectionPage extends WizardPage {
} }
return null; 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;
}
}
} }