Example usage for org.eclipse.jdt.core IJavaProject isOnClasspath

List of usage examples for org.eclipse.jdt.core IJavaProject isOnClasspath

Introduction

In this page you can find the example usage for org.eclipse.jdt.core IJavaProject isOnClasspath.

Prototype

boolean isOnClasspath(IResource resource);

Source Link

Document

Returns whether the given resource is on the classpath of this project, that is, referenced from a classpath entry and not explicitly excluded using an exclusion pattern.

Usage

From source file:org.summer.dsl.model.types.access.jdt.WorkingCopyOwnerProvider.java

License:Open Source License

protected boolean isOnClassPath(IJavaProject javaProject, IStorage storage) {
    if (storage instanceof IJarEntryResource) {
        javaProject.isOnClasspath(((IJarEntryResource) storage).getPackageFragmentRoot());
    }//w w  w.  ja va  2s .c  om
    if (storage instanceof IResource) {
        return javaProject.isOnClasspath((IResource) storage);
    }
    return false;
}

From source file:potes.cucumberjvm.eclipseplugin.CucumberLanguage.java

License:Apache License

public Set<String> getCucumberDefinitionPackages(IJavaProject javaProject) throws JavaModelException {
    Set<String> packages = new HashSet<String>();
    for (IType type : getStepDefinitionTypes()) {
        IResource underlyingResource = type.getUnderlyingResource();
        if ((underlyingResource != null && javaProject.isOnClasspath(underlyingResource))
                || javaProject.isOnClasspath(type)) {
            String fqn = type.getFullyQualifiedName();
            if (fqn.contains(".")) {
                packages.add(fqn.substring(0, fqn.lastIndexOf('.')));
            } else {
                packages.add("");
            }/* ww  w. ja va  2  s . com*/
        }
    }
    packages.addAll(extraPackages);
    return packages;
}