Example usage for org.eclipse.jdt.internal.core JavadocConstants ANCHOR_SUFFIX

List of usage examples for org.eclipse.jdt.internal.core JavadocConstants ANCHOR_SUFFIX

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core JavadocConstants ANCHOR_SUFFIX.

Prototype

null ANCHOR_SUFFIX

To view the source code for org.eclipse.jdt.internal.core JavadocConstants ANCHOR_SUFFIX.

Click Source Link

Usage

From source file:com.codenvy.ide.ext.java.server.internal.core.JavadocContents.java

License:Open Source License

public String getPackageDoc() throws JavaModelException {
    if (this.content == null)
        return null;
    int[] range = null;
    int index = CharOperation.indexOf(JavadocConstants.PACKAGE_DESCRIPTION_START, this.content, false, 0);
    if (index == -1)
        return null;
    index = CharOperation.indexOf(JavadocConstants.ANCHOR_SUFFIX, this.content, false, index);
    if (index == -1)
        return null;

    int start = CharOperation.indexOf(JavadocConstants.H2_PREFIX, this.content, false, index);
    if (start != -1) {
        start = CharOperation.indexOf(JavadocConstants.H2_SUFFIX, this.content, false, start);
        if (start != -1)
            index = start + JavadocConstants.H2_SUFFIX_LENGTH;
    }/*from   ww  w . ja va2s. c  o m*/
    if (index != -1) {
        int end = CharOperation.indexOf(JavadocConstants.BOTTOM_NAVBAR, this.content, false, index);
        if (end == -1)
            end = this.content.length - 1;
        range = new int[] { index, end };
        return String.valueOf(CharOperation.subarray(this.content, range[0], range[1]));
    }
    return null;
}

From source file:com.codenvy.ide.ext.java.server.internal.core.JavadocContents.java

License:Open Source License

private int[] computeChildRange(int anchorEndStart, char[] anchor, int indexOfBottom) {
    int[] range = null;

    // try to find the bottom of the section
    if (indexOfBottom != -1) {
        // try to find the end of the anchor
        int indexOfEndLink = CharOperation.indexOf(JavadocConstants.ANCHOR_SUFFIX, this.content, false,
                anchorEndStart + anchor.length);
        if (indexOfEndLink != -1) {
            // try to find the next anchor
            int indexOfNextElement = CharOperation.indexOf(JavadocConstants.ANCHOR_PREFIX_START, this.content,
                    false, indexOfEndLink);

            int javadocStart = indexOfEndLink + JavadocConstants.ANCHOR_SUFFIX_LENGTH;
            int javadocEnd = indexOfNextElement == -1 ? indexOfBottom
                    : Math.min(indexOfNextElement, indexOfBottom);
            range = new int[] { javadocStart, javadocEnd };
        } else {/*from   w w  w.  j  a va2  s  . co  m*/
            // the anchor has no suffix
            range = UNKNOWN_FORMAT;
        }
    } else {
        // the detail section has no bottom
        range = UNKNOWN_FORMAT;
    }

    return range;
}