Example usage for org.eclipse.jdt.internal.core ClasspathEntry resolvedChainedLibraries

List of usage examples for org.eclipse.jdt.internal.core ClasspathEntry resolvedChainedLibraries

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core ClasspathEntry resolvedChainedLibraries.

Prototype

public static IPath[] resolvedChainedLibraries(IPath jarPath) 

Source Link

Usage

From source file:org.eclipse.jdt.internal.core.JavaModelManager.java

License:Open Source License

private Set getNonChainingJarsCache() throws CoreException {
    // Even if there is one entry in the cache, just return it. It may not be 
    // the complete cache, but avoid going through all the projects to populate the cache.
    if (this.nonChainingJars != null && this.nonChainingJars.size() > 0) {
        return this.nonChainingJars;
    }/* w w w .ja va  2 s.  c  o  m*/
    Set result = new HashSet();
    IJavaProject[] projects = getJavaModel().getJavaProjects();
    for (int i = 0, length = projects.length; i < length; i++) {
        IJavaProject javaProject = projects[i];
        IClasspathEntry[] classpath = ((JavaProject) javaProject).getResolvedClasspath();
        for (int j = 0, length2 = classpath.length; j < length2; j++) {
            IClasspathEntry entry = classpath[j];
            IPath path;
            if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY && !result.contains(path = entry.getPath())
                    && ClasspathEntry.resolvedChainedLibraries(path).length == 0) {
                result.add(path);
            }
        }
    }
    this.nonChainingJars = Collections.synchronizedSet(result);
    return this.nonChainingJars;
}