[jbosstools-commits] JBoss Tools SVN: r43965 - branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Sep 24 10:00:43 EDT 2012


Author: adietish
Date: 2012-09-24 10:00:42 -0400 (Mon, 24 Sep 2012)
New Revision: 43965

Modified:
   branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ConnectToOpenShiftWizardModel.java
   branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java
   branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IUserAwareModel.java
   branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java
Log:
[JBIDE-12693] checking if there's a user before using it (wizard has no user when it is invoked from central. The user will only get set in the 1st wizard page)

Modified: branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ConnectToOpenShiftWizardModel.java
===================================================================
--- branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ConnectToOpenShiftWizardModel.java	2012-09-24 14:00:31 UTC (rev 43964)
+++ branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ConnectToOpenShiftWizardModel.java	2012-09-24 14:00:42 UTC (rev 43965)
@@ -46,5 +46,11 @@
 		this.user = user;
 		return user;
 	}
+	
+	@Override
+	public boolean hasUser() {
+		return getUser() != null;
+	}
 
+
 }

Modified: branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java
===================================================================
--- branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java	2012-09-24 14:00:31 UTC (rev 43964)
+++ branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java	2012-09-24 14:00:42 UTC (rev 43965)
@@ -75,6 +75,7 @@
 	private Text remoteNameText;
 	private Label remoteNameLabel;
 	private RepoPathValidationStatusProvider repoPathValidator;
+	private Link sshLink;
 
 	public GitCloningSettingsWizardPage(OpenShiftExpressApplicationWizard wizard,
 			IOpenShiftExpressWizardModel wizardModel) {
@@ -190,9 +191,7 @@
 		dbc.addValidationStatusProvider(
 				new RemoteNameValidationStatusProvider(remoteNameTextObservable, projectNameModelObservable));
 
-		Link sshLink = new Link(parent, SWT.NONE);
-		sshLink.setText("Make sure that you have SSH keys added to your OpenShift account " + wizardModel.getUser().getUsername() +"\n" 
-				+ "via <a>SSH Keys wizard</a> and that the private keys are listed in <a>SSH2 Preferences</a>");
+		this.sshLink = new Link(parent, SWT.NONE);
 		GridDataFactory.fillDefaults()
 				.align(SWT.FILL, SWT.CENTER).grab(true, false).indent(10, 0).applyTo(sshLink);
 		sshLink.addSelectionListener(onSshPrefs("SSH2 Preferences"));
@@ -280,11 +279,27 @@
 	protected void onPageActivated(DataBindingContext dbc) {
 		enableWidgets(pageModel.isNewProject());
 		repoPathValidator.forceRevalidate();
+		setSSHLinkText();
 		refreshHasRemoteKeys();
 	}
 
+	private void setSSHLinkText() {
+		if (wizardModel.hasUser()) {
+			sshLink.setText("Make sure that you have SSH keys added to your OpenShift account "
+					+ wizardModel.getUser().getUsername() 
+					+ "via <a>SSH Keys wizard</a> and that the private keys are listed in <a>SSH2 Preferences</a>");
+		} else {
+			sshLink.setText("Make sure that you have SSH keys added to your OpenShift account "
+					+ "via <a>SSH Keys wizard</a> and that the private keys are listed in <a>SSH2 Preferences</a>");
+		}
+		sshLink.getParent().layout(true, true);
+	}
+
 	private void refreshHasRemoteKeys() {
 		try {
+			if (!wizardModel.hasUser()) {
+				return;
+			}
 			final LoadKeysJob loadKeysJob = new LoadKeysJob(wizardModel.getUser());
 			new JobChainBuilder(loadKeysJob).andRunWhenDone(new UIJob("") {
 

Modified: branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IUserAwareModel.java
===================================================================
--- branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IUserAwareModel.java	2012-09-24 14:00:31 UTC (rev 43964)
+++ branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IUserAwareModel.java	2012-09-24 14:00:42 UTC (rev 43965)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * 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.wizard;
 
 import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
@@ -2,6 +12,11 @@
 
+/**
+ * @author Andre Dietisheim
+ */
 public interface IUserAwareModel {
 
 	public UserDelegate getUser();
 
+	public boolean hasUser();
+
 	public UserDelegate setUser(UserDelegate user);

Modified: branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java
===================================================================
--- branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java	2012-09-24 14:00:31 UTC (rev 43964)
+++ branches/jbosstools-4.0.0.Alpha2/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java	2012-09-24 14:00:42 UTC (rev 43965)
@@ -462,6 +462,11 @@
 	}
 
 	@Override
+	public boolean hasUser() {
+		return getUser() != null;
+	}
+	
+	@Override
 	public UserDelegate setUser(UserDelegate user) {
 		setProperty(USER, user);
 		resetWizardModel();



More information about the jbosstools-commits mailing list