Author: adietish
Date: 2012-01-20 07:03:08 -0500 (Fri, 20 Jan 2012)
New Revision: 38001
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/ConfigureUnsharedProject.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProject.java
Log:
[JBIDE-10479] adding remote repo to new, unshared AND existing, unshared project (if the
user has chosen to set the remote name to a custom value (!= origin))
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-01-20
11:54:38 UTC (rev 38000)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/AbstractImportApplicationOperation.java 2012-01-20
12:03:08 UTC (rev 38001)
@@ -11,13 +11,17 @@
package org.jboss.tools.openshift.express.internal.ui.wizard.appimport;
import java.io.File;
+import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
import java.net.URISyntaxException;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jgit.lib.Constants;
+import org.eclipse.jgit.lib.Repository;
import org.eclipse.osgi.util.NLS;
import org.jboss.tools.openshift.egit.core.EGitUtils;
import org.jboss.tools.openshift.egit.ui.util.EGitUIUtils;
@@ -65,7 +69,8 @@
* @see AbstractImportApplicationOperation#getApplication()
* @see #getRepositoryPath()
*/
- protected File cloneRepository(IApplication application, String remoteName, File
destination, boolean addToRepoView,
+ protected File cloneRepository(IApplication application, String remoteName, File
destination,
+ boolean addToRepoView,
IProgressMonitor monitor)
throws OpenShiftException, InvocationTargetException, InterruptedException,
URISyntaxException {
monitor.subTask(NLS.bind("Cloning repository for application {0}...",
application.getName()));
@@ -80,6 +85,28 @@
return destination;
}
+ /**
+ * Adds the given remote repo (at the given git uri) with the given name to
+ * the given repository. The remote is not added if the remoteName to use is
+ * "origin".
+ *
+ * @param remoteName
+ * the name to store the remote repo with
+ * @param gitUri
+ * the git uri at which the remote repo is reachable
+ * @param repository
+ * the local repo to add the remote to
+ * @throws MalformedURLException
+ * @throws URISyntaxException
+ * @throws IOException
+ */
+ protected void addRemoteRepo(String remoteName, String gitUri, Repository repository)
throws MalformedURLException,
+ URISyntaxException, IOException {
+ if (remoteName != Constants.DEFAULT_REMOTE_NAME) {
+ EGitUtils.addRemoteTo(remoteName, gitUri, repository);
+ }
+ }
+
protected String getProjectName() {
return projectName;
}
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-01-20
11:54:38 UTC (rev 38000)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureUnsharedProject.java 2012-01-20
12:03:08 UTC (rev 38001)
@@ -13,7 +13,6 @@
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.List;
@@ -22,8 +21,6 @@
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.Repository;
import org.eclipse.osgi.util.NLS;
import org.jboss.ide.eclipse.as.core.util.FileUtil;
import org.jboss.tools.openshift.egit.core.EGitUtils;
@@ -99,18 +96,11 @@
copyOpenshiftConfigurations(getApplication(), getRemoteName(), project, monitor);
createGitIgnore(project, monitor);
shareProject(project, monitor);
-
addRemoteRepo(getRemoteName(), getApplication().getGitUri(),
EGitUtils.getRepository(project));
return Collections.singletonList(project);
}
- private void addRemoteRepo(String remoteName, String gitUri, Repository repository)
throws MalformedURLException, URISyntaxException, IOException {
- if (remoteName != Constants.DEFAULT_REMOTE_NAME) {
- EGitUtils.addRemoteTo(remoteName, gitUri, repository);
- }
- }
-
private void shareProject(IProject project, IProgressMonitor monitor) throws
CoreException {
monitor.subTask(NLS.bind("Sharing project {0}...", project.getName()));
EGitUtils.share(project, monitor);
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-01-20
11:54:38 UTC (rev 38000)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ImportNewProject.java 2012-01-20
12:03:08 UTC (rev 38001)
@@ -80,9 +80,11 @@
}
connectToGitRepo(importedProjects, repositoryFolder, monitor);
+
+
return importedProjects;
}
-
+
@SuppressWarnings("unused")
private void mergeWithApplicationRepository(Repository repository, IApplication
application,
IProgressMonitor monitor)