Author: adietish
Date: 2012-01-20 09:22:22 -0500 (Fri, 20 Jan 2012)
New Revision: 38002
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/UnCommittedChangesException.java
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java
Log:
[JBIDE-10479] refuse to import a project with uncommitted changes
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/UnCommittedChangesException.java
===================================================================
---
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/UnCommittedChangesException.java
(rev 0)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/UnCommittedChangesException.java 2012-01-20
14:22:22 UTC (rev 38002)
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.ui;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class UnCommittedChangesException extends OpenShiftUIException {
+
+ private static final long serialVersionUID = 1L;
+
+ public UnCommittedChangesException(String message, Object... arguments) {
+ super(message, arguments);
+ }
+}
Property changes on:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/UnCommittedChangesException.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
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-01-20
12:03:08 UTC (rev 38001)
+++
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/appimport/ConfigureGitSharedProject.java 2012-01-20
14:22:22 UTC (rev 38002)
@@ -31,6 +31,7 @@
import org.jboss.tools.openshift.egit.core.EGitUtils;
import org.jboss.tools.openshift.egit.core.GitIgnore;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
+import org.jboss.tools.openshift.express.internal.ui.UnCommittedChangesException;
import org.jboss.tools.openshift.express.internal.ui.utils.FileUtils;
import org.jboss.tools.openshift.express.internal.ui.utils.ResourceUtils;
@@ -96,6 +97,11 @@
IProject project = getProject();
Assert.isTrue(EGitUtils.isSharedWithGit(project));
+ if (EGitUtils.isDirty(EGitUtils.getRepository(project))) {
+ throw new UnCommittedChangesException(
+ "The project {0} has uncommitted changes. Please commit those changes
first.", project.getName());
+ }
+
addToModified(copyOpenshiftConfigurations(getApplication(), getRemoteName(), project,
monitor));
addToModified(setupGitIgnore(project, monitor));
addToModified(setupOpenShiftMavenProfile(project, monitor));
@@ -104,7 +110,7 @@
getRemoteName(),
getApplication().getGitUri(),
EGitUtils.getRepository(project));
-
+
addAndCommitModifiedResource(project, monitor);
return Collections.singletonList(project);
@@ -162,9 +168,9 @@
cloneRepository(application, remoteName, tmpFolder, false, monitor);
Collection<IResource> copiedResources =
- ResourceUtils.copy(tmpFolder, new String[] {
- ".openshift",
- "deployments",
+ ResourceUtils.copy(tmpFolder, new String[] {
+ ".openshift",
+ "deployments",
"pom.xml" }, project, monitor);
FileUtil.safeDelete(tmpFolder);
return copiedResources;