### Eclipse Workspace Patch 1.0
#P org.jboss.tools.openshift.express.ui
Index: src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java
===================================================================
--- src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java	(revision 39399)
+++ src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPageModel.java	(working copy)
@@ -20,6 +20,7 @@
 import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
 import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
 import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
+import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
 
 import com.openshift.express.client.IApplication;
 import com.openshift.express.client.ICartridge;
@@ -48,13 +49,14 @@
 
 	// start with a null value as a marker of non-initialized state (used during
 	// first pass validation)
-	private List<IApplication> existingApplications = null;
+	private List<IApplication> existingApplications = new ArrayList<IApplication>();;
 	private List<ICartridge> cartridges = new ArrayList<ICartridge>();
 	private List<IEmbeddableCartridge> embeddableCartridges = new ArrayList<IEmbeddableCartridge>();
 	private String existingApplicationName;
 	private boolean existingApplicationsLoaded = false;;
 
-	public ApplicationConfigurationWizardPageModel(OpenShiftExpressApplicationWizardModel wizardModel)
+	public ApplicationConfigurationWizardPageModel(
+			OpenShiftExpressApplicationWizardModel wizardModel)
 			throws OpenShiftException {
 		this.wizardModel = wizardModel;
 		setExistingApplication(wizardModel.getApplication());
@@ -98,9 +100,9 @@
 	}
 
 	public void setUseExistingApplication(boolean useExistingApplication) {
-		firePropertyChange(PROPERTY_USE_EXISTING_APPLICATION
-				, wizardModel.isUseExistingApplication()
-				, wizardModel.setUseExistingApplication(useExistingApplication));
+		firePropertyChange(PROPERTY_USE_EXISTING_APPLICATION,
+				wizardModel.isUseExistingApplication(),
+				wizardModel.setUseExistingApplication(useExistingApplication));
 	}
 
 	protected void setUseExistingApplication(IApplication application) {
@@ -111,21 +113,27 @@
 		return existingApplicationName;
 	}
 
-	public void setExistingApplicationName(String applicationName) throws OpenShiftException {
-		firePropertyChange(PROPERTY_EXISTING_APPLICATION_NAME
-				, existingApplicationName
-				, this.existingApplicationName = applicationName);
-		if (applicationName != null) {
-			for (IApplication application : getApplications()) {
-				if (application.getName().equals(applicationName)) {
-					setApplicationName(application.getName());
-					setSelectedCartridge(application.getCartridge());
-					setSelectedEmbeddableCartridges(new HashSet<IEmbeddableCartridge>(
-							application.getEmbeddedCartridges()));
-				}
-			}
+	/**
+	 * Sets the existing application in this model by name. If there's an
+	 * existing application with the given name, all properties related to an
+	 * existing application are also set.
+	 * 
+	 * @param applicationName
+	 * @throws OpenShiftException
+	 * 
+	 * @see #doSetExistingApplication(IApplication)
+	 */
+	public void setExistingApplicationName(String applicationName)
+			throws OpenShiftException {
+		firePropertyChange(PROPERTY_EXISTING_APPLICATION_NAME,
+				this.existingApplicationName,
+				this.existingApplicationName = applicationName);
+
+		if (!StringUtils.isEmpty(applicationName)
+				&& StringUtils.isAlphaNumeric(applicationName)
+				&& isExistingApplication(applicationName)) {
+			doSetExistingApplication(getExistingApplication(applicationName));
 		}
-	
 	}
 
 	public void loadExistingApplications() throws OpenShiftException {
@@ -137,22 +145,26 @@
 	}
 
 	public void setExistingApplicationsLoaded(boolean loaded) {
-		firePropertyChange(PROPERTY_EXISTING_APPLICATIONS_LOADED
-				, this.existingApplicationsLoaded
-				, this.existingApplicationsLoaded = loaded);
+		firePropertyChange(PROPERTY_EXISTING_APPLICATIONS_LOADED,
+				this.existingApplicationsLoaded,
+				this.existingApplicationsLoaded = loaded);
 	}
 
 	public boolean isExistingApplicationsLoaded() {
 		return existingApplicationsLoaded;
 	}
 
-	public boolean isExistingApplication(String applicationName) {
+	public IApplication getExistingApplication(String applicationName) {
 		for (IApplication application : getExistingApplications()) {
 			if (application.getName().equalsIgnoreCase(applicationName)) {
-				return true;
+				return application;
 			}
 		}
-		return false;
+		return null;
+	}
+
+	public boolean isExistingApplication(String applicationName) {
+		return getExistingApplication(applicationName) != null;
 	}
 
 	/**
@@ -160,9 +172,9 @@
 	 *            the existingApplications to set
 	 */
 	public void setExistingApplications(List<IApplication> existingApplications) {
-		firePropertyChange(PROPERTY_EXISTING_APPLICATIONS
-				, this.existingApplications
-				, this.existingApplications = existingApplications);
+		firePropertyChange(PROPERTY_EXISTING_APPLICATIONS,
+				this.existingApplications,
+				this.existingApplications = existingApplications);
 	}
 
 	public List<IApplication> getExistingApplications() {
@@ -175,7 +187,8 @@
 	}
 
 	public void setCartridges(List<ICartridge> cartridges) {
-		firePropertyChange(PROPERTY_CARTRIDGES, this.cartridges, this.cartridges = cartridges);
+		firePropertyChange(PROPERTY_CARTRIDGES, this.cartridges,
+				this.cartridges = cartridges);
 	}
 
 	public List<ICartridge> getCartridges() {
@@ -196,9 +209,9 @@
 	}
 
 	public void setSelectedCartridge(ICartridge cartridge) {
-		firePropertyChange(PROPERTY_SELECTED_CARTRIDGE
-				, wizardModel.getApplicationCartridge()
-				, wizardModel.setApplicationCartridge(cartridge));
+		firePropertyChange(PROPERTY_SELECTED_CARTRIDGE,
+				wizardModel.getApplicationCartridge(),
+				wizardModel.setApplicationCartridge(cartridge));
 	}
 
 	protected void setSelectedCartridge(IApplication application) {
@@ -209,18 +222,54 @@
 		setSelectedCartridge(applicationCartridge);
 	}
 
-	public List<IEmbeddableCartridge> loadEmbeddableCartridges() throws OpenShiftException {
-		List<IEmbeddableCartridge> cartridges = getUser().getEmbeddableCartridges();
+	public List<IEmbeddableCartridge> loadEmbeddableCartridges()
+			throws OpenShiftException {
+		List<IEmbeddableCartridge> cartridges = getUser()
+				.getEmbeddableCartridges();
 		setEmbeddableCartridges(cartridges);
 		return cartridges;
 	}
 
-	public void setExistingApplication(IApplication application) throws OpenShiftException {
-		if(application != null) {
+	/**
+	 * Sets the existing application to this model. All properties that are
+	 * related to an existing application are also set
+	 * 
+	 * @param application
+	 * @throws OpenShiftException
+	 * 
+	 * @see #setExistingApplicationName(String)
+	 * @see #setApplicationName(IApplication)
+	 * @see #setSelectedCartridge(IApplication)
+	 * @see #setSelectedEmbeddableCartridges(Set)
+	 * @see #wizardModel#setApplication
+	 */
+	public void setExistingApplication(IApplication application)
+			throws OpenShiftException {
+		if (application != null) {
 			setExistingApplicationName(application.getName());
+			doSetExistingApplication(application);
+		}
+	}
+
+	/**
+	 * Sets the properties in this model that are related to an existing
+	 * application. It does not set the name of the existing application!.
+	 * 
+	 * @param application
+	 * @throws OpenShiftException
+	 * 
+	 * @see #setApplicationName(IApplication)
+	 * @see #setSelectedCartridge(IApplication)
+	 * @see #setSelectedEmbeddableCartridges(Set)
+	 * @see #wizardModel#setApplication
+	 */
+	protected void doSetExistingApplication(IApplication application)
+			throws OpenShiftException {
+		if (application != null) {
 			setApplicationName(application.getName());
 			setSelectedCartridge(application.getCartridge());
-			setSelectedEmbeddableCartridges(new HashSet<IEmbeddableCartridge>(application.getEmbeddedCartridges()));
+			setSelectedEmbeddableCartridges(new HashSet<IEmbeddableCartridge>(
+					application.getEmbeddedCartridges()));
 			wizardModel.setApplication(application);
 		}
 	}
@@ -230,9 +279,9 @@
 	}
 
 	public void setApplicationName(String applicationName) {
-		firePropertyChange(PROPERTY_APPLICATION_NAME
-				, wizardModel.getApplicationName()
-				, wizardModel.setApplicationName(applicationName));
+		firePropertyChange(PROPERTY_APPLICATION_NAME,
+				wizardModel.getApplicationName(),
+				wizardModel.setApplicationName(applicationName));
 	}
 
 	protected void setApplicationName(IApplication application) {
@@ -248,30 +297,35 @@
 	}
 
 	public void setEmbeddableCartridges(List<IEmbeddableCartridge> cartridges) {
-		firePropertyChange(
-				PROPERTY_EMBEDDABLE_CARTRIDGES, this.embeddableCartridges, this.embeddableCartridges = cartridges);
+		firePropertyChange(PROPERTY_EMBEDDABLE_CARTRIDGES,
+				this.embeddableCartridges,
+				this.embeddableCartridges = cartridges);
 	}
 
 	public List<IEmbeddableCartridge> getEmbeddableCartridges() {
 		return embeddableCartridges;
 	}
 
-	public Set<IEmbeddableCartridge> getSelectedEmbeddableCartridges() throws OpenShiftException {
+	public Set<IEmbeddableCartridge> getSelectedEmbeddableCartridges()
+			throws OpenShiftException {
 		return wizardModel.getSelectedEmbeddableCartridges();
 	}
 
-	public void setSelectedEmbeddableCartridges(Set<IEmbeddableCartridge> selectedEmbeddableCartridges) {
-		firePropertyChange(PROPERTY_SELECTED_EMBEDDABLE_CARTRIDGES,
+	public void setSelectedEmbeddableCartridges(
+			Set<IEmbeddableCartridge> selectedEmbeddableCartridges) {
+		firePropertyChange(
+				PROPERTY_SELECTED_EMBEDDABLE_CARTRIDGES,
 				wizardModel.getSelectedEmbeddableCartridges(),
-				wizardModel.setSelectedEmbeddableCartridges(selectedEmbeddableCartridges));
+				wizardModel
+						.setSelectedEmbeddableCartridges(selectedEmbeddableCartridges));
 	}
 
 	public boolean hasApplication(ICartridge cartridge) {
 		try {
 			return getUser().hasApplication(cartridge);
 		} catch (OpenShiftException e) {
-			OpenShiftUIActivator.log(
-					OpenShiftUIActivator.createErrorStatus("Could not get application by cartridge", e));
+			OpenShiftUIActivator.log(OpenShiftUIActivator.createErrorStatus(
+					"Could not get application by cartridge", e));
 			return false;
 		}
 	}
@@ -280,8 +334,8 @@
 		try {
 			return getUser().hasApplication(applicationName);
 		} catch (OpenShiftException e) {
-			OpenShiftUIActivator.log(
-					OpenShiftUIActivator.createErrorStatus("Could not get application by name", e));
+			OpenShiftUIActivator.log(OpenShiftUIActivator.createErrorStatus(
+					"Could not get application by name", e));
 			return false;
 		}
 	}
@@ -290,7 +344,9 @@
 		return wizardModel.getApplication();
 	}
 
-	public IApplication createJenkinsApplication(String name, IProgressMonitor monitor) throws OpenShiftException {
-		return wizardModel.createApplication(name, ICartridge.JENKINS_14, monitor);
+	public IApplication createJenkinsApplication(String name,
+			IProgressMonitor monitor) throws OpenShiftException {
+		return wizardModel.createApplication(name, ICartridge.JENKINS_14,
+				monitor);
 	}
 }
Index: src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java
===================================================================
--- src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java	(revision 39399)
+++ src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationConfigurationWizardPage.java	(working copy)
@@ -234,8 +234,7 @@
 							.getSelectedApplication();
 					if (selectedApplication != null) {
 						try {
-							pageModel
-									.setExistingApplication(selectedApplication);
+							pageModel.setExistingApplicationName(selectedApplication.getName());
 						} catch (OpenShiftException ex) {
 							OpenShiftUIActivator
 									.log(OpenShiftUIActivator.createErrorStatus(
