public static List getContainersFromIvyFile()

in org.apache.ivyde.eclipse/src/java/org/apache/ivyde/eclipse/cp/IvyClasspathContainerHelper.java [108:135]


    public static List<IvyClasspathContainer> getContainersFromIvyFile(IFile ivyfile) {
        IJavaProject javaProject = JavaCore.create(ivyfile.getProject());
        List<IvyClasspathContainer> containers = new ArrayList<>();
        if (javaProject == null || !javaProject.exists()) {
            return containers;
        }
        try {
            for (IClasspathEntry entry : javaProject.getRawClasspath()) {
                if (entry != null && entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
                    IPath path = entry.getPath();
                    if (isIvyClasspathContainer(path)) {
                        IClasspathContainer cp = JavaCore.getClasspathContainer(path, javaProject);
                        if (cp instanceof IvyClasspathContainerImpl) {
                            IvyClasspathContainerImpl ivycp = (IvyClasspathContainerImpl) cp;
                            if (ivycp.getConf().getIvyXmlPath()
                                    .equals(ivyfile.getProjectRelativePath().toString())) {
                                containers.add(ivycp);
                            }
                        }
                    }
                }
            }
        } catch (JavaModelException e) {
            // unless there are issues with the JDT, this should never happen
            IvyPlugin.log(e);
        }
        return containers;
    }