[jbosstools-commits] JBoss Tools SVN: r41042 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed May 16 04:43:04 EDT 2012


Author: adietish
Date: 2012-05-16 04:43:04 -0400 (Wed, 16 May 2012)
New Revision: 41042

Modified:
   trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateOrEditDomainAction.java
Log:
cleanup: extracted method

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-16 08:41:37 UTC (rev 41041)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateOrEditDomainAction.java	2012-05-16 08:43:04 UTC (rev 41042)
@@ -40,27 +40,32 @@
 		final ITreeSelection treeSelection = (ITreeSelection) selection;
 		if (selection instanceof ITreeSelection
 				&& treeSelection.getFirstElement() instanceof UserDelegate) {
-			IWizard domainDialog = null;
 			final UserDelegate user = (UserDelegate) treeSelection.getFirstElement();
-			try {
-				if (user.getDefaultDomain() == null || user.getDefaultDomain().getId() == null) {
-					domainDialog = new NewDomainDialog(user);
-				} else {
-					domainDialog = new EditDomainDialog(user);
-				}
-			} catch (OpenShiftException e) {
-				Logger.warn("Failed to retrieve User domain, prompting for creation", e);
-				// let's use the domain creation wizard, then.
-				domainDialog = new NewDomainDialog(user);
-			}  catch (SocketTimeoutException e) {
-				Logger.warn("Failed to retrieve User domain, prompting for creation", e);
-				// let's use the domain creation wizard, then.
-				domainDialog = new NewDomainDialog(user);
-			}
+			IWizard domainDialog = createDomainWizard(user);
 			WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), domainDialog);
 			dialog.create();
 			dialog.open();
 		}
 	}
 
+	private IWizard createDomainWizard(final UserDelegate user) {
+		IWizard domainDialog;
+		try {
+			if (user.getDefaultDomain() == null || user.getDefaultDomain().getId() == null) {
+				domainDialog = new NewDomainDialog(user);
+			} else {
+				domainDialog = new EditDomainDialog(user);
+			}
+		} catch (OpenShiftException e) {
+			Logger.warn("Failed to retrieve User domain, prompting for creation", e);
+			// let's use the domain creation wizard, then.
+			domainDialog = new NewDomainDialog(user);
+		}  catch (SocketTimeoutException e) {
+			Logger.warn("Failed to retrieve User domain, prompting for creation", e);
+			// let's use the domain creation wizard, then.
+			domainDialog = new NewDomainDialog(user);
+		}
+		return domainDialog;
+	}
+
 }



More information about the jbosstools-commits mailing list