sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject svn commit: r1804086 - /sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/ContentPackageProjectConfigurator.java
Date Fri, 04 Aug 2017 09:47:32 GMT
Author: kwin
Date: Fri Aug  4 09:47:32 2017
New Revision: 1804086

URL: http://svn.apache.org/viewvc?rev=1804086&view=rev
Log:
SLING-6190 only try to modify natures in case something new was really added

Modified:
    sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/ContentPackageProjectConfigurator.java

Modified: sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/ContentPackageProjectConfigurator.java
URL: http://svn.apache.org/viewvc/sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/ContentPackageProjectConfigurator.java?rev=1804086&r1=1804085&r2=1804086&view=diff
==============================================================================
--- sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/ContentPackageProjectConfigurator.java
(original)
+++ sling/trunk/tooling/ide/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/ContentPackageProjectConfigurator.java
Fri Aug  4 09:47:32 2017
@@ -122,17 +122,22 @@ public class ContentPackageProjectConfig
         String[] oldNatureIds = description.getNatureIds();
         Set<String> newNatureIdSet = new TreeSet<String>();
         newNatureIdSet.addAll(Arrays.asList(oldNatureIds));
-        newNatureIdSet.addAll(Arrays.asList(natureIdsToAdd));
-        String[] newNatureIds = newNatureIdSet.toArray(new String[newNatureIdSet.size()]);
-        IStatus status = project.getWorkspace().validateNatureSet(newNatureIds);
-        // check the status and decide what to do
-        if (status.getCode() == IStatus.OK) {
-            description.setNatureIds(newNatureIds);
-            project.setDescription(description, IResource.KEEP_HISTORY, progressMonitor);
+        // check if there is a nature change really requested
+        if (newNatureIdSet.addAll(Arrays.asList(natureIdsToAdd))) {
+            String[] newNatureIds = newNatureIdSet.toArray(new String[newNatureIdSet.size()]);
+            IStatus status = project.getWorkspace().validateNatureSet(newNatureIds);
+            // check the status and decide what to do
+            if (status.getCode() == IStatus.OK) {
+                trace("Modifiying natures of project {1} to {0}", Arrays.toString(newNatureIds),
project);
+                description.setNatureIds(newNatureIds);
+                project.setDescription(description, IResource.KEEP_HISTORY, progressMonitor);
+            } else {
+                StatusManager.getManager().handle(status, StatusManager.LOG|StatusManager.SHOW);
+                // add marker
+                addMarker(pomResource, "Could not add all necessary WTP natures: " + status.getMessage(),
IMarker.SEVERITY_ERROR);
+            }
         } else {
-            StatusManager.getManager().handle(status, StatusManager.LOG|StatusManager.SHOW);
-            // add marker
-            addMarker(pomResource, "Could not add all necessary WTP natures: " + status.getMessage(),
IMarker.SEVERITY_ERROR);
+            trace("Not modifiying natures of project {1} as required natures {0} are already
set ", Arrays.toString(natureIdsToAdd), project);
         }
     }
 



Mime
View raw message