### Eclipse Workspace Patch 1.0
#P org.jboss.tools.openshift.express.ui
Index: src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/IImportApplicationStrategy.java
===================================================================
--- src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/IImportApplicationStrategy.java	(revision 41749)
+++ src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/IImportApplicationStrategy.java	(working copy)
@@ -10,8 +10,6 @@
  ******************************************************************************/
 package org.jboss.tools.openshift.express.internal.ui.wizard.appimport;
 
-import java.util.List;
-
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.IProgressMonitor;
 
@@ -28,6 +26,6 @@
 	 * @return the list of projects that were imported to the workspace.
 	 * @throws Exception
 	 */
-	public List<IProject> execute(IProgressMonitor monitor) throws Exception;
+	public IProject execute(IProgressMonitor monitor) throws Exception;
 
 }
Index: src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AbstractImportApplicationOperation.java
===================================================================
--- src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AbstractImportApplicationOperation.java	(revision 41749)
+++ src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AbstractImportApplicationOperation.java	(working copy)
@@ -33,6 +33,8 @@
 import org.jboss.tools.openshift.egit.core.EGitUtils;
 import org.jboss.tools.openshift.egit.core.GitIgnore;
 import org.jboss.tools.openshift.egit.ui.util.EGitUIUtils;
+import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils;
+import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
 import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
 
 import com.openshift.client.IApplication;
@@ -47,12 +49,15 @@
 	private IApplication application;
 	private String remoteName;
 	protected List<IResource> modifiedResources;
+	private UserDelegate user;
 
-	public AbstractImportApplicationOperation(String projectName, IApplication application, String remoteName) {
+	public AbstractImportApplicationOperation(String projectName, IApplication application, String remoteName,
+			UserDelegate user) {
 		this.projectName = projectName;
 		this.application = application;
 		this.remoteName = remoteName;
 		this.modifiedResources = new ArrayList<IResource>();
+		this.user = user;
 	}
 
 	/**
@@ -148,6 +153,10 @@
 		return remoteName;
 	}
 
+	protected UserDelegate getUser() {
+		return user;
+	}
+
 	/**
 	 * Marks the given resources as modified.
 	 * 
@@ -225,7 +234,7 @@
 	}
 
 	protected IResource setupOpenShiftMavenProfile(IProject project, IProgressMonitor monitor) throws CoreException {
-		if(!OpenShiftMavenProfile.isMavenProject(project)) {
+		if (!OpenShiftMavenProfile.isMavenProject(project)) {
 			return null;
 		}
 
@@ -236,4 +245,35 @@
 		profile.addToPom(project.getName());
 		return profile.savePom(monitor);
 	}
+
+	protected IResource addSettingsFile(IProject project, IProgressMonitor monitor) {
+		monitor.subTask(NLS.bind("Adding settings to project {0}", project.getName()));
+		// This is our project
+		IApplication app = getApplication();
+		// Add the settings here!
+		ExpressServerUtils.updateOpenshiftProjectSettings(
+				project, app, getUser(), getRemoteName(), ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
+		return (IResource) project.getFolder(".settings");
+	}
+
+	protected IProject getSettingsProject(List<IProject> importedProjects) {
+		if (importedProjects == null) {
+			return null;
+		}
+		IProject mainProject = null;
+		if (importedProjects.size() == 1) {
+			if (EGitUtils.hasDotGitFolder(importedProjects.get(0))) {
+				mainProject = importedProjects.get(0);
+			}
+		} else {
+			for (IProject project : importedProjects) {
+				if (EGitUtils.hasDotGitFolder(project)) {
+					mainProject = project;
+					break;
+				}
+			}
+		}
+
+		return mainProject;
+	}
 }
Index: src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java
===================================================================
--- src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java	(revision 41749)
+++ src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java	(working copy)
@@ -6,8 +6,6 @@
 import java.net.URISyntaxException;
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
 import java.util.Set;
 
 import org.eclipse.core.resources.IProject;
@@ -74,31 +72,15 @@
 	@Override
 	public void importProject(IProgressMonitor monitor) throws OpenShiftException, CoreException, InterruptedException,
 			URISyntaxException, InvocationTargetException, IOException {
-		List<IProject> importedProjects =
+		IProject importedProject =
 				new ImportNewProject(
 						getProjectName()
 						, getApplication()
 						, getRemoteName()
-						, getRepositoryFile())
+						, getRepositoryFile()
+						, getUser())
 						.execute(monitor);
-		addSettingsFiles(importedProjects);
-		createServerAdapter(monitor, importedProjects);
-	}
-
-	private void addSettingsFiles(List<IProject> imported) {
-		Iterator<IProject> i = imported.iterator();
-		while (i.hasNext()) {
-			IProject p = i.next();
-			if (p.getFolder(".git").exists()) {
-				// This is our project
-				IApplication app = getApplication();
-				IProject project = p;
-				// Add the settings here!
-				ExpressServerUtils.updateOpenshiftProjectSettings(project, app,
-						getUser(), getRemoteName(), ExpressServerUtils.ATTRIBUTE_DEPLOY_FOLDER_DEFAULT);
-				return;
-			}
-		}
+		createServerAdapter(monitor, importedProject);
 	}
 
 	/**
@@ -130,14 +112,13 @@
 	public void configureUnsharedProject(IProgressMonitor monitor)
 			throws OpenShiftException, InvocationTargetException, InterruptedException, IOException, CoreException,
 			URISyntaxException {
-		List<IProject> importedProjects = new ConfigureUnsharedProject(
+		IProject importedProject = new ConfigureUnsharedProject(
 				getProjectName()
 				, getApplication()
 				, getRemoteName()
 				, getUser())
 				.execute(monitor);
-		addSettingsFiles(importedProjects);
-		createServerAdapter(monitor, importedProjects);
+		createServerAdapter(monitor, importedProject);
 	}
 
 	/**
@@ -169,21 +150,23 @@
 	public void configureGitSharedProject(IProgressMonitor monitor)
 			throws OpenShiftException, InvocationTargetException, InterruptedException, IOException, CoreException,
 			URISyntaxException {
-		List<IProject> importedProjects = new ConfigureGitSharedProject(
+		IProject project = new ConfigureGitSharedProject(
 				getProjectName()
 				, getApplication()
 				, getRemoteName()
 				, getUser())
 				.execute(monitor);
-		createServerAdapter(monitor, importedProjects);
+		createServerAdapter(monitor, project);
 	}
 
-	private void createServerAdapter(IProgressMonitor monitor, List<IProject> importedProjects)
+	private void createServerAdapter(IProgressMonitor monitor, IProject project)
 			throws OpenShiftException {
-		Assert.isTrue(importedProjects.size() > 0);
 		if (isCreateServerAdapter()) {
-			Assert.isTrue(importedProjects.size() > 0);
-			IProject project = importedProjects.get(0);
+			if (project == null) {
+				throw new OpenShiftException(
+						"Could not create a server adapter for your application {0}. No project was found when importing",
+						getApplication().getName());
+			}
 			new ServerAdapterFactory().create(project, this, monitor);
 		}
 	}
Index: src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java
===================================================================
--- src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java	(revision 41749)
+++ src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java	(working copy)
@@ -17,7 +17,6 @@
 import java.beans.PropertyChangeListener;
 
 import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
 import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
 import org.jboss.tools.openshift.egit.ui.util.EGitUIUtils;
 
@@ -82,7 +81,12 @@
 					} else {
 						setRepositoryPath(IOpenShiftExpressWizardModel.DEFAULT_REPOSITORY_PATH);
 					}
-				} 
+				}
+				if(wizardModel.isExistingProject()) {
+					setRemoteName(IOpenShiftExpressWizardModel.EXISTING_PROJECT_REMOTE_NAME_DEFAULT);
+				} else {
+					setRemoteName(IOpenShiftExpressWizardModel.NEW_PROJECT_REMOTE_NAME_DEFAULT);
+				}
 			}
 		};
 	}
@@ -170,13 +174,4 @@
 		return useDefaultRemoteName;
 	}
 
-	public IProject getProject() {
-		String projectName = wizardModel.getProjectName();
-		if (projectName == null) {
-			return null;
-		}
-
-		return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
-	}
-
 }
Index: src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java
===================================================================
--- src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java	(revision 41749)
+++ src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java	(working copy)
@@ -18,6 +18,7 @@
 import org.eclipse.core.databinding.validation.MultiValidator;
 import org.eclipse.core.databinding.validation.ValidationStatus;
 import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Path;
@@ -57,17 +58,19 @@
 public class GitCloningSettingsWizardPage extends AbstractOpenShiftWizardPage implements IWizardPage {
 
 	private GitCloningSettingsWizardPageModel pageModel;
+	private IOpenShiftExpressWizardModel wizardModel;
 	private Button useDefaultRemoteNameButton;
 	private Button useDefaultRepoPathButton;
 	private Text remoteNameText;
 	private Label remoteNameLabel;
 
-	public GitCloningSettingsWizardPage(OpenShiftExpressApplicationWizard wizard, IOpenShiftExpressWizardModel model) {
+	public GitCloningSettingsWizardPage(OpenShiftExpressApplicationWizard wizard, IOpenShiftExpressWizardModel wizardModel) {
 		super(
 				"Import an existing OpenShift application",
 				"Configure the cloning settings by specifying the clone destination if you create a new project, and the git remote name if you're using an existing project.",
 				"Cloning settings", wizard);
-		this.pageModel = new GitCloningSettingsWizardPageModel(model);
+		this.pageModel = new GitCloningSettingsWizardPageModel(wizardModel);
+		this.wizardModel = wizardModel;
 	}
 
 	@Override
@@ -166,10 +169,11 @@
 		// move focus to the project name text control when choosing the 'Use an
 		// existing project' option.
 		useDefaultRemoteNameButton.addSelectionListener(onDefaultRemoteNameUnchecked());
+		final IObservableValue projectNameModelObservable =
+				BeanProperties.value(IOpenShiftExpressWizardModel.PROJECT_NAME).observe(wizardModel);
 
 		dbc.addValidationStatusProvider(
-				new RemoteNameValidationStatusProvider(
-						useDefaultRemoteNameObservable, remoteNameTextObservable));
+				new RemoteNameValidationStatusProvider(remoteNameTextObservable, projectNameModelObservable));
 
 		Link sshPrefsLink = new Link(parent, SWT.NONE);
 		sshPrefsLink.setText("Make sure your SSH key used with the domain is listed in <a>SSH2 Preferences</a>.");
@@ -291,40 +295,43 @@
 	 */
 	class RemoteNameValidationStatusProvider extends MultiValidator {
 
-		private final IObservableValue isDefaultRemoteNameObservable;
 		private final IObservableValue remoteNameObservable;
+		private final IObservableValue projectNameObservable;
 
-		public RemoteNameValidationStatusProvider(IObservableValue isDefaultRemoteName,
-				IObservableValue remoteNameTextObservable) {
-			this.isDefaultRemoteNameObservable = isDefaultRemoteName;
+		public RemoteNameValidationStatusProvider(final IObservableValue remoteNameTextObservable, final IObservableValue projectNameObservable) {
 			this.remoteNameObservable = remoteNameTextObservable;
+			this.projectNameObservable = projectNameObservable;
 		}
 
 		@Override
 		protected IStatus validate() {
 			IStatus status = Status.OK_STATUS;
-			Boolean isDefaultRemoteName = (Boolean) isDefaultRemoteNameObservable.getValue();
 			String remoteName = (String) remoteNameObservable.getValue();
+			String projectName = (String) projectNameObservable.getValue();
 
 			// skip the validation if the user wants to create a new project.
 			// The name and state of the existing project do
 			// not matter...
-			if (isDefaultRemoteName == null
-					|| !isDefaultRemoteName) {
-				if (StringUtils.isEmpty(remoteName)) {
-					return OpenShiftUIActivator.createErrorStatus(
-							"The custom remote name must not be empty.");
-				} else if (!remoteName.matches("\\S+")) {
-					return OpenShiftUIActivator.createErrorStatus(
-							"The custom remote name must not contain spaces.");
-				} else if (hasRemoteName(remoteName, pageModel.getProject())) {
-					return OpenShiftUIActivator.createErrorStatus(NLS.bind(
-							"The existing project already has a remote named {0}.", remoteName));
-				}
+			if (StringUtils.isEmpty(remoteName)) {
+				return OpenShiftUIActivator.createErrorStatus(
+						"The custom remote name must not be empty.");
+			} else if (!remoteName.matches("\\S+")) {
+				return OpenShiftUIActivator.createErrorStatus(
+						"The custom remote name must not contain spaces.");
+			} else if (hasRemoteName(remoteName, getProject(projectName))) {
+				return OpenShiftUIActivator.createErrorStatus(NLS.bind(
+						"The existing project already has a remote named {0}.", remoteName));
 			}
 			return status;
 		}
 
+		public IProject getProject(final String projectName) {
+			if (projectName == null) {
+				return null;
+			}
+			return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+		}
+		
 		private boolean hasRemoteName(String remoteName, IProject project) {
 			try {
 				if (project == null
Index: src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProject.java
===================================================================
--- src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProject.java	(revision 41749)
+++ src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProject.java	(working copy)
@@ -25,6 +25,7 @@
 import org.eclipse.jgit.transport.URIish;
 import org.eclipse.osgi.util.NLS;
 import org.jboss.tools.openshift.egit.core.EGitUtils;
+import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
 import org.jboss.tools.openshift.express.internal.ui.ImportFailedException;
 import org.jboss.tools.openshift.express.internal.ui.WontOverwriteException;
 import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.project.GeneralProjectImportOperation;
@@ -41,8 +42,8 @@
 	private File cloneDestination;
 
 	public ImportNewProject(String projectName, IApplication application, String remoteName,
-			File cloneDestination) {
-		super(projectName, application, remoteName);
+			File cloneDestination, UserDelegate user) {
+		super(projectName, application, remoteName, user);
 		this.cloneDestination = cloneDestination;
 	}
 
@@ -58,7 +59,7 @@
 	 * @throws InvocationTargetException
 	 * @throws IOException 
 	 */
-	public List<IProject> execute(IProgressMonitor monitor)
+	public IProject execute(IProgressMonitor monitor)
 			throws OpenShiftException, CoreException, InterruptedException, URISyntaxException,
 			InvocationTargetException, IOException {
 		if (cloneDestinationExists()) {
@@ -82,11 +83,12 @@
 
 		connectToGitRepo(importedProjects, repositoryFolder, monitor);
 		// TODO: handle multiple projects (is this really possible?)
-		IProject project = importedProjects.get(0);
+		IProject project = getSettingsProject(importedProjects);
 		addToModified(setupGitIgnore(project, monitor));
+		addSettingsFile(project, monitor);
 		addAndCommitModifiedResource(project, monitor);
 		
-		return importedProjects;
+		return getSettingsProject(importedProjects);
 	}
 	
 	@SuppressWarnings("unused")
Index: src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureUnsharedProject.java
===================================================================
--- src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureUnsharedProject.java	(revision 41749)
+++ src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureUnsharedProject.java	(working copy)
@@ -14,8 +14,6 @@
 import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 import java.net.URISyntaxException;
-import java.util.Collections;
-import java.util.List;
 
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.runtime.Assert;
@@ -41,7 +39,7 @@
 
 	public ConfigureUnsharedProject(String projectName, IApplication application, String remoteName,
 			UserDelegate user) {
-		super(projectName, application, remoteName);
+		super(projectName, application, remoteName, user);
 	}
 
 	/**
@@ -80,7 +78,7 @@
 	 * @see #createServerAdapterIfRequired
 	 */
 	@Override
-	public List<IProject> execute(IProgressMonitor monitor)
+	public IProject execute(IProgressMonitor monitor)
 			throws OpenShiftException, InvocationTargetException, InterruptedException, IOException, CoreException,
 			URISyntaxException {
 		// File repositoryFile =
@@ -95,10 +93,11 @@
 		copyOpenshiftConfigurations(getApplication(), getRemoteName(), project, monitor);
 		setupGitIgnore(project, monitor);
 		setupOpenShiftMavenProfile(project, monitor);
+		addSettingsFile(project, monitor);
 		shareProject(project, monitor);
 		addRemoteRepo(getRemoteName(), getApplication().getGitUrl(), EGitUtils.getRepository(project));
 
-		return Collections.singletonList(project);
+		return project;
 	}
 
 	private void shareProject(IProject project, IProgressMonitor monitor) throws CoreException {
Index: src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java
===================================================================
--- src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java	(revision 41749)
+++ src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java	(working copy)
@@ -16,8 +16,6 @@
 import java.net.MalformedURLException;
 import java.net.URISyntaxException;
 import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
 import java.util.regex.Pattern;
 
 import org.eclipse.core.resources.IProject;
@@ -50,7 +48,7 @@
 
 	public ConfigureGitSharedProject(String projectName, IApplication application, String remoteName,
 			UserDelegate user) {
-		super(projectName, application, remoteName);
+		super(projectName, application, remoteName, user);
 	}
 
 	/**
@@ -89,7 +87,7 @@
 	 * @see #createServerAdapterIfRequired
 	 */
 	@Override
-	public List<IProject> execute(IProgressMonitor monitor)
+	public IProject execute(IProgressMonitor monitor)
 			throws OpenShiftException, InvocationTargetException, InterruptedException, IOException, CoreException,
 			URISyntaxException {
 		IProject project = getProject();
@@ -103,11 +101,13 @@
 		addToModified(copyOpenshiftConfigurations(getApplication(), getRemoteName(), project, monitor));
 		addToModified(setupGitIgnore(project, monitor));
 		addToModified(setupOpenShiftMavenProfile(project, monitor));
+		addSettingsFile(project, monitor);
+
 		addRemote(getRemoteName(), getApplication().getUUID(), project);
 
 		addAndCommitModifiedResource(project, monitor);
 
-		return Collections.singletonList(project);
+		return project;
 	}
 
 	private void addRemote(String remoteName, String uuid, IProject project)
