Example usage for org.eclipse.jdt.core IPackageFragmentRoot getPrimaryElement

List of usage examples for org.eclipse.jdt.core IPackageFragmentRoot getPrimaryElement

Introduction

In this page you can find the example usage for org.eclipse.jdt.core IPackageFragmentRoot getPrimaryElement.

Prototype

IJavaElement getPrimaryElement();

Source Link

Document

Returns the primary element (whose compilation unit is the primary compilation unit) this working copy element was created from, or this element if it is a descendant of a primary compilation unit or if it is not a descendant of a working copy (e.g.

Usage

From source file:org.org.eclipse.dws.ui.internal.wizards.pages.LookupJavadocAndSourcesForLibrariesInClasspathPage.java

License:Open Source License

/**
 * Misses javadoc.//  www .  java2  s  . co m
 * 
 * @param packageFragmentRoot
 *            the package fragment root
 * 
 * @return true, if successful
 * 
 * @throws JavaModelException
 *             the java model exception
 */
private boolean missesJavadoc(IPackageFragmentRoot packageFragmentRoot) throws JavaModelException {
    int entryKind = packageFragmentRoot.getRawClasspathEntry().getEntryKind();
    boolean missesJavadoc = false;
    if (entryKind == IClasspathEntry.CPE_LIBRARY || entryKind == IClasspathEntry.CPE_VARIABLE) {
        missesJavadoc = JavaUI.getLibraryJavadocLocation(packageFragmentRoot.getRawClasspathEntry()) == null;
    }
    if (entryKind == IClasspathEntry.CPE_CONTAINER) {
        missesJavadoc = JavaUI.getJavadocLocation(packageFragmentRoot.getPrimaryElement(), false) == null;
    }
    return missesJavadoc;
}