Example usage for org.eclipse.jdt.core IClasspathEntry getOutputLocation

List of usage examples for org.eclipse.jdt.core IClasspathEntry getOutputLocation

Introduction

In this page you can find the example usage for org.eclipse.jdt.core IClasspathEntry getOutputLocation.

Prototype

IPath getOutputLocation();

Source Link

Document

Returns the full path to the specific location where the builder writes .class files generated for this source entry (entry kind #CPE_SOURCE ).

Usage

From source file:fr.obeo.ariadne.ide.connector.java.internal.explorer.JavaExplorer.java

License:Open Source License

/**
 * Launches the exploration of the given Java project.
 * /*from  w ww.  j ava 2s . c  o m*/
 * @param project
 *            The Java project to explore
 * @param monitor
 *            The progress monitor
 * @return The Component representing the Java project.
 */
public Component doExplore(IProject project, IProgressMonitor monitor) {
    Component ariadneComponent = this.getOrCreateComponent(project);
    IJavaProject iJavaProject = JavaCore.create(project);
    try {
        IClasspathEntry[] rawClasspath = iJavaProject.getRawClasspath();
        for (IClasspathEntry iClasspathEntry : rawClasspath) {
            // We have the source folders of the project.
            IPath inputFolderPath = iClasspathEntry.getPath();
            IPath outputFolderPath = iClasspathEntry.getOutputLocation();

            if (outputFolderPath == null) {
                outputFolderPath = iJavaProject.getOutputLocation();
            }

            // Create the classpath entry
            ClasspathEntry classpathEntry = CodeFactory.eINSTANCE.createClasspathEntry();
            classpathEntry.setInputFolder(inputFolderPath.toString());
            classpathEntry.setOutputFolder(outputFolderPath.toString());
            ariadneComponent.getClasspathEntries().add(classpathEntry);

            int entryKind = iClasspathEntry.getEntryKind();
            if (IClasspathEntry.CPE_SOURCE == entryKind) {
                // Explore its content located in its input folder
                this.exploreClasspathEntry(iJavaProject, iClasspathEntry, classpathEntry, monitor);
            }
        }
    } catch (JavaModelException e) {
        e.printStackTrace();
    }

    return ariadneComponent;
}

From source file:me.gladwell.eclipse.m2e.android.configuration.classpath.ModifySourceFolderOutputClasspathConfigurer.java

License:Open Source License

public void configure(Project project) {
    for (IClasspathEntry entry : project.getClasspath().getEntries()) {
        if (entry.getOutputLocation() != null && entry.getEntryKind() == IClasspathEntry.CPE_SOURCE
                && !entry.getOutputLocation()
                        .equals(project.getJavaProject().getPath().append(ANDROID_CLASSES_FOLDER))) {
            project.getClasspath().removeEntry(entry.getPath());
            project.getClasspath().addSourceEntry(entry.getPath(),
                    project.getJavaProject().getPath().append(ANDROID_CLASSES_FOLDER), true);
        }/*www .ja  v  a2s .c o  m*/
    }
}

From source file:me.gladwell.eclipse.m2e.android.configuration.MavenAndroidClasspathConfigurer.java

License:Open Source License

public void modifySourceFolderOutput(IJavaProject javaProject, AndroidProject project,
        IClasspathDescriptor classpath) {
    for (IClasspathEntry entry : classpath.getEntries()) {
        if (entry.getOutputLocation() != null && entry.getEntryKind() == IClasspathEntry.CPE_SOURCE
                && !entry.getOutputLocation().equals(javaProject.getPath().append(ANDROID_CLASSES_FOLDER))) {
            classpath.removeEntry(entry.getPath());
            classpath.addSourceEntry(entry.getPath(), javaProject.getPath().append(ANDROID_CLASSES_FOLDER),
                    false);/* w ww  .j  a  va 2s . c o  m*/
        }
    }
}

From source file:monolipse.core.internal.BooNature.java

License:Open Source License

private Map<IClasspathEntry, IClasspathEntry> addExclusionPatternsTo(IClasspathEntry[] classpath) {
    Map<IClasspathEntry, IClasspathEntry> modified = new HashMap<IClasspathEntry, IClasspathEntry>();
    for (int i = 0; i < classpath.length; i++) {
        IClasspathEntry entry = classpath[i];
        if (entry.getEntryKind() != IClasspathEntry.CPE_SOURCE)
            continue;

        IPath[] exclusionPatterns = entry.getExclusionPatterns();
        IPath[] newExclusionPatterns = addExclusionPatternsTo(exclusionPatterns);
        if (exclusionPatterns == newExclusionPatterns)
            continue;

        IClasspathEntry newSourceEntry = JavaCore.newSourceEntry(entry.getPath(), entry.getInclusionPatterns(),
                newExclusionPatterns, entry.getOutputLocation(), entry.getExtraAttributes());

        modified.put(entry, newSourceEntry);
    }/*from ww  w. j a  v a  2  s  . c o  m*/
    return modified;
}

From source file:net.rim.ejde.internal.util.ImportUtils.java

License:Open Source License

/**
 * Get the set of output paths of the given <code>IJavaProject</code>.
 *
 * @param javaProject/*from   w ww .  j a  va2  s .  c o m*/
 * @return
 * @throws JavaModelException
 */
static public Set<IPath> getOutputPathSet(IJavaProject javaProject) {
    HashSet<IPath> outputPathSet = new HashSet<IPath>();

    try {
        // get the output folder path of the project
        IPath outputFolderPath = javaProject.getOutputLocation();
        if (outputFolderPath != null) {
            outputPathSet.add(outputFolderPath);
        }

        IClasspathEntry[] _classPathEntries = javaProject.getRawClasspath();

        IClasspathEntry entry;

        for (int i = 0; i < _classPathEntries.length; i++) {
            entry = _classPathEntries[i];
            if (IClasspathEntry.CPE_SOURCE == entry.getEntryKind()) {
                // get the output folder of the entry
                outputFolderPath = entry.getOutputLocation();
                if (outputFolderPath != null) {
                    outputPathSet.add(outputFolderPath);
                }
            }
        }
    } catch (JavaModelException e) {
        _log.debug(e.getMessage(), e);
    }

    return outputPathSet;
}

From source file:net.rim.ejde.internal.util.ImportUtils.java

License:Open Source License

/**
 * Applies the Java Path exclusion patterns to a given project and returns the list of filtered IClasspathEntry
 *
 * @param eclipseProject/*from w  ww.j  av a2 s.c o m*/
 * @param legacyProject
 * @param originalClasspathEntries
 * @return
 */
static public List<IClasspathEntry> applyExclusionPatterns(IProject eclipseProject, Project legacyProject,
        List<IClasspathEntry> originalClasspathEntries) {
    if (null == eclipseProject) {
        throw new IllegalArgumentException("Can't process undefined Eclipse project!");
    }

    if (null == legacyProject) {
        throw new IllegalArgumentException("Can't process undefined legacy project!");
    }

    if (null == originalClasspathEntries) {
        throw new IllegalArgumentException("Can't process undefined Eclipse classpath entries!");
    }

    // TODO: call this when importing projects, rather than from the
    // Compilation Participant
    List<WorkspaceFile> excludedWorkspaceFiles = getFilesToBeExcluded(legacyProject);

    if (excludedWorkspaceFiles.isEmpty() && originalClasspathEntries.isEmpty()) {
        return originalClasspathEntries;
    }

    List<IClasspathEntry> excludedClasspathEntries = new ArrayList<IClasspathEntry>();
    HashMap<IPath, IClasspathEntry> filterMap = new HashMap<IPath, IClasspathEntry>();
    String projectNamePattern = IPath.SEPARATOR + eclipseProject.getName() + IPath.SEPARATOR;
    List<IPath> exclusionPatterns;
    IPath classpathEntryPath, exclusionPatternPath;
    boolean forProject;
    String lastSegment;
    IFolder folder;
    IPath srcLocation;
    IClasspathEntry newEntry;
    IPath[] excludedPaths;
    File file;
    String workspaceFilePath;
    String packageId;

    for (IClasspathEntry entry : originalClasspathEntries) {
        exclusionPatterns = new ArrayList<IPath>();

        classpathEntryPath = entry.getPath();

        if (IClasspathEntry.CPE_SOURCE == entry.getEntryKind()) {
            lastSegment = classpathEntryPath.lastSegment();

            if (lastSegment.equalsIgnoreCase(
                    ImportUtils.getImportPref(ResourceBuilder.LOCALE_INTERFACES_FOLDER_NAME))) {
                continue;
            }

            folder = eclipseProject.getFolder(lastSegment);

            if (folder.isDerived() || !folder.exists()) {
                continue;
            }

            forProject = classpathEntryPath.toString().startsWith(projectNamePattern);

            if (forProject) {
                srcLocation = folder.getLocation();

                if (srcLocation == null || srcLocation.isEmpty()) {
                    return originalClasspathEntries;
                }

                for (WorkspaceFile workspaceFile : excludedWorkspaceFiles) {
                    workspaceFilePath = workspaceFile.toString();
                    file = workspaceFile.getFile();

                    if (null != file && file.exists() && file.isFile()) {
                        // Fix for IDT 149988 - Check type of source folder and file type to prevent duplication for exclusion
                        // patterns
                        if (lastSegment.equalsIgnoreCase(
                                ImportUtils.getImportPref(LegacyImportHelper.PROJECT_SRC_FOLDER_NAME_KEY))) {
                            if (!workspaceFile.getIsJava()) {
                                continue;
                            }
                        } else {
                            if (workspaceFile.getIsJava()) {
                                continue;
                            }
                        }

                        if (workspaceFile.getIsJava() || workspaceFile.getIsResourceHeader()
                                || workspaceFile.getIsResource()) {
                            packageId = IConstants.EMPTY_STRING;
                            try {
                                packageId = PackageUtils.getFilePackageString(file, legacyProject);
                            } catch (CoreException e) {
                                _log.error(e.getMessage());
                                packageId = IConstants.EMPTY_STRING;
                            }
                            workspaceFilePath = File.separator + packageId + File.separator + workspaceFilePath;
                        }
                        exclusionPatternPath = getExclusionPattern(workspaceFile, lastSegment, eclipseProject,
                                legacyProject);

                        if (!exclusionPatternPath.isEmpty()) {
                            exclusionPatterns.add(exclusionPatternPath);
                        }
                    }
                }
            }

            if (exclusionPatterns.isEmpty()) {
                excludedPaths = new IPath[] {};
            } else {
                excludedPaths = exclusionPatterns.toArray(new IPath[exclusionPatterns.size()]);
            }

            newEntry = JavaCore.newSourceEntry(classpathEntryPath, entry.getInclusionPatterns(), excludedPaths,
                    entry.getOutputLocation(), entry.getExtraAttributes());
            filterMap.put(classpathEntryPath, newEntry);
        } else {// IClasspathEntry of type other than CPE_SOURCE
            filterMap.put(classpathEntryPath, entry);
        }
    }

    IPath elementPath;

    for (IClasspathEntry element : originalClasspathEntries) {
        elementPath = element.getPath();
        newEntry = filterMap.get(elementPath);
        if (null != newEntry) {
            excludedClasspathEntries.add(newEntry);
        }
    }

    return excludedClasspathEntries;
}

From source file:net.sf.eclipse.tomcat.TomcatBootstrap.java

License:Open Source License

private void getClassPathEntries(IClasspathEntry[] entries, IJavaProject prj, ArrayList data,
        List selectedPaths, ArrayList visitedProjects, IPath outputPath) {
    for (IClasspathEntry entrie : entries) {
        IClasspathEntry entry = entrie;
        IPath path = entry.getPath();/* ww w. jav  a 2 s .  com*/
        if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
            path = entry.getOutputLocation();
            if (path == null) {
                continue;
            }
        }
        if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
            String prjName = entry.getPath().lastSegment();
            if (!visitedProjects.contains(prjName)) {
                visitedProjects.add(prjName);
                getClassPathEntries(prj.getJavaModel().getJavaProject(prjName), data, selectedPaths,
                        visitedProjects);
            }
            continue;
        } else if (!selectedPaths.contains(path.toFile().toString().replace('\\', '/'))) {
            if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER
                    && !entry.getPath().toString().equals("org.eclipse.jdt.launching.JRE_CONTAINER")) {

                // entires in container are only processed individually
                // if container itself is not selected

                IClasspathContainer container;
                try {
                    container = JavaCore.getClasspathContainer(path, prj);
                } catch (JavaModelException e1) {
                    TomcatLauncherPlugin.log(e1);
                    container = null;
                }

                if (container != null) {
                    getClassPathEntries(container.getClasspathEntries(), prj, data, selectedPaths,
                            visitedProjects, outputPath);
                }
            }
            continue;
        }

        IClasspathEntry[] tmpEntry = null;
        if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
            try {
                tmpEntry = JavaCore.getClasspathContainer(path, prj).getClasspathEntries();
            } catch (JavaModelException e1) {
                TomcatLauncherPlugin.log(e1);
                continue;
            }
        } else {
            tmpEntry = new IClasspathEntry[1];
            tmpEntry[0] = JavaCore.getResolvedClasspathEntry(entry);
        }

        for (IClasspathEntry element : tmpEntry) {
            if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
                IResource res = prj.getProject().getWorkspace().getRoot().findMember(element.getPath());
                if (res != null) {
                    add(data, res);
                } else {
                    add(data, element.getPath());
                }
            } else if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
                IPath srcPath = entry.getOutputLocation();
                if (srcPath != null && !srcPath.equals(outputPath)) {
                    add(data, prj.getProject().getWorkspace().getRoot().findMember(srcPath));
                }
            } else {
                TomcatLauncherPlugin.log(">>> " + element);
                if (element.getPath() != null) {
                    add(data, element.getPath());
                }
            }
        }
    }
}

From source file:net.sf.eclipse.tomcat.TomcatProjectWebclasspathPropertyPage.java

License:Open Source License

private void getClassPathEntries(IClasspathEntry[] entries, IJavaProject prj, ArrayList data,
        IPath outputPath) {/* ww w  .  ja v a  2s. c om*/
    for (int i = 0; i < entries.length; i++) {
        IClasspathEntry entry = entries[i];
        if (entry.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
            String prjName = entry.getPath().lastSegment();
            if (!visitedProjects.contains(prjName)) {
                visitedProjects.add(prjName);
                getClassPathEntries(getJavaProject().getJavaModel().getJavaProject(prjName), data);
            }
        } else if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
            add(data, entry.getPath());
        } else if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
            IPath path = entry.getOutputLocation();
            if (path != null && !path.equals(outputPath)) {
                add(data, path);
            }
        } else if (entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
            if (!entry.getPath().toString().equals("org.eclipse.jdt.launching.JRE_CONTAINER")) {
                // Add container itself, as TomcatBootstrap can actually process them
                // at the moment
                // Basically, users will be able to choose b/w the whole container
                // or some artifacts enclosed by it
                add(data, entry.getPath());

                // Expand container and add its content as individual
                // elements
                IClasspathContainer container;
                try {
                    container = JavaCore.getClasspathContainer(entry.getPath(), prj);
                } catch (JavaModelException e) {
                    TomcatLauncherPlugin.log("failed to obtain classpath container '" + entry.getPath() + "'"
                            + " for project '" + prj.getProject().getName() + "'");
                    TomcatLauncherPlugin.log(e);
                    container = null;
                }

                if (container != null) {
                    getClassPathEntries(container.getClasspathEntries(), prj, data, outputPath);
                }
            }
        } else {
            add(data, entry.getPath());
        }
    }
}

From source file:net.sf.eclipsecs.core.builder.ProjectClassLoader.java

License:Open Source License

/**
 * Helper method to handle a source path.
 * /* w  ww .ja v a2s.  c om*/
 * @param project the original project
 * @param cpURLs the list that is to contain the projects classpath
 * @param entry the actually processed classpath entry
 * @param javapProject the java project
 * @throws JavaModelException an exception with the java project occured
 */
private static void handleSourcePath(IProject project, List<URL> cpURLs, IClasspathEntry entry,
        IJavaProject javapProject) throws JavaModelException {

    IPath sourcePath = entry.getPath();

    // check for if the output path is different to the source path
    IPath outputPath = entry.getOutputLocation();

    if (outputPath == null) {
        sourcePath = javapProject.getOutputLocation();
    } else if (!outputPath.equals(sourcePath)) {

        // make the output path the relevant path since it contains the
        // class files
        sourcePath = outputPath;
    }

    // check if the sourcepath is relative to the project
    IPath projPath = project.getFullPath();

    if (!projPath.equals(sourcePath) && sourcePath.matchingFirstSegments(projPath) > 0) {

        // remove the project part from the source path
        sourcePath = sourcePath.removeFirstSegments(projPath.segmentCount());

        // get the folder for the path
        IFolder sourceFolder = project.getFolder(sourcePath);

        // get the absolute path for the folder
        sourcePath = sourceFolder.getLocation();
    } else if (projPath.equals(sourcePath)) {
        sourcePath = project.getLocation();
    }

    // try to add the path to the classpath
    handlePath(sourcePath, cpURLs);
}

From source file:net.sf.j2s.core.builder.NameEnvironment.java

License:Open Source License

private void computeClasspathLocations(IWorkspaceRoot root, JavaProject javaProject,
        SimpleLookupTable binaryLocationsPerProject) throws CoreException {

    /* Update cycle marker */
    IMarker cycleMarker = javaProject.getCycleMarker();
    if (cycleMarker != null) {
        int severity = JavaCore.ERROR.equals(javaProject.getOption(JavaCore.CORE_CIRCULAR_CLASSPATH, true))
                ? IMarker.SEVERITY_ERROR
                : IMarker.SEVERITY_WARNING;
        if (severity != cycleMarker.getAttribute(IMarker.SEVERITY, severity))
            cycleMarker.setAttribute(IMarker.SEVERITY, severity);
    }/*from  w  w  w  .  java  2  s.  c  o  m*/

    IClasspathEntry[] classpathEntries = javaProject.getExpandedClasspath();
    ArrayList sLocations = new ArrayList(classpathEntries.length);
    ArrayList bLocations = new ArrayList(classpathEntries.length);
    nextEntry: for (int i = 0, l = classpathEntries.length; i < l; i++) {
        ClasspathEntry entry = (ClasspathEntry) classpathEntries[i];
        IPath path = entry.getPath();
        Object target = JavaModel.getTarget(path, true);
        if (target == null)
            continue nextEntry;

        switch (entry.getEntryKind()) {
        case IClasspathEntry.CPE_SOURCE:
            if (!(target instanceof IContainer))
                continue nextEntry;
            IPath outputPath = entry.getOutputLocation() != null ? entry.getOutputLocation()
                    : javaProject.getOutputLocation();
            IContainer outputFolder;
            if (outputPath.segmentCount() == 1) {
                outputFolder = javaProject.getProject();
            } else {
                outputFolder = root.getFolder(outputPath);
                if (!outputFolder.exists())
                    createOutputFolder(outputFolder);
            }
            sLocations.add(ClasspathLocation.forSourceFolder((IContainer) target, outputFolder,
                    entry.fullInclusionPatternChars(), entry.fullExclusionPatternChars(),
                    entry.ignoreOptionalProblems()));
            continue nextEntry;

        case IClasspathEntry.CPE_PROJECT:
            if (!(target instanceof IProject))
                continue nextEntry;
            IProject prereqProject = (IProject) target;
            if (!JavaProject.hasJavaNature(prereqProject))
                continue nextEntry; // if project doesn't have java nature or is not accessible

            JavaProject prereqJavaProject = (JavaProject) JavaCore.create(prereqProject);
            IClasspathEntry[] prereqClasspathEntries = prereqJavaProject.getRawClasspath();
            ArrayList seen = new ArrayList();
            nextPrereqEntry: for (int j = 0, m = prereqClasspathEntries.length; j < m; j++) {
                IClasspathEntry prereqEntry = prereqClasspathEntries[j];
                if (prereqEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
                    Object prereqTarget = JavaModel.getTarget(prereqEntry.getPath(), true);
                    if (!(prereqTarget instanceof IContainer))
                        continue nextPrereqEntry;
                    IPath prereqOutputPath = prereqEntry.getOutputLocation() != null
                            ? prereqEntry.getOutputLocation()
                            : prereqJavaProject.getOutputLocation();
                    IContainer binaryFolder = prereqOutputPath.segmentCount() == 1 ? (IContainer) prereqProject
                            : (IContainer) root.getFolder(prereqOutputPath);
                    if (binaryFolder.exists() && !seen.contains(binaryFolder)) {
                        seen.add(binaryFolder);
                        ClasspathLocation bLocation = ClasspathLocation.forBinaryFolder(binaryFolder, true,
                                entry.getAccessRuleSet());
                        bLocations.add(bLocation);
                        if (binaryLocationsPerProject != null) { // normal builder mode
                            ClasspathLocation[] existingLocations = (ClasspathLocation[]) binaryLocationsPerProject
                                    .get(prereqProject);
                            if (existingLocations == null) {
                                existingLocations = new ClasspathLocation[] { bLocation };
                            } else {
                                int size = existingLocations.length;
                                System.arraycopy(existingLocations, 0,
                                        existingLocations = new ClasspathLocation[size + 1], 0, size);
                                existingLocations[size] = bLocation;
                            }
                            binaryLocationsPerProject.put(prereqProject, existingLocations);
                        }
                    }
                }
            }
            continue nextEntry;

        case IClasspathEntry.CPE_LIBRARY:
            if (target instanceof IResource) {
                IResource resource = (IResource) target;
                ClasspathLocation bLocation = null;
                if (resource instanceof IFile) {
                    AccessRuleSet accessRuleSet = (JavaCore.IGNORE
                            .equals(javaProject.getOption(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, true))
                            && JavaCore.IGNORE.equals(
                                    javaProject.getOption(JavaCore.COMPILER_PB_DISCOURAGED_REFERENCE, true)))
                                            ? null
                                            : entry.getAccessRuleSet();
                    bLocation = ClasspathLocation.forLibrary((IFile) resource, accessRuleSet);
                } else if (resource instanceof IContainer) {
                    AccessRuleSet accessRuleSet = (JavaCore.IGNORE
                            .equals(javaProject.getOption(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, true))
                            && JavaCore.IGNORE.equals(
                                    javaProject.getOption(JavaCore.COMPILER_PB_DISCOURAGED_REFERENCE, true)))
                                            ? null
                                            : entry.getAccessRuleSet();
                    bLocation = ClasspathLocation.forBinaryFolder((IContainer) target, false, accessRuleSet); // is library folder not output folder
                }
                bLocations.add(bLocation);
                if (binaryLocationsPerProject != null) { // normal builder mode
                    IProject p = resource.getProject(); // can be the project being built
                    ClasspathLocation[] existingLocations = (ClasspathLocation[]) binaryLocationsPerProject
                            .get(p);
                    if (existingLocations == null) {
                        existingLocations = new ClasspathLocation[] { bLocation };
                    } else {
                        int size = existingLocations.length;
                        System.arraycopy(existingLocations, 0,
                                existingLocations = new ClasspathLocation[size + 1], 0, size);
                        existingLocations[size] = bLocation;
                    }
                    binaryLocationsPerProject.put(p, existingLocations);
                }
            } else if (target instanceof File) {
                AccessRuleSet accessRuleSet = (JavaCore.IGNORE
                        .equals(javaProject.getOption(JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE, true))
                        && JavaCore.IGNORE.equals(
                                javaProject.getOption(JavaCore.COMPILER_PB_DISCOURAGED_REFERENCE, true))) ? null
                                        : entry.getAccessRuleSet();
                bLocations.add(ClasspathLocation.forLibrary(path.toString(), accessRuleSet));
            }
            continue nextEntry;
        }
    }

    // now split the classpath locations... place the output folders ahead of the other .class file folders & jars
    ArrayList outputFolders = new ArrayList(1);
    this.sourceLocations = new ClasspathMultiDirectory[sLocations.size()];
    if (!sLocations.isEmpty()) {
        sLocations.toArray(this.sourceLocations);

        // collect the output folders, skipping duplicates
        next: for (int i = 0, l = this.sourceLocations.length; i < l; i++) {
            ClasspathMultiDirectory md = this.sourceLocations[i];
            IPath outputPath = md.binaryFolder.getFullPath();
            for (int j = 0; j < i; j++) { // compare against previously walked source folders
                if (outputPath.equals(this.sourceLocations[j].binaryFolder.getFullPath())) {
                    md.hasIndependentOutputFolder = this.sourceLocations[j].hasIndependentOutputFolder;
                    continue next;
                }
            }
            outputFolders.add(md);

            // also tag each source folder whose output folder is an independent folder & is not also a source folder
            for (int j = 0, m = this.sourceLocations.length; j < m; j++)
                if (outputPath.equals(this.sourceLocations[j].sourceFolder.getFullPath()))
                    continue next;
            md.hasIndependentOutputFolder = true;
        }
    }

    // combine the output folders with the binary folders & jars... place the output folders before other .class file folders & jars
    this.binaryLocations = new ClasspathLocation[outputFolders.size() + bLocations.size()];
    int index = 0;
    for (int i = 0, l = outputFolders.size(); i < l; i++)
        this.binaryLocations[index++] = (ClasspathLocation) outputFolders.get(i);
    for (int i = 0, l = bLocations.size(); i < l; i++)
        this.binaryLocations[index++] = (ClasspathLocation) bLocations.get(i);
}