Author: xcoulon
Date: 2012-05-23 05:39:16 -0400 (Wed, 23 May 2012)
New Revision: 41275
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/actionProvider/CreateOrEditDomainActionProvider.java
Removed:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/actionProvider/EditDomainActionProvider.java
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.client/openshift-java-client-2.0.0-SNAPSHOT.jar
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateOrEditDomainAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteDomainAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/OpenShiftExpressConsoleLabelProvider.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/property/UserPropertySource.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java
Log:
Fixed - JBIDE-11962
Unchecking 'remember password' has no effect when connecting user from Openshift
Explorer
Fixed - JBIDE-11960
Error when expanding user node when password is not saved in secure store
Fixed - JBIDE-11295
Creating/Editing domain in OpenShift Console view when user not connected
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.client/openshift-java-client-2.0.0-SNAPSHOT.jar
===================================================================
(Binary files differ)
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2012-05-23
09:36:54 UTC (rev 41274)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/plugin.xml 2012-05-23
09:39:16 UTC (rev 41275)
@@ -364,7 +364,7 @@
</enablement>
</actionProvider>
<actionProvider
-
class="org.jboss.tools.openshift.express.internal.ui.viewer.actionProvider.EditDomainActionProvider"
+
class="org.jboss.tools.openshift.express.internal.ui.viewer.actionProvider.CreateOrEditDomainActionProvider"
id="org.jboss.tools.openshift.express.internal.ui.viewer.actionProvider.editDomainActionProvider">
<enablement>
<and>
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2012-05-23
09:36:54 UTC (rev 41274)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressServerUtils.java 2012-05-23
09:39:16 UTC (rev 41275)
@@ -404,7 +404,7 @@
IEclipsePreferences node = context.getNode(qualifier);
node.put(ExpressServerUtils.SETTING_APPLICATION_ID, app.getUUID());
node.put(ExpressServerUtils.SETTING_APPLICATION_NAME, app.getName());
- node.put(ExpressServerUtils.SETTING_USERNAME, user.getRhlogin());
+ node.put(ExpressServerUtils.SETTING_USERNAME, user.getUsername());
node.put(ExpressServerUtils.SETTING_DOMAIN, app.getDomain().getId());
node.put(ExpressServerUtils.SETTING_REMOTE_NAME, remoteName);
node.put(ExpressServerUtils.SETTING_DEPLOY_FOLDER_NAME, deployFolder);
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-05-23
09:36:54 UTC (rev 41274)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-05-23
09:39:16 UTC (rev 41275)
@@ -36,15 +36,23 @@
import com.openshift.client.OpenShiftUnknonwSSHKeyTypeException;
public class UserDelegate {
+ private String username;
+ private String password;
private IUser delegate;
private boolean rememberPassword;
private boolean connected;
private boolean alreadyPromptedForPassword;
- public UserDelegate(IUser user, boolean rememberPassword, boolean connected) {
- this.delegate = user;
+ public UserDelegate(String username, String password) {
+ this.username = username;
+ this.password = password;
+ this.rememberPassword = (password != null);
+ this.setConnected(false);
+ }
+
+ public UserDelegate(IUser user, boolean rememberPassword) {
+ setDelegate(user);
this.rememberPassword = rememberPassword;
- this.setConnected(connected);
}
/**
@@ -59,13 +67,16 @@
*/
protected final void setDelegate(IUser delegate) {
this.delegate = delegate;
+ this.username = delegate.getRhlogin();
+ this.password = delegate.getPassword();
+ this.setConnected(true);
}
- public String getRhlogin() {
- return delegate.getRhlogin();
+ public String getUsername() {
+ return username;
}
public String getPassword() {
- return delegate.getPassword();
+ return password;
}
public boolean isRememberPassword() {
@@ -75,7 +86,7 @@
/**
* @param rememberPassword the rememberPassword to set
*/
- protected final void setRememberPassword(boolean rememberPassword) {
+ public final void setRememberPassword(boolean rememberPassword) {
this.rememberPassword = rememberPassword;
}
@@ -88,7 +99,7 @@
* @return true if user entered credentials, false otherwise.
*/
public boolean checkForPassword() {
- if( delegate.getPassword() == null || "".equals(delegate.getPassword())) {
+ if(delegate == null) {
try {
this.alreadyPromptedForPassword = true;
Display.getDefault().syncExec(new Runnable() { public void run() {
@@ -113,7 +124,7 @@
Logger.error("Failed to retrieve User's password", e);
}
}
- return (delegate.getPassword() != null &&
!"".equals(delegate.getPassword()));
+ return (delegate != null);
}
public IApplication createApplication(final String applicationName, final ICartridge
applicationType, final ApplicationScale scale, final IGearProfile gearProfile)
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java 2012-05-23
09:36:54 UTC (rev 41274)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java 2012-05-23
09:39:16 UTC (rev 41275)
@@ -10,7 +10,9 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.core.console;
+import java.io.FileNotFoundException;
import java.io.IOException;
+import java.net.SocketTimeoutException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -32,8 +34,8 @@
import com.openshift.client.configuration.OpenShiftConfiguration;
public class UserModel {
- private static final String USER_ID = OpenShiftUIActivator.PLUGIN_ID + " " +
- OpenShiftUIActivator.getDefault().getBundle().getVersion();
+ private static final String USER_ID = OpenShiftUIActivator.PLUGIN_ID + " "
+ + OpenShiftUIActivator.getDefault().getBundle().getVersion();
private static UserModel model;
public static UserModel getDefault() {
@@ -66,10 +68,15 @@
* @param password
* @return
* @throws OpenShiftException
+ * @throws FileNotFoundException
+ * @throws SocketTimeoutException
* @throws IOException
*/
- public IUser createUser(String username, String password) throws OpenShiftException,
IOException {
- return new OpenShiftConnectionFactory().getConnection(USER_ID, username,
password).getUser();
+ public IUser createUser(String username, String password) throws OpenShiftException,
SocketTimeoutException {
+ IUser user = new OpenShiftConnectionFactory().getConnection(USER_ID, username,
password).getUser();
+ // force domain loading so that there is no 'lazy domain loading' cost after
that.
+ user.getDefaultDomain();
+ return user;
}
private static final int ADDED = 0;
@@ -77,13 +84,13 @@
private static final int CHANGED = 2;
public void addUser(UserDelegate user) {
- allUsers.put(user.getRhlogin(), user);
+ allUsers.put(user.getUsername(), user);
this.recentUser = user;
fireModelChange(user, ADDED);
}
public void removeUser(UserDelegate user) {
- allUsers.remove(user.getRhlogin());
+ allUsers.remove(user.getUsername());
if (this.recentUser == user)
this.recentUser = null;
fireModelChange(user, REMOVED);
@@ -136,14 +143,13 @@
OpenShiftUIActivator.PLUGIN_ID);
String[] users = pref.get();
for (int i = 0; i < users.length; i++) {
+ String password = getPasswordFromSecureStorage(users[i]);
try {
- String password = getPasswordFromSecureStorage(users[i]);
- UserDelegate u = new UserDelegate(createUser(users[i], password), password != null,
password != null);
- addUser(u);
- } catch (OpenShiftException ose) {
- // TODO
- } catch (IOException ioe) {
- // TODO
+ addUser(new UserDelegate(createUser(users[i], password), true));
+ } catch (OpenShiftException e) {
+ addUser(new UserDelegate(users[i], password));
+ } catch (SocketTimeoutException e) {
+ addUser(new UserDelegate(users[i], password));
}
}
}
@@ -163,8 +169,7 @@
for (Entry<String, UserDelegate> entry : allUsers.entrySet()) {
UserDelegate user = entry.getValue();
if (user.isRememberPassword()) {
- setPasswordInSecureStorage(user.getRhlogin(),
- user.getPassword());
+ setPasswordInSecureStorage(user.getUsername(), user.getPassword());
}
}
}
@@ -208,8 +213,7 @@
}
/*
- * Return a password from secure storage, or null if platform not found, or
- * password not stored
+ * Return a password from secure storage, or null if platform not found, or password not
stored
*/
public String getPasswordFromSecureStorage(final String rhLogin) {
if (rhLogin == null)
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateOrEditDomainAction.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateOrEditDomainAction.java 2012-05-23
09:36:54 UTC (rev 41274)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateOrEditDomainAction.java 2012-05-23
09:39:16 UTC (rev 41275)
@@ -38,12 +38,18 @@
@Override
public void run() {
final ITreeSelection treeSelection = (ITreeSelection) selection;
- if (selection instanceof ITreeSelection
- && treeSelection.getFirstElement() instanceof UserDelegate) {
+ if (selection instanceof ITreeSelection && treeSelection.getFirstElement()
instanceof UserDelegate) {
final UserDelegate user = (UserDelegate) treeSelection.getFirstElement();
- WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(),
createDomainWizard(user));
- dialog.create();
- dialog.open();
+ boolean connected = user.isConnected();
+ if (!connected) {
+ connected = user.checkForPassword();
+ }
+ // do not show the dialog if the user was not connected or did not provide valid
credentials.
+ if (connected) {
+ WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(),
createDomainWizard(user));
+ dialog.create();
+ dialog.open();
+ }
}
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteDomainAction.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteDomainAction.java 2012-05-23
09:36:54 UTC (rev 41274)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteDomainAction.java 2012-05-23
09:39:16 UTC (rev 41275)
@@ -46,22 +46,17 @@
if (selection instanceof ITreeSelection
&& ((IStructuredSelection) selection).getFirstElement() instanceof
UserDelegate
&& ((ITreeSelection) selection).size() == 1) {
- UserDelegate user = (UserDelegate) ((IStructuredSelection) selection)
- .getFirstElement();
- try {
- IDomain domain = user.getDefaultDomain();
-
- if (domain != null) {
- enable = true;
+ UserDelegate user = (UserDelegate) ((IStructuredSelection)
selection).getFirstElement();
+ if (user.isConnected()) {
+ try {
+ if (user.getDefaultDomain() != null) {
+ enable = true;
+ }
+ } catch (OpenShiftException e) {
+ Logger.warn("Failed to retrieve User domain, prompting for creation", e);
+ } catch (SocketTimeoutException e) {
+ Logger.warn("Failed to retrieve User domain, prompting for creation", e);
}
- } catch (OpenShiftException e) {
- Logger.warn(
- "Failed to retrieve User domain, prompting for creation",
- e);
- } catch (SocketTimeoutException e) {
- Logger.warn(
- "Failed to retrieve User domain, prompting for creation",
- e);
}
}
setEnabled(enable);
@@ -75,7 +70,9 @@
UserDelegate user = (UserDelegate) treeSelection.getFirstElement();
try {
final IDomain domain = user.getDefaultDomain();
- if (domain != null) {
+ if (domain == null) {
+ MessageDialog.openInformation(Display.getCurrent().getActiveShell(), "Delete
Domain", "User has no domain");
+ } else {
boolean confirm = false;
MessageDialog dialog = new CheckboxMessageDialog(Display.getCurrent()
.getActiveShell(), "Domain deletion", NLS.bind(
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java 2012-05-23
09:36:54 UTC (rev 41274)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java 2012-05-23
09:39:16 UTC (rev 41275)
@@ -167,7 +167,7 @@
} else {
// we may or may not have a user, clearly no app
this.fuser = tmpUser == null ? UserModel.getDefault().getRecentUser() : tmpUser;
- this.user = fuser == null ? null : fuser.getRhlogin();
+ this.user = fuser == null ? null : fuser.getUsername();
}
this.pass = this.user == null ? null :
UserModel.getDefault().getPasswordFromSecureStorage(this.user);
@@ -579,7 +579,7 @@
this.appListNames = appNames == null ? new String[0] : appNames;
this.fapplication = application;
this.fuser = user;
- this.user = fuser.getRhlogin();
+ this.user = fuser.getUsername();
for( int i = 0; i < appList.size(); i++ ) {
projectsPerApp.put(appList.get(i),
ExpressServerUtils.findProjectsForApplication(appList.get(i)));
@@ -596,9 +596,9 @@
try {
UserModel.getDefault().addUser(fuser);
if( rememberPassword ) {
- UserModel.getDefault().setPasswordInSecureStorage(fuser.getRhlogin(),
fuser.getPassword());
+ UserModel.getDefault().setPasswordInSecureStorage(fuser.getUsername(),
fuser.getPassword());
} else {
- UserModel.getDefault().clearPasswordInSecureStorage(fuser.getRhlogin());
+ UserModel.getDefault().clearPasswordInSecureStorage(fuser.getUsername());
}
fillServerWithDetails();
updateProjectSettings();
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/OpenShiftExpressConsoleLabelProvider.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/OpenShiftExpressConsoleLabelProvider.java 2012-05-23
09:36:54 UTC (rev 41274)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/OpenShiftExpressConsoleLabelProvider.java 2012-05-23
09:39:16 UTC (rev 41275)
@@ -84,7 +84,7 @@
@Override
public StyledString getStyledText(Object element) {
if (element instanceof UserDelegate) {
- String message = ((UserDelegate) element).getRhlogin();
+ String message = ((UserDelegate) element).getUsername();
StyledString styledString = new StyledString(message);
styledString.setStyle(0, message.length(), StyledString.DECORATIONS_STYLER);
return new StyledString(message);
Copied:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/actionProvider/CreateOrEditDomainActionProvider.java
(from rev 41272,
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/actionProvider/EditDomainActionProvider.java)
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/actionProvider/CreateOrEditDomainActionProvider.java
(rev 0)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/actionProvider/CreateOrEditDomainActionProvider.java 2012-05-23
09:39:16 UTC (rev 41275)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui.viewer.actionProvider;
+
+import org.jboss.tools.openshift.express.internal.ui.action.CreateOrEditDomainAction;
+
+/**
+ * @author Xavier Coulon
+ */
+public class CreateOrEditDomainActionProvider extends AbstractActionProvider {
+
+ public CreateOrEditDomainActionProvider() {
+ super(new CreateOrEditDomainAction(), "group.edition");
+ }
+
+}
Property changes on:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/actionProvider/CreateOrEditDomainActionProvider.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/actionProvider/EditDomainActionProvider.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/actionProvider/EditDomainActionProvider.java 2012-05-23
09:36:54 UTC (rev 41274)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/actionProvider/EditDomainActionProvider.java 2012-05-23
09:39:16 UTC (rev 41275)
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.openshift.express.internal.ui.viewer.actionProvider;
-
-import org.jboss.tools.openshift.express.internal.ui.action.CreateOrEditDomainAction;
-
-/**
- * @author Xavier Coulon
- */
-public class EditDomainActionProvider extends AbstractActionProvider {
-
- public EditDomainActionProvider() {
- super(new CreateOrEditDomainAction(), "group.edition");
- }
-
-}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/property/UserPropertySource.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/property/UserPropertySource.java 2012-05-23
09:36:54 UTC (rev 41274)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/property/UserPropertySource.java 2012-05-23
09:39:16 UTC (rev 41275)
@@ -57,7 +57,7 @@
}
if (id.equals(PROPERTY_USERNAME)) {
- return user.getRhlogin();
+ return user.getUsername();
}
if (id.equals(PROPERTY_DOMAIN) && user.hasDomain()) {
return user.getDefaultDomain().getId() + "." +
user.getDefaultDomain().getSuffix();
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2012-05-23
09:36:54 UTC (rev 41274)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPage.java 2012-05-23
09:39:16 UTC (rev 41275)
@@ -46,7 +46,6 @@
import org.jboss.tools.openshift.express.internal.ui.OpenshiftUIMessages;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
-import org.jboss.tools.openshift.express.internal.ui.utils.UIUtils;
/**
* @author Andre Dietisheim
@@ -152,6 +151,8 @@
passwordText.setFocus();
}
}
+
+
@Override
protected void onPageWillGetDeactivated(Direction direction, PageChangingEvent event,
DataBindingContext dbc) {
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-05-23
09:36:54 UTC (rev 41274)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java 2012-05-23
09:39:16 UTC (rev 41275)
@@ -19,7 +19,6 @@
import org.jboss.tools.openshift.express.internal.core.console.UserModel;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
-import org.jboss.tools.openshift.express.internal.ui.utils.OpenShiftPasswordStorageKey;
import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
import com.openshift.client.NotFoundOpenShiftException;
@@ -74,7 +73,7 @@
user = UserModel.getDefault().getRecentUser();
}
if (user != null) {
- rhLogin = user.getRhlogin();
+ rhLogin = user.getUsername();
} else {
rhLogin = rhLoginPreferenceValue.get();
if (rhLogin == null
@@ -97,7 +96,7 @@
}
private void storePassword(UserDelegate user) {
- UserModel.getDefault().setPasswordInSecureStorage(user.getRhlogin(), password);
+ UserModel.getDefault().setPasswordInSecureStorage(user.getUsername(), password);
}
private void erasePasswordStore() {
@@ -187,16 +186,17 @@
// reuse previous user if it was properly logged in
user = UserModel.getDefault().findUser(rhLogin);
// check user credentials if not logged before or if input password changed
- if(user != null && user.getPassword().equals(password)) {
+ if(user != null && user.isConnected()) {
+ user.setRememberPassword(rememberPassword);
wizardModel.setUser(user);
+ storeUser(user);
} else {
- user = new UserDelegate(UserModel.getDefault().createUser(rhLogin, password),
rememberPassword,
- password != null);
+ user = new UserDelegate(UserModel.getDefault().createUser(rhLogin, password),
rememberPassword);
if (user.isValid()) {
storeUser(user);
} else {
status = OpenShiftUIActivator.createErrorStatus(NLS.bind(
- "The credentials for user {0} are not valid", user.getRhlogin()));
+ "The credentials for user {0} are not valid", user.getUsername()));
}
}
} catch (NotFoundOpenShiftException e) {