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:
parent
d83bd777dc
commit
5ee4fa818a
6 changed files with 115 additions and 105 deletions
|
@ -817,7 +817,7 @@ 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));
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -72,6 +72,7 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
|
||||||
*
|
*
|
||||||
* @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;
|
||||||
}
|
}
|
||||||
|
@ -141,6 +142,7 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
|
||||||
*
|
*
|
||||||
* @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;
|
||||||
}
|
}
|
||||||
|
@ -160,6 +162,7 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
|
||||||
*
|
*
|
||||||
* @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();
|
||||||
|
@ -182,6 +185,7 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
|
||||||
*
|
*
|
||||||
* @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);
|
||||||
|
@ -192,6 +196,7 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
|
||||||
*
|
*
|
||||||
* @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);
|
||||||
|
@ -217,6 +222,7 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
|
||||||
*
|
*
|
||||||
* @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);
|
||||||
|
@ -232,6 +238,7 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
|
||||||
*
|
*
|
||||||
* @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);
|
||||||
|
@ -242,6 +249,7 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
|
||||||
*
|
*
|
||||||
* @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));
|
||||||
|
@ -262,6 +270,7 @@ public class JSchConnectionWorkingCopy extends JSchConnection implements IRemote
|
||||||
*
|
*
|
||||||
* @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);
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
||||||
|
@ -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
|
||||||
|
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue