ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hi...@apache.org
Subject svn commit: r992025 - /ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResourceChangeListener.java
Date Thu, 02 Sep 2010 17:26:04 GMT
Author: hibou
Date: Thu Sep  2 17:26:04 2010
New Revision: 992025

URL: http://svn.apache.org/viewvc?rev=992025&view=rev
Log:
Use the Ivy nature rather than guessing the presence of some container

Modified:
    ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResourceChangeListener.java

Modified: ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResourceChangeListener.java
URL: http://svn.apache.org/viewvc/ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResourceChangeListener.java?rev=992025&r1=992024&r2=992025&view=diff
==============================================================================
--- ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResourceChangeListener.java
(original)
+++ ant/ivy/ivyde/trunk/org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/workspaceresolver/WorkspaceResourceChangeListener.java
Thu Sep  2 17:26:04 2010
@@ -23,6 +23,7 @@ import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.List;
 
+import org.apache.ivyde.eclipse.IvyNature;
 import org.apache.ivyde.eclipse.IvyPlugin;
 import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathContainer;
 import org.apache.ivyde.eclipse.cpcontainer.IvyClasspathUtil;
@@ -75,8 +76,8 @@ public class WorkspaceResourceChangeList
                         return;
                 }
                 try {
-                    if (project.hasNature(JavaCore.NATURE_ID)) {
-                        projectClosed(JavaCore.create(project));
+                    if (project.hasNature(IvyNature.IVY_NATURE)) {
+                        projectClosed(project);
                     }
                 } catch (CoreException e) {
                     // project doesn't exist or is not open: ignore
@@ -94,9 +95,9 @@ public class WorkspaceResourceChangeList
         }
     }
 
-    private void projectClosed(final IJavaProject javaProject) throws JavaModelException
{
+    private void projectClosed(final IProject project) throws JavaModelException {
         // Check if one of Ivy projects is being removed
-        List containers = IvyClasspathUtil.getIvyClasspathContainers(javaProject);
+        List containers = IvyClasspathUtil.getIvyClasspathContainers(project);
         if (containers.isEmpty()) {
             return;
         }
@@ -104,7 +105,7 @@ public class WorkspaceResourceChangeList
         // Found an Ivy container in this project -- notify dependent projects
         // to perform fresh resolve
 
-        List affectedContainers = getAffectedContainers(javaProject.getPath());
+        List affectedContainers = getAffectedContainers(project.getFullPath());
 
         Iterator it = affectedContainers.iterator();
         while (it.hasNext()) {
@@ -132,16 +133,12 @@ public class WorkspaceResourceChangeList
             if (!(resource instanceof IProject)) {
                 continue;
             }
-            IJavaProject javaProject = JavaCore.create((IProject) resource);
-            List/* <IvyClasspathContainer> */containers = IvyClasspathUtil
-                    .getIvyClasspathContainers(javaProject);
-            Iterator/* <IvyClasspathContainer> */itContainer = containers.iterator();
-            while (itContainer.hasNext()) {
-                IvyClasspathContainer ivycp = (IvyClasspathContainer) itContainer.next();
-                if (!ivycp.getConf().isInheritedResolveInWorkspace()) {
-                    continue;
+            try {
+                if (((IProject) resource).hasNature(IvyNature.IVY_NATURE)) {
+                    projects.add(resource);
                 }
-                projects.add(resource);
+            } catch (CoreException e) {
+                IvyPlugin.log(e);
             }
         }
 
@@ -200,7 +197,7 @@ public class WorkspaceResourceChangeList
         return allContainers;
     }
 
-    private List getAllContainersExcludingProjects(Collection sourceProjects) {
+    private List getAllContainersExcludingProjects(Collection openedProjects) {
         List/* <IvyClasspathContainer> */allContainers = new ArrayList();
 
         IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
@@ -214,7 +211,7 @@ public class WorkspaceResourceChangeList
         }
 
         for (int i = 0; i < projects.length; i++) {
-            if (!sourceProjects.contains(projects[i])) {
+            if (!openedProjects.contains(projects[i].getProject())) {
                 allContainers.addAll(IvyClasspathUtil.getIvyClasspathContainers(projects[i]));
             }
         }



Mime
View raw message