You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by st...@apache.org on 2014/06/18 15:40:18 UTC

svn commit: r1603450 - in /sling/trunk/tooling/ide: eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/ eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/

Author: stefanegli
Date: Wed Jun 18 13:40:17 2014
New Revision: 1603450

URL: http://svn.apache.org/r1603450
Log:
SLING-3680 : show a clear 'Project already exists with name ..' when creating a project with an existing-project's-name

Modified:
    sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/AbstractNewMavenBasedSlingApplicationWizard.java
    sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/AbstractNewSlingApplicationWizard.java
    sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/NewSlingContentProjectWizard.java

Modified: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/AbstractNewMavenBasedSlingApplicationWizard.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/AbstractNewMavenBasedSlingApplicationWizard.java?rev=1603450&r1=1603449&r2=1603450&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/AbstractNewMavenBasedSlingApplicationWizard.java (original)
+++ sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/ui/wizards/np/AbstractNewMavenBasedSlingApplicationWizard.java Wed Jun 18 13:40:17 2014
@@ -25,6 +25,7 @@ import org.apache.sling.ide.eclipse.ui.w
 import org.apache.sling.ide.eclipse.ui.wizards.Projects;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -78,6 +79,11 @@ public abstract class AbstractNewMavenBa
         Properties properties = archetypeParametersPage.getProperties();
         ProjectImportConfiguration configuration = new ProjectImportConfiguration();
 
+        IProject existingProject = ResourcesPlugin.getWorkspace().getRoot().getProject(artifactId);
+        if (existingProject!=null && existingProject.exists()) {
+            throw new IllegalStateException("Project already exists with name "+artifactId);
+        }
+
         advance(monitor, 1);
 
         List<IProject> projects = MavenPlugin.getProjectConfigurationManager().createArchetypeProjects(location,

Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/AbstractNewSlingApplicationWizard.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/AbstractNewSlingApplicationWizard.java?rev=1603450&r1=1603449&r2=1603450&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/AbstractNewSlingApplicationWizard.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/AbstractNewSlingApplicationWizard.java Wed Jun 18 13:40:17 2014
@@ -85,7 +85,6 @@ public abstract class AbstractNewSlingAp
     }
 
     public void reportError(Throwable t) {
-        Activator.getDefault().getPluginLogger().error("Error occurred: "+t, t);
         if (t instanceof CoreException) {
             reportError((CoreException) t);
             return;

Modified: sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/NewSlingContentProjectWizard.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/NewSlingContentProjectWizard.java?rev=1603450&r1=1603449&r2=1603450&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/NewSlingContentProjectWizard.java (original)
+++ sling/trunk/tooling/ide/eclipse-ui/src/org/apache/sling/ide/eclipse/ui/wizards/NewSlingContentProjectWizard.java Wed Jun 18 13:40:17 2014
@@ -25,6 +25,7 @@ import org.apache.commons.io.IOUtils;
 import org.apache.sling.ide.eclipse.core.ConfigurationHelper;
 import org.apache.sling.ide.eclipse.ui.WhitelabelSupport;
 import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.Path;
@@ -47,7 +48,10 @@ public class NewSlingContentProjectWizar
 
     @Override
     protected List<IProject> createProjects(IProgressMonitor monitor) throws CoreException {
-
+        IProject existingProject = ResourcesPlugin.getWorkspace().getRoot().getProject(page.getProjectName());
+        if (existingProject!=null && existingProject.exists()) {
+            throw new IllegalStateException("Project already exists with name "+page.getProjectName());
+        }
         IProject project = page.getProjectHandle();
 
         List<Operation> ops = new ArrayList<Operation>();