Author: xcoulon
Date: 2012-05-31 05:43:06 -0400 (Thu, 31 May 2012)
New Revision: 41574
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/ui/action/CreateApplicationAction.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/ConnectToOpenShiftWizard.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ConnectToOpenShiftWizardModel.java
Log:
Fixed - JBIDE-12014
Credentials page appears twice when creating new application and user is not connected
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-31
09:37:07 UTC (rev 41573)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-05-31
09:43:06 UTC (rev 41574)
@@ -135,7 +135,7 @@
Logger.error("Could not open Credentials Wizard: no shell available");
return;
}
- final ConnectToOpenShiftWizard connectToOpenShiftWizard = new
ConnectToOpenShiftWizard();
+ final ConnectToOpenShiftWizard connectToOpenShiftWizard = new
ConnectToOpenShiftWizard(UserDelegate.this);
int returnCode = WizardUtils.openWizardDialog(connectToOpenShiftWizard, shell);
if (returnCode == Window.OK) {
Logger.debug("OpenShift Auth succeeded.");
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateApplicationAction.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateApplicationAction.java 2012-05-31
09:37:07 UTC (rev 41573)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateApplicationAction.java 2012-05-31
09:43:06 UTC (rev 41574)
@@ -43,10 +43,11 @@
Object sel = ((ITreeSelection) selection).getFirstElement();
if (sel instanceof UserDelegate) {
final UserDelegate user = (UserDelegate) sel;
- user.checkForPassword();
- final OpenShiftExpressApplicationWizard wizard = new
NewOpenShiftExpressApplicationWizard(user);
- final WizardDialog wizardDialog = new WizardDialog(new Shell(), wizard);
- wizardDialog.open();
+ if(user.checkForPassword()) {
+ final OpenShiftExpressApplicationWizard wizard = new
NewOpenShiftExpressApplicationWizard(user);
+ final WizardDialog wizardDialog = new WizardDialog(new Shell(), wizard);
+ wizardDialog.open();
+ }
}
}
}
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-31
09:37:07 UTC (rev 41573)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java 2012-05-31
09:43:06 UTC (rev 41574)
@@ -479,7 +479,7 @@
private void postVerifyUpdateWidgets() {
importLink.setEnabled(false);
verifyButton.setEnabled(true);
- if (appNameCombo != null) {
+ if (appNameCombo != null && fuser != null) {
appNameCombo.setItems(appListNames);
int index = Arrays.asList(appListNames).indexOf(app);
if (index != -1)
@@ -533,7 +533,7 @@
private Runnable getVerifyingCredentialsJob() {
final ConnectToOpenShiftWizardModel inner = new ConnectToOpenShiftWizardModel() {
public UserDelegate setUser(UserDelegate user) {
- created = user;
+ this.user = user;
return user;
}
};
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/ConnectToOpenShiftWizard.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/ConnectToOpenShiftWizard.java 2012-05-31
09:37:07 UTC (rev 41573)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/ConnectToOpenShiftWizard.java 2012-05-31
09:43:06 UTC (rev 41574)
@@ -12,6 +12,7 @@
import org.eclipse.jface.wizard.Wizard;
import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
+import org.jboss.tools.openshift.express.internal.core.console.UserModel;
import
org.jboss.tools.openshift.express.internal.ui.wizard.ConnectToOpenShiftWizardModel;
import org.jboss.tools.openshift.express.internal.ui.wizard.CredentialsWizardPage;
@@ -20,9 +21,20 @@
*/
public class ConnectToOpenShiftWizard extends Wizard {
- private final CredentialsWizardPage page = new CredentialsWizardPage(this, new
ConnectToOpenShiftWizardModel());
+ private final CredentialsWizardPage page;
+ /**
+ * Constructor to use when connecting with the default user.
+ */
public ConnectToOpenShiftWizard() {
+ this(UserModel.getDefault().getRecentUser());
+ }
+
+ /**
+ * Constructor to use when user to connect is known.
+ */
+ public ConnectToOpenShiftWizard(final UserDelegate user) {
+ this.page = new CredentialsWizardPage(this, new ConnectToOpenShiftWizardModel(user));
setNeedsProgressMonitor(true);
}
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java 2012-05-31
09:37:07 UTC (rev 41573)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java 2012-05-31
09:43:06 UTC (rev 41574)
@@ -82,7 +82,7 @@
public List<IApplication> getApplications() throws OpenShiftException,
SocketTimeoutException {
UserDelegate user = getUser();
- if (user == null || !user.hasDomain()) {
+ if (user == null || !user.isConnected() || !user.hasDomain()) {
return Collections.emptyList();
}
return user.getApplications();
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ConnectToOpenShiftWizardModel.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ConnectToOpenShiftWizardModel.java 2012-05-31
09:37:07 UTC (rev 41573)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ConnectToOpenShiftWizardModel.java 2012-05-31
09:43:06 UTC (rev 41574)
@@ -14,19 +14,36 @@
import org.jboss.tools.openshift.express.internal.core.console.UserModel;
/**
- * @author André Dietisheim
+ * @author Andre Dietisheim
*/
public class ConnectToOpenShiftWizardModel implements IUserAwareModel {
- protected UserDelegate created = null;
+
+ protected UserDelegate user = null;
+
+ /**
+ * Default constructor.
+ */
+ public ConnectToOpenShiftWizardModel() {
+ super();
+ }
+
+ /**
+ * Constructor
+ * @param user the user to use to connect to OpenShift.
+ */
+ public ConnectToOpenShiftWizardModel(final UserDelegate user) {
+ this.user = user;
+ }
+
@Override
public UserDelegate getUser() {
- return created == null ? UserModel.getDefault().getRecentUser() : created;
+ return user == null ? UserModel.getDefault().getRecentUser() : user;
}
@Override
public UserDelegate setUser(UserDelegate user) {
UserModel.getDefault().addUser(user);
- created = user;
+ this.user = user;
return user;
}