Example usage for org.eclipse.jdt.internal.core ExternalFoldersManager isExternalFolderPath

List of usage examples for org.eclipse.jdt.internal.core ExternalFoldersManager isExternalFolderPath

Introduction

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

Prototype

public static boolean isExternalFolderPath(IPath externalPath) 

Source Link

Document

Returns true if the provided path is a folder external to the project.

Usage

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

License:Open Source License

private void addToResult(IClasspathEntry rawEntry, IClasspathEntry resolvedEntry, ResolvedClasspath result,
        LinkedHashSet resolvedEntries, ExternalFoldersManager externalFoldersManager, Map oldChainedEntriesMap,
        boolean addAsChainedEntry, Map knownDrives) {

    IPath resolvedPath;//from   w ww.j  a  v a  2  s . c om
    // If it's already been resolved, do not add to resolvedEntries
    if (result.rawReverseMap.get(resolvedPath = resolvedEntry.getPath()) == null) {
        result.rawReverseMap.put(resolvedPath, rawEntry);
        result.rootPathToResolvedEntries.put(resolvedPath, resolvedEntry);
        resolvedEntries.add(resolvedEntry);
        if (addAsChainedEntry) {
            IClasspathEntry chainedEntry = null;
            chainedEntry = (ClasspathEntry) oldChainedEntriesMap.get(resolvedPath);
            if (chainedEntry != null) {
                // This is required to keep the attributes if any added by the user in
                // the previous session such as source attachment path etc.
                copyFromOldChainedEntry((ClasspathEntry) resolvedEntry, (ClasspathEntry) chainedEntry);
            }
        }
    }
    if (resolvedEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY
            && ExternalFoldersManager.isExternalFolderPath(resolvedPath)) {
        externalFoldersManager.addFolder(resolvedPath, true/*scheduleForCreation*/); // no-op if not an external folder or if already registered
    }
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=336046
    // The source attachment path could be external too and in which case, must be added.
    IPath sourcePath = resolvedEntry.getSourceAttachmentPath();
    if (sourcePath != null && driveExists(sourcePath, knownDrives)
            && ExternalFoldersManager.isExternalFolderPath(sourcePath)) {
        externalFoldersManager.addFolder(sourcePath, true);
    }
}