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

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

Introduction

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

Prototype

public IFolder addFolder(IPath externalFolderPath, boolean scheduleForCreation) 

Source Link

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;//w ww .j av  a 2s  .  co m
    // 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);
    }
}