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

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

Introduction

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

Prototype

int CPE_CONTAINER

To view the source code for org.eclipse.jdt.core IClasspathEntry CPE_CONTAINER.

Click Source Link

Document

Entry kind constant describing a classpath entry representing a name classpath container.

Usage

From source file:org.eclipse.buckminster.jdt.internal.ClasspathEmitter.java

License:Open Source License

/**
 * This method obtains the raw classpath from the javaProject and scans it
 * for BMClasspathContainer. The first one found is either kept if it
 * corresponds to the target or replaced if not. All other
 * BMClasspathContainers are removed. If no BMClasspathContainer was found,
 * a new one that represents the target is added first in the list. All
 * IClasspathEntry instances are then resolved.
 * /* w  w  w  .  j a v  a  2  s .  c o  m*/
 * @param javaProject
 * @param target
 * @return
 * @throws JavaModelException
 */
private static IClasspathEntry[] changeClasspathForTarget(IJavaProject javaProject, String target)
        throws CoreException {
    boolean entriesChanged = false;
    boolean haveOtherBMCPs = false;
    boolean targetContainerInstalled = false;

    Logger log = Buckminster.getLogger();
    log.debug("Changing classpath for project %s into %s", javaProject.getProject().getName(), target); //$NON-NLS-1$
    IPath desiredContainer = BMClasspathContainer.PATH.append(target);
    IClasspathEntry[] rawEntries = javaProject.readRawClasspath();
    int top = rawEntries.length;
    for (int idx = 0; idx < top; ++idx) {
        IClasspathEntry rawEntry = rawEntries[idx];
        if (rawEntry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
            IPath entryPath = rawEntry.getPath();
            if (BMClasspathContainer.PATH.isPrefixOf(entryPath)) {
                if (!targetContainerInstalled) {
                    if (!desiredContainer.equals(entryPath)) {
                        // This is not the desired container. Replace it.
                        //
                        rawEntries[idx] = JavaCore.newContainerEntry(desiredContainer);
                        entriesChanged = true;
                    }
                    targetContainerInstalled = true;
                } else
                    haveOtherBMCPs = true;
            }
        }
    }

    if (targetContainerInstalled) {
        if (haveOtherBMCPs) {
            // Remove other Buckminster containers
            //
            ArrayList<IClasspathEntry> newEntries = new ArrayList<IClasspathEntry>(top);
            for (int idx = 0; idx < top; ++idx) {
                IClasspathEntry rawEntry = rawEntries[idx];
                if (rawEntry.getEntryKind() != IClasspathEntry.CPE_CONTAINER
                        || rawEntry.getPath().equals(desiredContainer))
                    newEntries.add(rawEntry);
            }
            rawEntries = newEntries.toArray(new IClasspathEntry[newEntries.size()]);
            entriesChanged = true;
        }
    } else {
        rawEntries = ArrayUtils.appendFirst(rawEntries,
                new IClasspathEntry[] { JavaCore.newContainerEntry(desiredContainer) });
        entriesChanged = true;
    }

    log.debug(entriesChanged ? " changes detected" : " no changes detected"); //$NON-NLS-1$ //$NON-NLS-2$

    return entriesChanged ? getResolvedClasspath(javaProject, rawEntries)
            : javaProject.getResolvedClasspath(false);
}

From source file:org.eclipse.buckminster.jdt.internal.ClasspathEmitter.java

License:Open Source License

private static IClasspathEntry[] getResolvedClasspath(IJavaProject project, IClasspathEntry[] entries)
        throws CoreException {
    ArrayList<IClasspathEntry> resolvedEntries = new ArrayList<IClasspathEntry>();
    for (IClasspathEntry rawEntry : entries) {
        switch (rawEntry.getEntryKind()) {
        case IClasspathEntry.CPE_VARIABLE:

            IClasspathEntry resolvedEntry = null;
            try {
                resolvedEntry = JavaCore.getResolvedClasspathEntry(rawEntry);
            } catch (AssertionFailedException e) {
            }//from   w  w w.ja v a2 s .co  m
            if (resolvedEntry == null)
                throw new JavaModelException(
                        ClasspathEntry.validateClasspathEntry(project, rawEntry, false, false));
            break;

        case IClasspathEntry.CPE_CONTAINER:
            IPath entryPath = rawEntry.getPath();
            IClasspathContainer container;
            if (BMClasspathContainer.PATH.isPrefixOf(entryPath))
                //
                // This one is probably not in the project classpath
                //
                container = new BMClasspathContainer(project.getProject(),
                        entryPath.segmentCount() > 1 ? entryPath.lastSegment() : null);
            else
                container = JavaCore.getClasspathContainer(entryPath, project);

            if (container == null)
                throw new JavaModelException(
                        ClasspathEntry.validateClasspathEntry(project, rawEntry, false, false));

            IClasspathEntry[] containerEntries = container.getClasspathEntries();
            if (containerEntries == null)
                continue;

            for (IClasspathEntry cEntry : containerEntries) {
                // if container is exported or restricted, then its
                // nested
                // entries must in turn be exported
                //
                cEntry = ((ClasspathEntry) cEntry).combineWith((ClasspathEntry) rawEntry);
                resolvedEntries.add(cEntry);
            }
            continue;
        }
        resolvedEntries.add(rawEntry);
    }
    return resolvedEntries.toArray(new IClasspathEntry[resolvedEntries.size()]);
}

From source file:org.eclipse.buildship.core.workspace.internal.WtpClasspathUpdater.java

License:Open Source License

private static boolean isGradleClasspathContainer(IClasspathEntry entry) {
    return entry.getEntryKind() == IClasspathEntry.CPE_CONTAINER
            && entry.getPath().equals(GradleClasspathContainer.CONTAINER_PATH);
}

From source file:org.eclipse.che.jdt.core.JavaCore.java

License:Open Source License

/**
 * Creates and returns a new classpath entry of kind <code>CPE_CONTAINER</code>
 * for the given path. The path of the container will be used during resolution so as to map this
 * container entry to a set of other classpath entries the container is acting for.
 * <p>/*from w w w .j a  v a  2s. c o m*/
 * A container entry allows to express indirect references to a set of libraries, projects and variable entries,
 * which can be interpreted differently for each Java project where it is used.
 * A classpath container entry can be resolved using <code>JavaCore.getResolvedClasspathContainer</code>,
 * and updated with <code>JavaCore.classpathContainerChanged</code>
 * <p>
 * A container is exclusively resolved by a <code>ClasspathContainerInitializer</code> registered onto the
 * extension point "org.eclipse.jdt.core.classpathContainerInitializer".
 * <p>
 * A container path must be formed of at least one segment, where: <ul>
 * <li> the first segment is a unique ID identifying the target container, there must be a container initializer registered
 *    onto this ID through the extension point  "org.eclipse.jdt.core.classpathContainerInitializer". </li>
 * <li> the remaining segments will be passed onto the initializer, and can be used as additional
 *    hints during the initialization phase. </li>
 * </ul>
 * <p>
 * Example of an ClasspathContainerInitializer for a classpath container denoting a default JDK container:
 * <pre>
 * containerEntry = JavaCore.newContainerEntry(new Path("MyProvidedJDK/default"));
 *
 * &lt;extension
 *    point="org.eclipse.jdt.core.classpathContainerInitializer"&gt;
 *    &lt;containerInitializer
 *       id="MyProvidedJDK"
 *       class="com.example.MyInitializer"/&gt;
 * </pre>
 * <p>
 * The access rules determine the set of accessible source and class files
 * in the container. If the list of access rules is empty, then all files
 * in this container are accessible.
 * See {@link org.eclipse.jdt.core.IAccessRule} for a detailed description of access
 * rules. Note that if an entry defined by the container defines access rules,
 * then these access rules are combined with the given access rules.
 * The given access rules are considered first, then the entry's access rules are
 * considered.
 * </p>
 * <p>
 * The <code>extraAttributes</code> list contains name/value pairs that must be persisted with
 * this entry. If no extra attributes are provided, an empty array must be passed in.<br>
 * Note that this list should not contain any duplicate name.
 * </p>
 * <p>
 * The <code>isExported</code> flag indicates whether this entry is contributed to dependent
 * projects. If not exported, dependent projects will not see any of the classes from this entry.
 * If exported, dependent projects will concatenate the accessible files patterns of this entry with the
 * accessible files patterns of the projects, and they will concatenate the non accessible files patterns of this entry
 * with the non accessible files patterns of the project.
 * </p>
 * <p>
 * Note that this operation does not attempt to validate classpath containers
 * or access the resources at the given paths.
 * </p>
 *
 * @param containerPath the path identifying the container, it must be formed of at least
 *    one segment (ID+hints)
 * @param accessRules the possibly empty list of access rules for this entry
 * @param extraAttributes the possibly empty list of extra attributes to persist with this entry
 * @param isExported a boolean indicating whether this entry is contributed to dependent
 *    projects in addition to the output location
 * @return a new container classpath entry
 *
 * @see JavaCore#getClasspathContainer(IPath, org.eclipse.jdt.core.IJavaProject)
 * @see JavaCore#setClasspathContainer(IPath, org.eclipse.jdt.core.IJavaProject[], org.eclipse.jdt.core.IClasspathContainer[], org.eclipse.core.runtime.IProgressMonitor)
 * @see JavaCore#newContainerEntry(IPath, boolean)
 * @see JavaCore#newAccessRule(IPath, int)
 * @since 3.1
 */
public static IClasspathEntry newContainerEntry(IPath containerPath, IAccessRule[] accessRules,
        IClasspathAttribute[] extraAttributes, boolean isExported) {

    if (containerPath == null) {
        throw new ClasspathEntry.AssertionFailedException("Container path cannot be null"); //$NON-NLS-1$
    } else if (containerPath.segmentCount() < 1) {
        throw new ClasspathEntry.AssertionFailedException(
                "Illegal classpath container path: \'" + containerPath.makeRelative().toString() //$NON-NLS-1$
                        + "\', must have at least one segment (containerID+hints)"); //$NON-NLS-1$
    }
    if (accessRules == null) {
        accessRules = ClasspathEntry.NO_ACCESS_RULES;
    }
    if (extraAttributes == null) {
        extraAttributes = ClasspathEntry.NO_EXTRA_ATTRIBUTES;
    }
    return new ClasspathEntry(IPackageFragmentRoot.K_SOURCE, IClasspathEntry.CPE_CONTAINER, containerPath,
            ClasspathEntry.INCLUDE_ALL, // inclusion patterns
            ClasspathEntry.EXCLUDE_NONE, // exclusion patterns
            null, // source attachment
            null, // source attachment root
            null, // specific output folder
            isExported, accessRules, true, // combine access rules
            extraAttributes);
}

From source file:org.eclipse.che.jdt.internal.core.ClasspathEntry.java

License:Open Source License

/**
 * Returns a printable representation of this classpath entry.
 *//*from w w  w  .  ja va  2s  .  co m*/
public String toString() {
    StringBuffer buffer = new StringBuffer();
    //      Object target = JavaModel.getTarget(getPath(), true);
    //      if (target instanceof File)
    buffer.append(getPath().toOSString());
    //      else
    //         buffer.append(String.valueOf(getPath()));
    buffer.append('[');
    switch (getEntryKind()) {
    case IClasspathEntry.CPE_LIBRARY:
        buffer.append("CPE_LIBRARY"); //$NON-NLS-1$
        break;
    case IClasspathEntry.CPE_PROJECT:
        buffer.append("CPE_PROJECT"); //$NON-NLS-1$
        break;
    case IClasspathEntry.CPE_SOURCE:
        buffer.append("CPE_SOURCE"); //$NON-NLS-1$
        break;
    case IClasspathEntry.CPE_VARIABLE:
        buffer.append("CPE_VARIABLE"); //$NON-NLS-1$
        break;
    case IClasspathEntry.CPE_CONTAINER:
        buffer.append("CPE_CONTAINER"); //$NON-NLS-1$
        break;
    }
    buffer.append("]["); //$NON-NLS-1$
    switch (getContentKind()) {
    case IPackageFragmentRoot.K_BINARY:
        buffer.append("K_BINARY"); //$NON-NLS-1$
        break;
    case IPackageFragmentRoot.K_SOURCE:
        buffer.append("K_SOURCE"); //$NON-NLS-1$
        break;
    case ClasspathEntry.K_OUTPUT:
        buffer.append("K_OUTPUT"); //$NON-NLS-1$
        break;
    }
    buffer.append(']');
    if (getSourceAttachmentPath() != null) {
        buffer.append("[sourcePath:"); //$NON-NLS-1$
        buffer.append(getSourceAttachmentPath());
        buffer.append(']');
    }
    if (getSourceAttachmentRootPath() != null) {
        buffer.append("[rootPath:"); //$NON-NLS-1$
        buffer.append(getSourceAttachmentRootPath());
        buffer.append(']');
    }
    buffer.append("[isExported:"); //$NON-NLS-1$
    buffer.append(this.isExported);
    buffer.append(']');
    IPath[] patterns = this.inclusionPatterns;
    int length;
    if ((length = patterns == null ? 0 : patterns.length) > 0) {
        buffer.append("[including:"); //$NON-NLS-1$
        for (int i = 0; i < length; i++) {
            buffer.append(patterns[i]);
            if (i != length - 1) {
                buffer.append('|');
            }
        }
        buffer.append(']');
    }
    patterns = this.exclusionPatterns;
    if ((length = patterns == null ? 0 : patterns.length) > 0) {
        buffer.append("[excluding:"); //$NON-NLS-1$
        for (int i = 0; i < length; i++) {
            buffer.append(patterns[i]);
            if (i != length - 1) {
                buffer.append('|');
            }
        }
        buffer.append(']');
    }
    if (this.accessRuleSet != null) {
        buffer.append('[');
        buffer.append(this.accessRuleSet.toString(false/*on one line*/));
        buffer.append(']');
    }
    if (this.entryKind == CPE_PROJECT) {
        buffer.append("[combine access rules:"); //$NON-NLS-1$
        buffer.append(this.combineAccessRules);
        buffer.append(']');
    }
    if (getOutputLocation() != null) {
        buffer.append("[output:"); //$NON-NLS-1$
        buffer.append(getOutputLocation());
        buffer.append(']');
    }
    if ((length = this.extraAttributes == null ? 0 : this.extraAttributes.length) > 0) {
        buffer.append("[attributes:"); //$NON-NLS-1$
        for (int i = 0; i < length; i++) {
            buffer.append(this.extraAttributes[i]);
            if (i != length - 1) {
                buffer.append(',');
            }
        }
        buffer.append(']');
    }
    return buffer.toString();
}

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

License:Open Source License

/**
 * This is a helper method returning the resolved classpath for the project
 * as a list of simple (non-variable, non-container) classpath entries.
 * All classpath variable and classpath container entries in the project's
 * raw classpath will be replaced by the simple classpath entries they
 * resolve to.//from   w  ww  .  j ava 2s  . c o m
 * <p>
 * The resulting resolved classpath is accurate for the given point in time.
 * If the project's raw classpath is later modified, or if classpath
 * variables are changed, the resolved classpath can become out of date.
 * Because of this, hanging on resolved classpath is not recommended.
 * </p>
 * <p>
 * Note that if the resolution creates duplicate entries
 * (i.e. {@link IClasspathEntry entries} which are {@link Object#equals(Object)}),
 * only the first one is added to the resolved classpath.
 * </p>
 *
 * @see IClasspathEntry
 */
public IClasspathEntry[] getResolvedClasspath() throws JavaModelException {
    if (resolvedClasspath == null) {
        ResolvedClasspath result = new ResolvedClasspath();
        LinkedHashSet<IClasspathEntry> resolvedEntries = new LinkedHashSet<>();
        for (IClasspathEntry entry : getRawClasspath()) {
            switch (entry.getEntryKind()) {
            case IClasspathEntry.CPE_LIBRARY:
            case IClasspathEntry.CPE_SOURCE:
                addToResult(entry, entry, result, resolvedEntries);
                break;
            case IClasspathEntry.CPE_CONTAINER:
                IClasspathContainer container = JavaCore.getClasspathContainer(entry.getPath(), this);
                for (IClasspathEntry classpathEntry : container.getClasspathEntries()) {
                    addToResult(entry, classpathEntry, result, resolvedEntries);
                }
                break;
            }
        }
        result.resolvedClasspath = new IClasspathEntry[resolvedEntries.size()];
        resolvedEntries.toArray(result.resolvedClasspath);
        resolvedClasspath = result;
    }

    return resolvedClasspath.resolvedClasspath;
}

From source file:org.eclipse.che.jdt.internal.core.search.JavaSearchScope.java

License:Open Source License

/**
 * Add a path to current java search scope or all project fragment roots if null.
 * Use project resolved classpath to retrieve and store access restriction on each classpath entry.
 * Recurse if dependent projects are found.
 *
 * @param javaProject/*from  w w  w.java 2 s.c  o m*/
 *         Project used to get resolved classpath entries
 * @param pathToAdd
 *         Path to add in case of single element or null if user want to add all project package fragment roots
 * @param includeMask
 *         Mask to apply on classpath entries
 * @param projectsToBeAdded
 *         Set to avoid infinite recursion
 * @param visitedProjects
 *         Set to avoid adding twice the same project
 * @param referringEntry
 *         Project raw entry in referring project classpath
 * @throws org.eclipse.jdt.core.JavaModelException
 *         May happen while getting java model info
 */
void add(JavaProject javaProject, IPath pathToAdd, int includeMask, HashSet projectsToBeAdded,
        HashSet visitedProjects, IClasspathEntry referringEntry) throws JavaModelException {
    //        IProject project = javaProject.getProject();
    //        if (!project.isAccessible() || !visitedProjects.add(project)) return;

    IPath projectPath = javaProject.getFullPath();
    String projectPathString = projectPath.toString();
    addEnclosingProjectOrJar(projectPath);

    IClasspathEntry[] entries = javaProject.getResolvedClasspath();
    //        IJavaModel model = javaProject.getJavaModel();
    //        JavaModelManager.PerProjectInfo perProjectInfo = javaProject.getPerProjectInfo();
    for (int i = 0, length = entries.length; i < length; i++) {
        IClasspathEntry entry = entries[i];
        AccessRuleSet access = null;
        ClasspathEntry cpEntry = (ClasspathEntry) entry;
        if (referringEntry != null) {
            // Add only exported entries.
            // Source folder are implicitly exported.
            if (!entry.isExported() && entry.getEntryKind() != IClasspathEntry.CPE_SOURCE) {
                continue;
            }
            cpEntry = cpEntry.combineWith((ClasspathEntry) referringEntry);
            //            cpEntry = ((ClasspathEntry)referringEntry).combineWith(cpEntry);
        }
        access = cpEntry.getAccessRuleSet();
        switch (entry.getEntryKind()) {
        case IClasspathEntry.CPE_LIBRARY:
            IClasspathEntry rawEntry = null;
            //                    Map rootPathToRawEntries = perProjectInfo.rootPathToRawEntries;
            //                    if (rootPathToRawEntries != null) {
            //                        rawEntry = (IClasspathEntry)rootPathToRawEntries.get(entry.getPath());
            //                    }
            //                    if (rawEntry == null) break;
            rawKind: switch (cpEntry.getEntryKind()) {
            case IClasspathEntry.CPE_LIBRARY:
            case IClasspathEntry.CPE_VARIABLE:
                if ((includeMask & APPLICATION_LIBRARIES) != 0) {
                    IPath path = entry.getPath();
                    if (pathToAdd == null || pathToAdd.equals(path)) {
                        //                                    Object target = JavaModel.getTarget(path, false/*don't check existence*/);
                        //                                    if (target instanceof IFolder) // case of an external folder
                        //                                        path = ((IFolder)target).getFullPath();
                        String pathToString = path.getDevice() == null ? path.toString() : path.toOSString();
                        add(projectPath.toString(), "", pathToString, false/*not a package*/, access); //$NON-NLS-1$
                        addEnclosingProjectOrJar(entry.getPath());
                    }
                }
                break;
            case IClasspathEntry.CPE_CONTAINER:
                IClasspathContainer container = JavaCore.getClasspathContainer(rawEntry.getPath(), javaProject);
                if (container == null)
                    break;
                switch (container.getKind()) {
                case IClasspathContainer.K_APPLICATION:
                    if ((includeMask & APPLICATION_LIBRARIES) == 0)
                        break rawKind;
                    break;
                case IClasspathContainer.K_SYSTEM:
                case IClasspathContainer.K_DEFAULT_SYSTEM:
                    if ((includeMask & SYSTEM_LIBRARIES) == 0)
                        break rawKind;
                    break;
                default:
                    break rawKind;
                }
                IPath path = entry.getPath();
                if (pathToAdd == null || pathToAdd.equals(path)) {
                    Object target = JavaModel.getTarget(path, false/*don't check existence*/);
                    if (target instanceof IFolder) // case of an external folder
                        path = ((IFolder) target).getFullPath();
                    String pathToString = path.getDevice() == null ? path.toString() : path.toOSString();
                    add(projectPath.toString(), "", pathToString, false/*not a package*/, access); //$NON-NLS-1$
                    addEnclosingProjectOrJar(entry.getPath());
                }
                break;
            }
            break;
        case IClasspathEntry.CPE_PROJECT:
            //                    if ((includeMask & REFERENCED_PROJECTS) != 0) {
            //                        IPath path = entry.getPath();
            //                        if (pathToAdd == null || pathToAdd.equals(path)) {
            //                            JavaProject referencedProject = (JavaProject)model.getJavaProject(path.lastSegment());
            //                            if (!projectsToBeAdded
            //                                    .contains(referencedProject)) { // do not recurse if depending project was used to create the scope
            //                                add(referencedProject, null, includeMask, projectsToBeAdded, visitedProjects, cpEntry);
            //                            }
            //                        }
            //                    }
            break;
        case IClasspathEntry.CPE_SOURCE:
            if ((includeMask & SOURCES) != 0) {
                IPath path = entry.getPath();
                if (pathToAdd == null || pathToAdd.equals(path)) {
                    add(projectPath.toString(),
                            path.toOSString()
                                    .substring(projectPath.toString().length()
                                            + 1)/*Util.relativePath(path, 1*//*remove project segment*//*)*/,
                            projectPathString, false/*not a
                                                    package*/, access);
                }
            }
            break;
        }
    }
}

From source file:org.eclipse.che.plugin.java.plain.server.rest.ClasspathUpdaterService.java

License:Open Source License

private IClasspathEntry[] createModifiedEntry(List<ClasspathEntryDto> entries) {
    List<IClasspathEntry> coreClasspathEntries = new ArrayList<>(entries.size());
    for (ClasspathEntryDto entry : entries) {
        IPath path = fromOSString(entry.getPath());
        int entryKind = entry.getEntryKind();
        if (IClasspathEntry.CPE_LIBRARY == entryKind) {
            coreClasspathEntries.add(newLibraryEntry(path, null, null));
        } else if (IClasspathEntry.CPE_SOURCE == entryKind) {
            coreClasspathEntries.add(newSourceEntry(path));
        } else if (IClasspathEntry.CPE_VARIABLE == entryKind) {
            coreClasspathEntries.add(newVariableEntry(path, null, null));
        } else if (IClasspathEntry.CPE_CONTAINER == entryKind) {
            coreClasspathEntries.add(newContainerEntry(path));
        } else if (IClasspathEntry.CPE_PROJECT == entryKind) {
            coreClasspathEntries.add(newProjectEntry(path));
        }/*from   w w w.j  a v  a 2  s  . co m*/
    }
    return coreClasspathEntries.toArray(new IClasspathEntry[coreClasspathEntries.size()]);
}

From source file:org.eclipse.che.plugin.java.server.rest.ClasspathService.java

License:Open Source License

private List<ClasspathEntryDto> convertClasspathEntriesToDTO(IJavaProject javaProject,
        IClasspathEntry[] entries) throws JavaModelException {
    List<ClasspathEntryDto> entriesDTO = new ArrayList<>(entries.length);
    for (IClasspathEntry entry : entries) {
        ClasspathEntryDto entryDTO = DtoFactory.getInstance().createDto(ClasspathEntryDto.class);
        entryDTO.withEntryKind(entry.getEntryKind()).withPath(entry.getPath().toOSString());
        if (IClasspathEntry.CPE_CONTAINER == entry.getEntryKind()) {

            IClasspathEntry[] subEntries = JavaCore.getClasspathContainer(entry.getPath(), javaProject)
                    .getClasspathEntries();

            entryDTO.withExpandedEntries(convertClasspathEntriesToDTO(javaProject, subEntries));
        }//from w  w w.ja  v a2  s.  c  o m
        entriesDTO.add(entryDTO);
    }

    return entriesDTO;
}

From source file:org.eclipse.che.plugin.java.testing.MavenTestClasspathProvider.java

License:Open Source License

private Stream<ClasspathEntryDto> toResolvedClassPath(Stream<ClasspathEntryDto> rawClasspath) {
    return rawClasspath.flatMap(dto -> {
        if (dto.getEntryKind() == IClasspathEntry.CPE_CONTAINER) {
            return toResolvedClassPath(dto.getExpandedEntries().stream());
        } else {/*  w w  w  .j a  va  2s.c  om*/
            return Stream.of(dto);
        }
    });
}