Example usage for org.eclipse.jdt.core IClasspathContainer K_DEFAULT_SYSTEM

List of usage examples for org.eclipse.jdt.core IClasspathContainer K_DEFAULT_SYSTEM

Introduction

In this page you can find the example usage for org.eclipse.jdt.core IClasspathContainer K_DEFAULT_SYSTEM.

Prototype

int K_DEFAULT_SYSTEM

To view the source code for org.eclipse.jdt.core IClasspathContainer K_DEFAULT_SYSTEM.

Click Source Link

Document

Kind for a container mapping to a default system library, implicitly contributed by the runtime

Usage

From source file:cn.ieclipse.adt.ext.jdt.AormClasspathContainer.java

License:Apache License

public int getKind() {
    return IClasspathContainer.K_DEFAULT_SYSTEM;
}

From source file:com.android.ide.eclipse.adt.internal.project.AndroidClasspathContainerInitializer.java

License:Open Source License

/**
 * Allocates and returns an {@link AndroidClasspathContainer} object with the proper
 * path to the framework jar file.//from  w w w .  jav a  2s  . co  m
 * @param javaProject The java project that will receive the container.
 */
private static IClasspathContainer allocateAndroidContainer(IJavaProject javaProject) {
    final IProject iProject = javaProject.getProject();

    String markerMessage = null;
    boolean outputToConsole = true;
    IAndroidTarget target = null;

    try {
        AdtPlugin plugin = AdtPlugin.getDefault();
        if (plugin == null) { // This is totally weird, but I've seen it happen!
            return null;
        }

        synchronized (Sdk.getLock()) {
            boolean sdkIsLoaded = plugin.getSdkLoadStatus() == LoadStatus.LOADED;

            // check if the project has a valid target.
            ProjectState state = Sdk.getProjectState(iProject);
            if (state == null) {
                // looks like the project state (project.properties) couldn't be read!
                markerMessage = String.format(
                        "Project has no %1$s file! Edit the project properties to set one.",
                        SdkConstants.FN_PROJECT_PROPERTIES);
            } else {
                // this might be null if the sdk is not yet loaded.
                target = state.getTarget();

                // if we are loaded and the target is non null, we create a valid
                // ClassPathContainer
                if (sdkIsLoaded && target != null) {
                    // check the renderscript support mode. If support mode is enabled,
                    // target API must be 18+
                    if (!state.getRenderScriptSupportMode() || target.getVersion().getApiLevel() >= 18) {
                        // first make sure the target has loaded its data
                        Sdk.getCurrent().checkAndLoadTargetData(target, null /*project*/);

                        String targetName = target.getClasspathName();

                        return new AndroidClasspathContainer(
                                createClasspathEntries(iProject, target, targetName),
                                new Path(AdtConstants.CONTAINER_FRAMEWORK), targetName,
                                IClasspathContainer.K_DEFAULT_SYSTEM);
                    } else {
                        markerMessage = "Renderscript support mode requires compilation target API to be 18+.";
                    }
                } else {
                    // In case of error, we'll try different thing to provide the best error message
                    // possible.
                    // Get the project's target's hash string (if it exists)
                    String hashString = state.getTargetHashString();

                    if (hashString == null || hashString.length() == 0) {
                        // if there is no hash string we only show this if the SDK is loaded.
                        // For a project opened at start-up with no target, this would be displayed
                        // twice, once when the project is opened, and once after the SDK has
                        // finished loading.
                        // By testing the sdk is loaded, we only show this once in the console.
                        if (sdkIsLoaded) {
                            markerMessage = String.format(
                                    "Project has no target set. Edit the project properties to set one.");
                        }
                    } else if (sdkIsLoaded) {
                        markerMessage = String.format("Unable to resolve target '%s'", hashString);
                    } else {
                        // this is the case where there is a hashString but the SDK is not yet
                        // loaded and therefore we can't get the target yet.
                        // We check if there is a cache of the needed information.
                        AndroidClasspathContainer container = getContainerFromCache(iProject, target);

                        if (container == null) {
                            // either the cache was wrong (ie folder does not exists anymore), or
                            // there was no cache. In this case we need to make sure the project
                            // is resolved again after the SDK is loaded.
                            plugin.setProjectToResolve(javaProject);

                            markerMessage = String.format(
                                    "Unable to resolve target '%s' until the SDK is loaded.", hashString);

                            // let's not log this one to the console as it will happen at
                            // every boot, and it's expected. (we do keep the error marker though).
                            outputToConsole = false;

                        } else {
                            // we created a container from the cache, so we register the project
                            // to be checked for cache validity once the SDK is loaded
                            plugin.setProjectToCheck(javaProject);

                            // and return the container
                            return container;
                        }
                    }
                }
            }

            // return a dummy container to replace the one we may have had before.
            // It'll be replaced by the real when if/when the target is resolved if/when the
            // SDK finishes loading.
            return new IClasspathContainer() {
                @Override
                public IClasspathEntry[] getClasspathEntries() {
                    return new IClasspathEntry[0];
                }

                @Override
                public String getDescription() {
                    return "Unable to get system library for the project";
                }

                @Override
                public int getKind() {
                    return IClasspathContainer.K_DEFAULT_SYSTEM;
                }

                @Override
                public IPath getPath() {
                    return null;
                }
            };
        }
    } finally {
        processError(iProject, markerMessage, AdtConstants.MARKER_TARGET, outputToConsole);
    }
}

From source file:com.android.ide.eclipse.adt.internal.project.AndroidClasspathContainerInitializer.java

License:Open Source License

/**
 * Generates an {@link AndroidClasspathContainer} from the project cache, if possible.
 *//*from w  ww  .j  a  v a2  s.c  om*/
private static AndroidClasspathContainer getContainerFromCache(IProject project, IAndroidTarget target) {
    // get the cached info from the project persistent properties.
    String cache = ProjectHelper.loadStringProperty(project, PROPERTY_CONTAINER_CACHE);
    String targetNameCache = ProjectHelper.loadStringProperty(project, PROPERTY_TARGET_NAME);
    if (cache == null || targetNameCache == null) {
        return null;
    }

    // the first 2 chars must match CACHE_VERSION. The 3rd char is the normal separator.
    if (cache.startsWith(CACHE_VERSION_SEP) == false) {
        return null;
    }

    cache = cache.substring(CACHE_VERSION_SEP.length());

    // the cache contains multiple paths, separated by a character guaranteed to not be in
    // the path (\u001C).
    // The first 3 are for android.jar (jar, source, doc), the rest are for the optional
    // libraries and should contain at least one doc and a jar (if there are any libraries).
    // Therefore, the path count should be 3 or 5+
    String[] paths = cache.split(Pattern.quote(PATH_SEPARATOR));
    if (paths.length < 3 || paths.length == 4) {
        return null;
    }

    // now we check the paths actually exist.
    // There's an exception: If the source folder for android.jar does not exist, this is
    // not a problem, so we skip it.
    // Also paths[CACHE_INDEX_DOCS_URI] is a URI to the javadoc, so we test it a
    // bit differently.
    try {
        if (new File(paths[CACHE_INDEX_JAR]).exists() == false
                || new File(new URI(paths[CACHE_INDEX_DOCS_URI])).exists() == false) {
            return null;
        }

        // check the path for the add-ons, if they exist.
        if (paths.length > CACHE_INDEX_ADD_ON_START) {

            // check the docs path separately from the rest of the paths as it's a URI.
            if (new File(new URI(paths[CACHE_INDEX_OPT_DOCS_URI])).exists() == false) {
                return null;
            }

            // now just check the remaining paths.
            for (int i = CACHE_INDEX_ADD_ON_START + 1; i < paths.length; i++) {
                String path = paths[i];
                if (path.length() > 0) {
                    File f = new File(path);
                    if (f.exists() == false) {
                        return null;
                    }
                }
            }
        }
    } catch (URISyntaxException e) {
        return null;
    }

    IClasspathEntry[] entries = createClasspathEntriesFromPaths(paths, target);

    return new AndroidClasspathContainer(entries, new Path(AdtConstants.CONTAINER_FRAMEWORK), targetNameCache,
            IClasspathContainer.K_DEFAULT_SYSTEM);
}

From source file:com.android.ide.eclipse.adt.project.internal.AndroidClasspathContainerInitializer.java

License:Open Source License

/**
 * Allocates and returns an {@link AndroidClasspathContainer} object with the proper
 * path to the framework jar file.//w w  w  .j a v  a 2 s.  co  m
 * @param javaProject The java project that will receive the container.
 */
private static IClasspathContainer allocateAndroidContainer(IJavaProject javaProject) {
    final IProject iProject = javaProject.getProject();

    String markerMessage = null;
    boolean outputToConsole = true;

    try {
        AdtPlugin plugin = AdtPlugin.getDefault();

        // get the lock object for project manipulation during SDK load.
        Object lock = plugin.getSdkLockObject();
        synchronized (lock) {
            boolean sdkIsLoaded = plugin.getSdkLoadStatus() == LoadStatus.LOADED;

            // check if the project has a valid target.
            IAndroidTarget target = null;
            if (sdkIsLoaded) {
                target = Sdk.getCurrent().getTarget(iProject);
            }

            // if we are loaded and the target is non null, we create a valid ClassPathContainer
            if (sdkIsLoaded && target != null) {

                String targetName = target.getClasspathName();

                return new AndroidClasspathContainer(createClasspathEntries(iProject, target, targetName),
                        new Path(CONTAINER_ID), targetName);
            }

            // In case of error, we'll try different thing to provide the best error message
            // possible.
            // Get the project's target's hash string (if it exists)
            String hashString = Sdk.getProjectTargetHashString(iProject);

            if (hashString == null || hashString.length() == 0) {
                // if there is no hash string we only show this if the SDK is loaded.
                // For a project opened at start-up with no target, this would be displayed
                // twice, once when the project is opened, and once after the SDK has
                // finished loading.
                // By testing the sdk is loaded, we only show this once in the console.
                if (sdkIsLoaded) {
                    markerMessage = String
                            .format("Project has no target set. Edit the project properties to set one.");
                }
            } else if (sdkIsLoaded) {
                markerMessage = String.format("Unable to resolve target '%s'", hashString);
            } else {
                // this is the case where there is a hashString but the SDK is not yet
                // loaded and therefore we can't get the target yet.
                // We check if there is a cache of the needed information.
                AndroidClasspathContainer container = getContainerFromCache(iProject);

                if (container == null) {
                    // either the cache was wrong (ie folder does not exists anymore), or 
                    // there was no cache. In this case we need to make sure the project
                    // is resolved again after the SDK is loaded.
                    plugin.setProjectToResolve(javaProject);

                    markerMessage = String.format("Unable to resolve target '%s' until the SDK is loaded.",
                            hashString);

                    // let's not log this one to the console as it will happen at every boot,
                    // and it's expected. (we do keep the error marker though).
                    outputToConsole = false;

                } else {
                    // we created a container from the cache, so we register the project
                    // to be checked for cache validity once the SDK is loaded
                    plugin.setProjectToCheck(javaProject);

                    // and return the container
                    return container;
                }

            }

            // return a dummy container to replace the one we may have had before.
            // It'll be replaced by the real when if/when the target is resolved if/when the
            // SDK finishes loading.
            return new IClasspathContainer() {
                public IClasspathEntry[] getClasspathEntries() {
                    return new IClasspathEntry[0];
                }

                public String getDescription() {
                    return "Unable to get system library for the project";
                }

                public int getKind() {
                    return IClasspathContainer.K_DEFAULT_SYSTEM;
                }

                public IPath getPath() {
                    return null;
                }
            };
        }
    } finally {
        if (markerMessage != null) {
            // log the error and put the marker on the project if we can.
            if (outputToConsole) {
                AdtPlugin.printErrorToConsole(iProject, markerMessage);
            }

            try {
                BaseProjectHelper.addMarker(iProject, AdtConstants.MARKER_TARGET, markerMessage, -1,
                        IMarker.SEVERITY_ERROR, IMarker.PRIORITY_HIGH);
            } catch (CoreException e) {
                // In some cases, the workspace may be locked for modification when we
                // pass here.
                // We schedule a new job to put the marker after.
                final String fmessage = markerMessage;
                Job markerJob = new Job("Android SDK: Resolving error markers") {
                    @Override
                    protected IStatus run(IProgressMonitor monitor) {
                        try {
                            BaseProjectHelper.addMarker(iProject, AdtConstants.MARKER_TARGET, fmessage, -1,
                                    IMarker.SEVERITY_ERROR, IMarker.PRIORITY_HIGH);
                        } catch (CoreException e2) {
                            return e2.getStatus();
                        }

                        return Status.OK_STATUS;
                    }
                };

                // build jobs are run after other interactive jobs
                markerJob.setPriority(Job.BUILD);
                markerJob.schedule();
            }
        } else {
            // no error, remove potential MARKER_TARGETs.
            try {
                if (iProject.exists()) {
                    iProject.deleteMarkers(AdtConstants.MARKER_TARGET, true, IResource.DEPTH_INFINITE);
                }
            } catch (CoreException ce) {
                // In some cases, the workspace may be locked for modification when we pass
                // here, so we schedule a new job to put the marker after.
                Job markerJob = new Job("Android SDK: Resolving error markers") {
                    @Override
                    protected IStatus run(IProgressMonitor monitor) {
                        try {
                            iProject.deleteMarkers(AdtConstants.MARKER_TARGET, true, IResource.DEPTH_INFINITE);
                        } catch (CoreException e2) {
                            return e2.getStatus();
                        }

                        return Status.OK_STATUS;
                    }
                };

                // build jobs are run after other interactive jobs
                markerJob.setPriority(Job.BUILD);
                markerJob.schedule();
            }
        }
    }
}

From source file:com.android.ide.eclipse.auidt.internal.project.AndroidClasspathContainerInitializer.java

License:Open Source License

/**
 * Allocates and returns an {@link AndroidClasspathContainer} object with the proper
 * path to the framework jar file./*from  w w  w .j a va 2  s .  c o m*/
 * @param javaProject The java project that will receive the container.
 */
private static IClasspathContainer allocateAndroidContainer(IJavaProject javaProject) {
    final IProject iProject = javaProject.getProject();

    String markerMessage = null;
    boolean outputToConsole = true;
    IAndroidTarget target = null;

    try {
        AdtPlugin plugin = AdtPlugin.getDefault();
        if (plugin == null) { // This is totally weird, but I've seen it happen!
            return null;
        }

        synchronized (Sdk.getLock()) {
            boolean sdkIsLoaded = plugin.getSdkLoadStatus() == LoadStatus.LOADED;

            // check if the project has a valid target.
            ProjectState state = Sdk.getProjectState(iProject);
            if (state == null) {
                // looks like the project state (project.properties) couldn't be read!
                markerMessage = String.format(
                        "Project has no %1$s file! Edit the project properties to set one.",
                        SdkConstants.FN_PROJECT_PROPERTIES);
            } else {
                // this might be null if the sdk is not yet loaded.
                target = state.getTarget();

                // if we are loaded and the target is non null, we create a valid
                // ClassPathContainer
                if (sdkIsLoaded && target != null) {
                    // first make sure the target has loaded its data
                    Sdk.getCurrent().checkAndLoadTargetData(target, null /*project*/);

                    String targetName = target.getClasspathName();

                    return new AndroidClasspathContainer(createClasspathEntries(iProject, target, targetName),
                            new Path(AdtConstants.CONTAINER_FRAMEWORK), targetName,
                            IClasspathContainer.K_DEFAULT_SYSTEM);
                }

                // In case of error, we'll try different thing to provide the best error message
                // possible.
                // Get the project's target's hash string (if it exists)
                String hashString = state.getTargetHashString();

                if (hashString == null || hashString.length() == 0) {
                    // if there is no hash string we only show this if the SDK is loaded.
                    // For a project opened at start-up with no target, this would be displayed
                    // twice, once when the project is opened, and once after the SDK has
                    // finished loading.
                    // By testing the sdk is loaded, we only show this once in the console.
                    if (sdkIsLoaded) {
                        markerMessage = String
                                .format("Project has no target set. Edit the project properties to set one.");
                    }
                } else if (sdkIsLoaded) {
                    markerMessage = String.format("Unable to resolve target '%s'", hashString);
                } else {
                    // this is the case where there is a hashString but the SDK is not yet
                    // loaded and therefore we can't get the target yet.
                    // We check if there is a cache of the needed information.
                    AndroidClasspathContainer container = getContainerFromCache(iProject, target);

                    if (container == null) {
                        // either the cache was wrong (ie folder does not exists anymore), or
                        // there was no cache. In this case we need to make sure the project
                        // is resolved again after the SDK is loaded.
                        plugin.setProjectToResolve(javaProject);

                        markerMessage = String.format("Unable to resolve target '%s' until the SDK is loaded.",
                                hashString);

                        // let's not log this one to the console as it will happen at
                        // every boot, and it's expected. (we do keep the error marker though).
                        outputToConsole = false;

                    } else {
                        // we created a container from the cache, so we register the project
                        // to be checked for cache validity once the SDK is loaded
                        plugin.setProjectToCheck(javaProject);

                        // and return the container
                        return container;
                    }
                }
            }

            // return a dummy container to replace the one we may have had before.
            // It'll be replaced by the real when if/when the target is resolved if/when the
            // SDK finishes loading.
            return new IClasspathContainer() {
                @Override
                public IClasspathEntry[] getClasspathEntries() {
                    return new IClasspathEntry[0];
                }

                @Override
                public String getDescription() {
                    return "Unable to get system library for the project";
                }

                @Override
                public int getKind() {
                    return IClasspathContainer.K_DEFAULT_SYSTEM;
                }

                @Override
                public IPath getPath() {
                    return null;
                }
            };
        }
    } finally {
        processError(iProject, markerMessage, AdtConstants.MARKER_TARGET, outputToConsole);
    }
}

From source file:com.codenvy.ide.ext.java.server.core.launching.JREContainer.java

License:Open Source License

/**
 * @see org.eclipse.jdt.core.IClasspathContainer#getKind()
 */
public int getKind() {
    return IClasspathContainer.K_DEFAULT_SYSTEM;
}

From source file:com.codenvy.ide.ext.java.server.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 ww w. j ava 2  s.  co  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(), Util.relativePath(path, 1/*remove project segment*/),
                            projectPathString, false/*not a package*/, access);
                }
            }
            break;
        }
    }
}

From source file:net.rim.ejde.internal.sourcelookup.RIMSourcePathProvider.java

License:Open Source License

/**
 * Computes and returns the default unresolved runtime classpath for the given project.
 *
 * @return runtime classpath entries/*from  w w  w  .  j av a2  s .c o  m*/
 * @exception CoreException
 *                if unable to compute the runtime classpath
 * @see IRuntimeClasspathEntry
 */
public static IRuntimeClasspathEntry[] computeUnresolvedRuntimeClasspath(IJavaProject project)
        throws CoreException {
    IClasspathEntry[] entries = project.getRawClasspath();
    List<IRuntimeClasspathEntry> classpathEntries = new ArrayList<IRuntimeClasspathEntry>();
    for (int i = 0; i < entries.length; i++) {
        IClasspathEntry entry = entries[i];
        switch (entry.getEntryKind()) {
        case IClasspathEntry.CPE_CONTAINER:
            IClasspathContainer container = JavaCore.getClasspathContainer(entry.getPath(), project);
            if (container != null) {
                switch (container.getKind()) {
                case IClasspathContainer.K_APPLICATION:
                    // don't look at application entries
                    break;
                case IClasspathContainer.K_DEFAULT_SYSTEM:
                    classpathEntries.add(JavaRuntime.newRuntimeContainerClasspathEntry(container.getPath(),
                            IRuntimeClasspathEntry.STANDARD_CLASSES, project));
                    break;
                case IClasspathContainer.K_SYSTEM:
                    classpathEntries.add(JavaRuntime.newRuntimeContainerClasspathEntry(container.getPath(),
                            IRuntimeClasspathEntry.BOOTSTRAP_CLASSES, project));
                    break;
                }
            }
            break;
        case IClasspathEntry.CPE_VARIABLE:
            if (JavaRuntime.JRELIB_VARIABLE.equals(entry.getPath().segment(0))) {
                IRuntimeClasspathEntry jre = JavaRuntime.newVariableRuntimeClasspathEntry(entry.getPath());
                jre.setClasspathProperty(IRuntimeClasspathEntry.STANDARD_CLASSES);
                classpathEntries.add(jre);
            }
            break;
        default:
            break;
        }
    }
    classpathEntries.add(JavaRuntime.newDefaultProjectClasspathEntry(project));
    return classpathEntries.toArray(new IRuntimeClasspathEntry[classpathEntries.size()]);
}

From source file:org.continuousassurance.swamp.eclipse.ImprovedClasspathHandler.java

License:Apache License

/**
 * Handles a container entry in the classpath. A container entry contains 1+ entries each of which is either a library entry or a project entry
 * @param entry the container entry//w ww  .  j a v  a  2 s .  c  om
 * @param root the workspace root
 * @throws IOException
 * @throws JavaModelException
 */
public void handleContainer(IClasspathEntry entry, IWorkspaceRoot root) throws IOException, JavaModelException {
    IClasspathContainer container = JavaCore.getClasspathContainer(entry.getPath(), project);
    System.out.println("Here's a container" + container);
    int kind = container.getKind();
    if ((this.excludeSysLibs)
            && (kind == IClasspathContainer.K_APPLICATION || kind == IClasspathContainer.K_DEFAULT_SYSTEM)) {
        System.out.println("System library container");
        System.out.println(entry.getPath());
        return;
    }
    for (IClasspathEntry subEntry : container.getClasspathEntries()) {
        if (subEntry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
            handleLibrary(subEntry, root);
        } else {
            handleProject(subEntry, root);
        }
    }
}

From source file:org.eclim.eclipse.EclimClasspathContainer.java

License:Open Source License

@Override
public int getKind() {
    return IClasspathContainer.K_DEFAULT_SYSTEM;
}