[jbosstools-commits] JBoss Tools SVN: r41573 - in branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal: ui/action and 3 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu May 31 05:37:08 EDT 2012


Author: xcoulon
Date: 2012-05-31 05:37:07 -0400 (Thu, 31 May 2012)
New Revision: 41573

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/ui/action/CreateApplicationAction.java
   branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java
   branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/ConnectToOpenShiftWizard.java
   branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java
   branches/jbosstools-3.3.x/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: 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 07:59:04 UTC (rev 41572)
+++ 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 09:37:07 UTC (rev 41573)
@@ -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: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateApplicationAction.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateApplicationAction.java	2012-05-31 07:59:04 UTC (rev 41572)
+++ branches/jbosstools-3.3.x/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)
@@ -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: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java	2012-05-31 07:59:04 UTC (rev 41572)
+++ branches/jbosstools-3.3.x/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)
@@ -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: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/ConnectToOpenShiftWizard.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/viewer/ConnectToOpenShiftWizard.java	2012-05-31 07:59:04 UTC (rev 41572)
+++ branches/jbosstools-3.3.x/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)
@@ -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: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java	2012-05-31 07:59:04 UTC (rev 41572)
+++ branches/jbosstools-3.3.x/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)
@@ -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: branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ConnectToOpenShiftWizardModel.java
===================================================================
--- branches/jbosstools-3.3.x/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ConnectToOpenShiftWizardModel.java	2012-05-31 07:59:04 UTC (rev 41572)
+++ branches/jbosstools-3.3.x/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)
@@ -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;
 	}
 



More information about the jbosstools-commits mailing list