1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-05 08:05:24 +02:00

Bug 461541 - Fix handling of default attributes in JSchConnectionPage

Change-Id: If5fc199c4916f9a3f4fbb97ddaf564899a439d0f
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
This commit is contained in:
Patrick Tasse 2015-03-16 15:57:37 -04:00
parent da73772cb7
commit cbb9d14e0b
2 changed files with 13 additions and 14 deletions
bundles
org.eclipse.remote.jsch.core/src/org/eclipse/remote/internal/jsch/core
org.eclipse.remote.jsch.ui/src/org/eclipse/remote/internal/jsch/ui/wizards

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2007, 2010 IBM Corporation and others. * Copyright (c) 2007, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* 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
@ -237,7 +237,7 @@ public class JSchConnection implements IRemoteConnectionControlService, IRemoteC
public static final int DEFAULT_PORT = 22; public static final int DEFAULT_PORT = 22;
public static final int DEFAULT_TIMEOUT = 0; public static final int DEFAULT_TIMEOUT = 0;
public static final boolean DEFAULT_IS_PASSWORD = true; public static final boolean DEFAULT_IS_PASSWORD = false;
public static final boolean DEFAULT_USE_LOGIN_SHELL = true; public static final boolean DEFAULT_USE_LOGIN_SHELL = true;
public static final String EMPTY_STRING = ""; //$NON-NLS-1$ public static final String EMPTY_STRING = ""; //$NON-NLS-1$

View file

@ -1,5 +1,5 @@
/** /**
* Copyright (c) 2013 IBM Corporation. * Copyright (c) 2013, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* 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
@ -7,7 +7,7 @@
* *
* Contributors: * Contributors:
* IBM Corporation - Initial Implementation * IBM Corporation - Initial Implementation
* * Patrick Tasse - [461541] fix handling of default attributes
*/ */
package org.eclipse.remote.internal.jsch.ui.wizards; package org.eclipse.remote.internal.jsch.ui.wizards;
@ -224,8 +224,8 @@ public class JSchConnectionPage extends WizardPage {
fPasswordText = new Text(controls, SWT.BORDER | SWT.SINGLE | SWT.PASSWORD); fPasswordText = new Text(controls, SWT.BORDER | SWT.SINGLE | SWT.PASSWORD);
fPasswordText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1)); fPasswordText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
fPasswordButton.setSelection(false); fPasswordButton.setSelection(JSchConnection.DEFAULT_IS_PASSWORD);
fPublicKeyButton.setSelection(true); fPublicKeyButton.setSelection(!JSchConnection.DEFAULT_IS_PASSWORD);
controls.setTabList(new Control[] { fHostText, fUserText, fPublicKeyButton, fPassphraseText, fPasswordButton, fPasswordText }); controls.setTabList(new Control[] { fHostText, fUserText, fPublicKeyButton, fPassphraseText, fPasswordButton, fPasswordText });
} }
@ -348,17 +348,16 @@ public class JSchConnectionPage extends WizardPage {
fConnectionName.setText(fConnection.getName()); fConnectionName.setText(fConnection.getName());
fHostText.setText(fConnection.getAttribute(JSchConnection.ADDRESS_ATTR)); fHostText.setText(fConnection.getAttribute(JSchConnection.ADDRESS_ATTR));
fUserText.setText(fConnection.getAttribute(JSchConnection.USERNAME_ATTR)); fUserText.setText(fConnection.getAttribute(JSchConnection.USERNAME_ATTR));
fPortText.setText(fConnection.getAttribute(JSchConnection.PORT_ATTR)); String portStr = fConnection.getAttribute(JSchConnection.PORT_ATTR);
fTimeoutText.setText(fConnection.getAttribute(JSchConnection.TIMEOUT_ATTR)); fPortText.setText(portStr.isEmpty() ? Integer.toString(JSchConnection.DEFAULT_PORT) : portStr);
String timeoutStr = fConnection.getAttribute(JSchConnection.TIMEOUT_ATTR);
fTimeoutText.setText(timeoutStr.isEmpty() ? Integer.toString(JSchConnection.DEFAULT_TIMEOUT) : timeoutStr);
String isPwdStr = fConnection.getAttribute(JSchConnection.IS_PASSWORD_ATTR); String isPwdStr = fConnection.getAttribute(JSchConnection.IS_PASSWORD_ATTR);
boolean isPwd = isPwdStr != null && Boolean.parseBoolean(isPwdStr); boolean isPwd = isPwdStr.isEmpty() ? JSchConnection.DEFAULT_IS_PASSWORD : Boolean.parseBoolean(isPwdStr);
fPasswordButton.setSelection(isPwd); fPasswordButton.setSelection(isPwd);
fPublicKeyButton.setSelection(!isPwd); fPublicKeyButton.setSelection(!isPwd);
if (isPwd) { fPasswordText.setText(fConnection.getSecureAttribute(JSchConnection.PASSWORD_ATTR));
fPasswordText.setText(fConnection.getSecureAttribute(JSchConnection.PASSWORD_ATTR)); fPassphraseText.setText(fConnection.getSecureAttribute(JSchConnection.PASSPHRASE_ATTR));
} else {
fPassphraseText.setText(fConnection.getSecureAttribute(JSchConnection.PASSPHRASE_ATTR));
}
fProxyCommandText.setText(fConnection.getAttribute(JSchConnection.PROXYCOMMAND_ATTR)); fProxyCommandText.setText(fConnection.getAttribute(JSchConnection.PROXYCOMMAND_ATTR));
JSchConnection proxyConn = fConnection.getService(JSchConnection.class).getProxyConnection(); JSchConnection proxyConn = fConnection.getService(JSchConnection.class).getProxyConnection();
if (proxyConn == null) { if (proxyConn == null) {