[jbosstools-commits] JBoss Tools SVN: r41224 - in trunk/openshift/plugins: org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action and 1 other directories.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon May 21 17:23:55 EDT 2012


Author: xcoulon
Date: 2012-05-21 17:23:55 -0400 (Mon, 21 May 2012)
New Revision: 41224

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/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/DeleteDomainAction.java
   trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
Log:
Fixed - JBIDE-11890
OpenShift Explorer: NPE when launching "New OpenShift Application"

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/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-21 20:09:02 UTC (rev 41223)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateApplicationAction.java	2012-05-21 21:23:55 UTC (rev 41224)
@@ -56,6 +56,7 @@
 		}
 	}
 
+	/**
 	@Override
 	public void selectionChanged(SelectionChangedEvent event) {
 		super.selectionChanged(event);
@@ -68,9 +69,7 @@
 		enableWhenDomainExists();
 	}
 
-	/**
 	 * Enables the current action if the selected User has a default domain. Otherwise, the action is disabled. 
-	 */
 	private void enableWhenDomainExists() {
 		if (selection != null && selection instanceof ITreeSelection) {
 			Object sel = ((ITreeSelection) selection).getFirstElement();
@@ -87,6 +86,7 @@
 			}
 		}
 	}
+	 */
 
 
 }

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-21 20:09:02 UTC (rev 41223)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/DeleteDomainAction.java	2012-05-21 21:23:55 UTC (rev 41224)
@@ -16,8 +16,8 @@
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.ErrorDialog;
 import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.viewers.ITreeSelection;
 import org.eclipse.osgi.util.NLS;
 import org.eclipse.swt.widgets.Display;
@@ -40,7 +40,7 @@
 				.getImageDescriptor(ISharedImages.IMG_ETOOL_DELETE));
 	}
 
-	/*@Override
+	@Override
 	public void validate() {
 		boolean enable = false;
 		if (selection instanceof ITreeSelection
@@ -65,7 +65,7 @@
 			}
 		}
 		setEnabled(enable);
-	}*/
+	}
 
 	@Override
 	public void run() {

Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java	2012-05-21 20:09:02 UTC (rev 41223)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java	2012-05-21 21:23:55 UTC (rev 41224)
@@ -627,27 +627,27 @@
 
 	@Override
 	protected void onPageActivated(final DataBindingContext dbc) {
-		// This is needed for some strange freezing issues when
-		// launching the wizard from the console view. The UI seems to freeze
-		new Thread() {
-			public void run() {
-				Display.getDefault().asyncExec(new Runnable() {
-					public void run() {
-						loadOpenshiftResources(dbc);
-						enableApplicationWidgets(pageModel.isUseExistingApplication());
-						createExistingAppNameContentAssist();
-						// this is needed because of weird issues with UI not
-						// reacting to model changes while wizard runnable is
-						// run. We force another update
-						dbc.updateModels();
-						// sort
-						String[] items = newAppCartridgeCombo.getItems();
-						Arrays.sort(items);
-						newAppCartridgeCombo.setItems(items);
-					}
-				});
-			}
-		}.start();
+		if(checkForDomainExistance()) {
+			new Thread() {
+				public void run() {
+					Display.getDefault().asyncExec(new Runnable() {
+						public void run() {
+							loadOpenshiftResources(dbc);
+							enableApplicationWidgets(pageModel.isUseExistingApplication());
+							createExistingAppNameContentAssist();
+							// this is needed because of weird issues with UI not
+							// reacting to model changes while wizard runnable is
+							// run. We force another update
+							dbc.updateModels();
+							// sort
+							String[] items = newAppCartridgeCombo.getItems();
+							Arrays.sort(items);
+							newAppCartridgeCombo.setItems(items);
+						}
+					});
+				}
+			}.start();
+		}
 	}
 
 	@Override
@@ -655,6 +655,14 @@
 		if (direction == Direction.BACKWARDS) {
 			return;
 		}
+		//event.doit = checkForDomainExistance();
+	}
+
+	/**
+	 * Checks that the user has a domain, opens the creation dialog in case he hasn't, closes the wizard if the user
+	 * does not create a domain (required for any application creation). Otherwise, returns true.
+	 */
+	private boolean checkForDomainExistance() {
 		try {
 			final UserDelegate user = this.pageModel.getUser();
 			if (user != null && !user.hasDomain()) {
@@ -666,16 +674,19 @@
 				if (result != Dialog.OK) {
 					final IWizardContainer container = getWizard().getContainer();
 					if (container instanceof WizardDialog) {
-						event.doit = false;
 						((WizardDialog) container).close();
+						return false;
 					}
 				}
 			}
 		} catch (OpenShiftException e) {
 			Logger.error("Failed to refresh OpenShift account info", e);
+			return false;
 		} catch (SocketTimeoutException e) {
 			Logger.error("Failed to refresh OpenShift account info", e);
+			return false;
 		}
+		return true;
 	}
 
 	protected void loadOpenshiftResources(final DataBindingContext dbc) {



More information about the jbosstools-commits mailing list