[jbosstools-commits] JBoss Tools SVN: r41798 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard: appimport and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Jun 7 17:48:27 EDT 2012


Author: adietish
Date: 2012-06-07 17:48:26 -0400 (Thu, 07 Jun 2012)
New Revision: 41798

Modified:
   trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java
   trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java
   trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
   trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java
   trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AbstractImportApplicationOperation.java
   trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java
   trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureUnsharedProject.java
   trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/IImportApplicationStrategy.java
   trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProject.java
Log:
[JBIDE-12112] moved settings file creation to import strategies, corrected validation in UI

Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java	2012-06-07 21:42:36 UTC (rev 41797)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPage.java	2012-06-07 21:48:26 UTC (rev 41798)
@@ -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 (StringUtils.isEmpty(projectName)) {
+				return null;
+			}
+			return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+		}
+		
 		private boolean hasRemoteName(String remoteName, IProject project) {
 			try {
 				if (project == null

Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java	2012-06-07 21:42:36 UTC (rev 41797)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/GitCloningSettingsWizardPageModel.java	2012-06-07 21:48:26 UTC (rev 41798)
@@ -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);
-	}
-
 }

Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java	2012-06-07 21:42:36 UTC (rev 41797)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java	2012-06-07 21:48:26 UTC (rev 41798)
@@ -61,7 +61,7 @@
 	private static final int APP_CREATE_TIMEOUT = 6 * 60 * 1000;
 	private static final int APP_WAIT_TIMEOUT = 10 * 60 * 1000;
 	private static final long EMBED_CARTRIDGES_TIMEOUT = 2 * 60 * 1000;
-	private static final int IMPORT_TIMEOUT = 1 * 60 * 1000;
+	private static final int IMPORT_TIMEOUT = 5 * 60 * 1000;
 
 	private final boolean skipCredentialsPage;
 

Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java	2012-06-07 21:42:36 UTC (rev 41797)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java	2012-06-07 21:48:26 UTC (rev 41798)
@@ -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,33 +72,17 @@
 	@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);
+		createServerAdapter(monitor, importedProject);
 	}
 
-	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;
-			}
-		}
-	}
-
 	/**
 	 * Enables the user chosen, unshared project to be used on the chosen
 	 * OpenShift application. Clones the application git repository, copies the
@@ -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);
 		}
 	}

Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AbstractImportApplicationOperation.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AbstractImportApplicationOperation.java	2012-06-07 21:42:36 UTC (rev 41797)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AbstractImportApplicationOperation.java	2012-06-07 21:48:26 UTC (rev 41798)
@@ -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;
+	}
 }

Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java	2012-06-07 21:42:36 UTC (rev 41797)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java	2012-06-07 21:48:26 UTC (rev 41798)
@@ -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)

Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureUnsharedProject.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureUnsharedProject.java	2012-06-07 21:42:36 UTC (rev 41797)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureUnsharedProject.java	2012-06-07 21:48:26 UTC (rev 41798)
@@ -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 {

Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/IImportApplicationStrategy.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/IImportApplicationStrategy.java	2012-06-07 21:42:36 UTC (rev 41797)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/IImportApplicationStrategy.java	2012-06-07 21:48:26 UTC (rev 41798)
@@ -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;
 
 }

Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProject.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProject.java	2012-06-07 21:42:36 UTC (rev 41797)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProject.java	2012-06-07 21:48:26 UTC (rev 41798)
@@ -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")



More information about the jbosstools-commits mailing list