Example usage for org.eclipse.jdt.internal.core JavaModelManager isClasspathBeingResolved

List of usage examples for org.eclipse.jdt.internal.core JavaModelManager isClasspathBeingResolved

Introduction

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

Prototype

public boolean isClasspathBeingResolved(IJavaProject project) 

Source Link

Usage

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

License:Open Source License

public void resolveClasspath(PerProjectInfo perProjectInfo, boolean usePreviousSession,
        boolean addClasspathChange) throws JavaModelException {
    if (CP_RESOLUTION_BP_LISTENERS != null)
        breakpoint(1, this);
    JavaModelManager manager = JavaModelManager.getJavaModelManager();
    boolean isClasspathBeingResolved = manager.isClasspathBeingResolved(this);
    try {//from  www  .  ja  v a2 s .com
        if (!isClasspathBeingResolved) {
            manager.setClasspathBeingResolved(this, true);
        }

        // get raw info inside a synchronized block to ensure that it is consistent
        IClasspathEntry[][] classpath = new IClasspathEntry[2][];
        int timeStamp;
        synchronized (perProjectInfo) {
            classpath[0] = perProjectInfo.rawClasspath;
            classpath[1] = perProjectInfo.referencedEntries;
            // Checking null only for rawClasspath enough
            if (classpath[0] == null)
                classpath = perProjectInfo.readAndCacheClasspath(this);
            timeStamp = perProjectInfo.rawTimeStamp;
        }

        ResolvedClasspath result = resolveClasspath(classpath[0], classpath[1], usePreviousSession,
                true/*resolve chained libraries*/);

        if (CP_RESOLUTION_BP_LISTENERS != null)
            breakpoint(2, this);

        // store resolved info along with the raw info to ensure consistency
        perProjectInfo.setResolvedClasspath(result.resolvedClasspath, result.referencedEntries,
                result.rawReverseMap, result.rootPathToResolvedEntries,
                usePreviousSession ? PerProjectInfo.NEED_RESOLUTION : result.unresolvedEntryStatus, timeStamp,
                addClasspathChange);
    } finally {
        if (!isClasspathBeingResolved) {
            manager.setClasspathBeingResolved(this, false);
        }
        if (CP_RESOLUTION_BP_LISTENERS != null)
            breakpoint(3, this);
    }
}