Author: xcoulon
Date: 2012-05-31 17:31:24 -0400 (Thu, 31 May 2012)
New Revision: 41598
Modified:
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java
Log:
Fixed - JBIDE-12006
Users in the OpenShift Explorer view should be lazily loaded
Modified:
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java
===================================================================
---
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-05-31
21:25:25 UTC (rev 41597)
+++
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-05-31
21:31:24 UTC (rev 41598)
@@ -41,16 +41,16 @@
private boolean rememberPassword;
private boolean connected;
private boolean alreadyPromptedForPassword;
-
- public UserDelegate(String username, String password) {
+ private boolean passwordLoaded = false;
+
+ public UserDelegate(String username) {
this.username = username;
- this.password = password;
- this.rememberPassword = (password != null);
this.setConnected(false);
}
-
+
public UserDelegate(IUser user, boolean rememberPassword) {
setDelegate(user);
+ this.passwordLoaded = true;
this.rememberPassword = rememberPassword;
}
@@ -69,15 +69,30 @@
this.username = delegate.getRhlogin();
this.password = delegate.getPassword();
this.setConnected(true);
- }
+ }
public String getUsername() {
return username;
}
public String getPassword() {
+ if (!this.passwordLoaded) {
+ loadPassword();
+ }
return password;
}
-
+
+ /**
+ * Attempts to load the password from the secure storage, only at first
+ * time it is called.
+ */
+ private void loadPassword() {
+ if (!passwordLoaded) {
+ this.password = UserModel.getDefault().getPasswordFromSecureStorage(username);
+ this.rememberPassword = (password != null);
+ this.passwordLoaded = true;
+ }
+ }
+
public boolean isRememberPassword() {
return rememberPassword;
}
@@ -99,7 +114,10 @@
*/
public boolean checkForPassword() {
if(delegate == null) {
- if( username != null && password != null ) {
+ if(!passwordLoaded) {
+ loadPassword();
+ }
+ if(username != null && password != null) {
if( checkCurrentCredentials() )
return true;
}
Modified:
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java
===================================================================
---
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java 2012-05-31
21:25:25 UTC (rev 41597)
+++
branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java 2012-05-31
21:31:24 UTC (rev 41598)
@@ -149,8 +149,7 @@
OpenShiftUIActivator.PLUGIN_ID);
String[] users = pref.get();
for (int i = 0; i < users.length; i++) {
- String password = getPasswordFromSecureStorage(users[i]);
- addUser(new UserDelegate(users[i], password));
+ addUser(new UserDelegate(users[i]));
}
}
Show replies by date