Return-Path: Delivered-To: apmail-ant-notifications-archive@minotaur.apache.org Received: (qmail 88292 invoked from network); 2 Sep 2010 17:26:27 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 2 Sep 2010 17:26:27 -0000 Received: (qmail 98199 invoked by uid 500); 2 Sep 2010 17:26:27 -0000 Delivered-To: apmail-ant-notifications-archive@ant.apache.org Received: (qmail 98120 invoked by uid 500); 2 Sep 2010 17:26:26 -0000 Mailing-List: contact notifications-help@ant.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ant.apache.org Delivered-To: mailing list notifications@ant.apache.org Received: (qmail 98113 invoked by uid 99); 2 Sep 2010 17:26:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Sep 2010 17:26:26 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Sep 2010 17:26:25 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E53682388A2C; Thu, 2 Sep 2010 17:26:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: notifications@ant.apache.org From: hibou@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100902172604.E53682388A2C@eris.apache.org> 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/* */containers = IvyClasspathUtil - .getIvyClasspathContainers(javaProject); - Iterator/* */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/* */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])); } }