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

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

Introduction

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

Prototype

null ANCHOR_PREFIX_START

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

Click Source Link

Usage

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

License:Open Source License

private int[] computeChildRange(char[] anchor, int indexOfSectionBottom) throws JavaModelException {

    // checks each known anchor locations
    if (this.tempAnchorIndexesCount > 0) {
        for (int i = 0; i < this.tempAnchorIndexesCount; i++) {
            int anchorEndStart = this.tempAnchorIndexes[i];

            if (anchorEndStart != -1
                    && CharOperation.prefixEquals(anchor, this.content, false, anchorEndStart)) {

                this.tempAnchorIndexes[i] = -1;

                return computeChildRange(anchorEndStart, anchor, indexOfSectionBottom);
            }/*from   w w  w  .j  ava  2 s  .c o  m*/
        }
    }

    int fromIndex = this.tempLastAnchorFoundIndex;
    int index;

    // check each next unknown anchor locations
    while ((index = CharOperation.indexOf(JavadocConstants.ANCHOR_PREFIX_START, this.content, false,
            fromIndex)) != -1 && (index < indexOfSectionBottom || indexOfSectionBottom == -1)) {
        fromIndex = index + 1;

        int anchorEndStart = index + JavadocConstants.ANCHOR_PREFIX_START_LENGHT;

        this.tempLastAnchorFoundIndex = anchorEndStart;

        if (CharOperation.prefixEquals(anchor, this.content, false, anchorEndStart)) {
            return computeChildRange(anchorEndStart, anchor, indexOfSectionBottom);
        } else {
            if (this.tempAnchorIndexes.length == this.tempAnchorIndexesCount) {
                System.arraycopy(this.tempAnchorIndexes, 0,
                        this.tempAnchorIndexes = new int[this.tempAnchorIndexesCount + 20], 0,
                        this.tempAnchorIndexesCount);
            }

            this.tempAnchorIndexes[this.tempAnchorIndexesCount++] = anchorEndStart;
        }
    }

    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  ww  . ja v a 2 s .com
            // the anchor has no suffix
            range = UNKNOWN_FORMAT;
        }
    } else {
        // the detail section has no bottom
        range = UNKNOWN_FORMAT;
    }

    return range;
}