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

Bug 154408 - The fix is to clear the message line prior to validating the dialog.

This commit is contained in:
David Dykstal 2006-09-21 21:59:08 +00:00
parent 904823c2ea
commit 6c68f75c6a
3 changed files with 16 additions and 27 deletions

View file

@ -71,24 +71,10 @@ public class SystemClearPasswordAction extends SystemBaseAction
ISubSystem ss = (ISubSystem)getFirstSelection(); ISubSystem ss = (ISubSystem)getFirstSelection();
try { try {
IConnectorService system = ss.getConnectorService(); IConnectorService system = ss.getConnectorService();
// get the user id
String userId = system.getUserId();
// clear userid/password from memory and fire event
//DKM and disk now
system.clearPasswordCache(true); system.clearPasswordCache(true);
RSEUIPlugin.getTheSystemRegistry().fireEvent(new SystemResourceChangeEvent(ss, RSEUIPlugin.getTheSystemRegistry().fireEvent(new SystemResourceChangeEvent(ss,
ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE, ISystemResourceChangeEvents.EVENT_PROPERTY_CHANGE,
ss.getHost())); ss.getHost()));
/* DKM - this is now done in clearPasswordCache
*
// now get rid of userid/password from disk
String systemType = ss.getSystem().getSystemType();
String hostName = system.getHostName();
PasswordPersistenceManager.getInstance().remove(systemType, hostName, userId);
*/
} }
catch (Exception exc) { catch (Exception exc) {
// msg already shown // msg already shown

View file

@ -237,7 +237,6 @@ public final class SystemPasswordPromptDialog extends SystemPromptDialog impleme
protected Control getInitialFocusControl() { protected Control getInitialFocusControl() {
okButton.setEnabled(true); okButton.setEnabled(true);
processUserIdField(); processUserIdField();
processPasswordField();
if (textUserId != null) { if (textUserId != null) {
if (userId.length() == 0 || textPassword == null) { if (userId.length() == 0 || textPassword == null) {
return textUserId; return textUserId;
@ -311,14 +310,15 @@ public final class SystemPasswordPromptDialog extends SystemPromptDialog impleme
* @see #setUserIdValidator(ISystemValidator) * @see #setUserIdValidator(ISystemValidator)
*/ */
private void processUserIdField() { private void processUserIdField() {
internalGetUserId(); clearErrorMessage();
internalGetPassword();
SystemMessage m = checkUserId(); SystemMessage m = checkUserId();
if (m == null) { if (m == null) {
m = checkPassword(); m = checkPassword();
} }
okButton.setEnabled(m == null); if (m != null) {
setErrorMessage(m); setErrorMessage(m);
}
okButton.setEnabled(m == null);
if (userId == null || originalUserId == null) { if (userId == null || originalUserId == null) {
userIdChanged = (userId != originalUserId); userIdChanged = (userId != originalUserId);
} else { } else {
@ -335,6 +335,7 @@ public final class SystemPasswordPromptDialog extends SystemPromptDialog impleme
* @return the message returned by the validator or null. * @return the message returned by the validator or null.
*/ */
private SystemMessage checkUserId() { private SystemMessage checkUserId() {
internalGetUserId();
SystemMessage m = null; SystemMessage m = null;
if (connectorService.supportsUserId() && validate) { if (connectorService.supportsUserId() && validate) {
if (userIdValidator != null) { if (userIdValidator != null) {
@ -354,14 +355,15 @@ public final class SystemPasswordPromptDialog extends SystemPromptDialog impleme
* @see #setPasswordValidator(ISystemValidator) * @see #setPasswordValidator(ISystemValidator)
*/ */
private void processPasswordField() { private void processPasswordField() {
internalGetUserId(); clearErrorMessage();
internalGetPassword();
SystemMessage m = checkPassword(); SystemMessage m = checkPassword();
if (m == null) { if (m == null) {
m = checkUserId(); m = checkUserId();
} }
okButton.setEnabled(m == null); if (m != null) {
setErrorMessage(m); setErrorMessage(m);
}
okButton.setEnabled(m == null);
if (savePasswordCB != null) { if (savePasswordCB != null) {
savePasswordCB.setEnabled(!(connectorService.requiresPassword() && password.length() == 0)); savePasswordCB.setEnabled(!(connectorService.requiresPassword() && password.length() == 0));
} }
@ -371,6 +373,7 @@ public final class SystemPasswordPromptDialog extends SystemPromptDialog impleme
* Checks the value of the password instance variable. * Checks the value of the password instance variable.
*/ */
private SystemMessage checkPassword() { private SystemMessage checkPassword() {
internalGetPassword();
SystemMessage m = null; SystemMessage m = null;
if (connectorService.supportsPassword() && validate) { if (connectorService.supportsPassword() && validate) {
if (passwordValidator != null) { if (passwordValidator != null) {

View file

@ -338,22 +338,21 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
* change his userId. * change his userId.
* *
* @param onDisk if this is true, clear the password from the disk cache as well * @param onDisk if this is true, clear the password from the disk cache as well
* @see #clearUserIdCache(boolean) * @see #clearUserIdCache()
*/ */
final public void clearPasswordCache(boolean onDisk) { final public void clearPasswordCache(boolean onDisk) {
setPasswordInformation(null); setPasswordInformation(null);
String userId = getUserId();
if (onDisk) { if (onDisk) {
// now get rid of userid/password from disk // now get rid of userid/password from disk
String systemType = getHostType(); String systemType = getHostType();
String hostName = getHostName(); String hostName = getHostName();
if (_userId != null) if (userId != null)
PasswordPersistenceManager.getInstance().remove(systemType, hostName, _userId); PasswordPersistenceManager.getInstance().remove(systemType, hostName, userId);
} }
if (shareUserPasswordWithConnection()) { if (shareUserPasswordWithConnection()) {
// clear this uid/password with other ISystems in connection // clear this uid/password with other ISystems in connection
clearPasswordForOtherSystemsInConnection(_userId, onDisk); clearPasswordForOtherSystemsInConnection(userId, onDisk);
} }
} }
@ -533,6 +532,7 @@ public abstract class AbstractConnectorService extends RSEModelObject implements
logException(e); logException(e);
} }
if (dialog.wasCancelled()) { if (dialog.wasCancelled()) {
_passwordInfo = null;
throw new InterruptedException(); throw new InterruptedException();
} }
String userId = dialog.getUserId(); String userId = dialog.getUserId();