Author: adietish
Date: 2012-02-16 07:57:52 -0500 (Thu, 16 Feb 2012)
New Revision: 38819
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java
Log:
[JBIDE-10933] when prefilling username/pw, now 1.) use the selected user OR 2.) user from
preferences OR 4.) configured user
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java 2012-02-16
12:51:45 UTC (rev 38818)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java 2012-02-16
12:57:52 UTC (rev 38819)
@@ -21,6 +21,7 @@
import org.jboss.tools.openshift.express.internal.ui.utils.OpenShiftPasswordStorageKey;
import org.jboss.tools.openshift.express.internal.ui.utils.SecurePasswordStore;
import org.jboss.tools.openshift.express.internal.ui.utils.SecurePasswordStoreException;
+import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
import com.openshift.express.client.IUser;
import com.openshift.express.client.NotFoundOpenShiftException;
@@ -69,9 +70,9 @@
return null;
}
- private SecurePasswordStore initSecureStore(final String platform, final String
username) {
+ private SecurePasswordStore initSecureStore(final String platform, final String rhLogin)
{
SecurePasswordStore store = null;
- final OpenShiftPasswordStorageKey key = new OpenShiftPasswordStorageKey(platform,
username);
+ final OpenShiftPasswordStorageKey key = new OpenShiftPasswordStorageKey(platform,
rhLogin);
if (key != null) {
store = new SecurePasswordStore(key);
}
@@ -80,19 +81,25 @@
protected String initRhLogin() {
String rhLogin = null;
- rhLogin = rhLoginPreferenceValue.get();
- if (rhLogin == null || rhLogin.length() == 0) {
- rhLogin = getUserConfiguration();
+ IUser user = wizardModel.getUser();
+ if (user != null) {
+ rhLogin = user.getRhlogin();
+ } else {
+ rhLogin = rhLoginPreferenceValue.get();
+ if (rhLogin == null || rhLogin.length() == 0) {
+ rhLogin = getConfiguredUserName();
+ }
}
return rhLogin;
}
protected String initPassword() {
String password = null;
- if (libraServer != null && rhLogin != null && !rhLogin.isEmpty()
&& store != null) {
+ if (!StringUtils.isEmpty(libraServer)
+ && !StringUtils.isEmpty(rhLogin) && store != null) {
try {
password = store.getPassword();
- setRememberPassword(this.password != null && !this.password.isEmpty());
+ setRememberPassword(!StringUtils.isEmpty(password));
} catch (SecurePasswordStoreException e) {
Logger.error("Failed to retrieve OpenShift user's password from Secured
Store", e);
}
@@ -120,7 +127,7 @@
}
}
- protected String getUserConfiguration() {
+ protected String getConfiguredUserName() {
String configuredUsername = null;
try {
configuredUsername = new OpenShiftConfiguration().getRhlogin();
Show replies by date