Author: adietish
Date: 2012-01-20 06:54:38 -0500 (Fri, 20 Jan 2012)
New Revision: 38000
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureUnsharedProject.java
Log:
[JBIDE-10479] adding remote repo to new, 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/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:26:11 UTC (rev 37999)
+++
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)
@@ -13,6 +13,7 @@
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;
@@ -21,6 +22,8 @@
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;
@@ -97,9 +100,17 @@
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);
@@ -127,11 +138,12 @@
* @throws InterruptedException
* @throws InvocationTargetException
* @throws OpenShiftException
- * @throws CoreException
+ * @throws CoreException
*/
private void copyOpenshiftConfigurations(IApplication application, String remoteName,
IProject project,
IProgressMonitor monitor)
- throws IOException, OpenShiftException, InvocationTargetException,
InterruptedException, URISyntaxException, CoreException {
+ throws IOException, OpenShiftException, InvocationTargetException,
InterruptedException,
+ URISyntaxException, CoreException {
Assert.isLegal(project != null);
monitor.subTask(NLS.bind("Copying openshift configuration to project {0}...",
project.getName()));
@@ -142,7 +154,7 @@
".openshift",
"deployments",
"pom.xml" }, project, monitor);
-
+
FileUtil.safeDelete(tmpFolder);
}
Show replies by date