Example usage for org.eclipse.jdt.core IJavaModelStatusConstants UNKNOWN_JAVADOC_FORMAT

List of usage examples for org.eclipse.jdt.core IJavaModelStatusConstants UNKNOWN_JAVADOC_FORMAT

Introduction

In this page you can find the example usage for org.eclipse.jdt.core IJavaModelStatusConstants UNKNOWN_JAVADOC_FORMAT.

Prototype

int UNKNOWN_JAVADOC_FORMAT

To view the source code for org.eclipse.jdt.core IJavaModelStatusConstants UNKNOWN_JAVADOC_FORMAT.

Click Source Link

Document

Status constant indicating that the attached javadoc content format is unrecognized.

Usage

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

License:Open Source License

public String getTypeDoc() throws JavaModelException {
    if (this.content == null)
        return null;

    synchronized (this) {
        if (this.typeDocRange == null) {
            computeTypeRange();/*from w  ww.ja  va 2s.c o m*/
        }
    }

    if (this.typeDocRange != null) {
        if (this.typeDocRange == UNKNOWN_FORMAT)
            throw new JavaModelException(
                    new JavaModelStatus(IJavaModelStatusConstants.UNKNOWN_JAVADOC_FORMAT, this.type));
        return String.valueOf(CharOperation.subarray(this.content, this.typeDocRange[0], this.typeDocRange[1]));
    }
    return null;
}

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

License:Open Source License

public String getFieldDoc(IField child) throws JavaModelException {
    if (this.content == null)
        return null;

    int[] range = null;
    synchronized (this) {
        if (this.fieldDocRanges == null) {
            this.fieldDocRanges = new HashtableOfObjectToIntArray();
        } else {//from   w w w .  jav  a 2  s  .c o  m
            range = this.fieldDocRanges.get(child);
        }

        if (range == null) {
            range = computeFieldRange(child);
            this.fieldDocRanges.put(child, range);
        }
    }

    if (range != null) {
        if (range == UNKNOWN_FORMAT)
            throw new JavaModelException(
                    new JavaModelStatus(IJavaModelStatusConstants.UNKNOWN_JAVADOC_FORMAT, child));
        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

public String getMethodDoc(IMethod child) throws JavaModelException {
    if (this.content == null)
        return null;

    int[] range = null;
    synchronized (this) {
        if (this.methodDocRanges == null) {
            this.methodDocRanges = new HashtableOfObjectToIntArray();
        } else {/*from  w ww  . j a  v  a 2s.  co m*/
            range = this.methodDocRanges.get(child);
        }

        if (range == null) {
            range = computeMethodRange(child);
            this.methodDocRanges.put(child, range);
        }
    }

    if (range != null) {
        if (range == UNKNOWN_FORMAT) {
            throw new JavaModelException(
                    new JavaModelStatus(IJavaModelStatusConstants.UNKNOWN_JAVADOC_FORMAT, child));
        }
        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 String computeMethodAnchorPrefixEnd(BinaryMethod method) throws JavaModelException {
    String typeQualifiedName = null;
    if (this.type.isMember()) {
        IType currentType = this.type;
        StringBuffer buffer = new StringBuffer();
        while (currentType != null) {
            buffer.insert(0, currentType.getElementName());
            currentType = currentType.getDeclaringType();
            if (currentType != null) {
                buffer.insert(0, '.');
            }//from   ww  w .j  a  v  a 2  s .c o  m
        }
        typeQualifiedName = new String(buffer.toString());
    } else {
        typeQualifiedName = this.type.getElementName();
    }

    String methodName = method.getElementName();
    if (method.isConstructor()) {
        methodName = typeQualifiedName;
    }
    IBinaryMethod info = (IBinaryMethod) method.getElementInfo();

    char[] genericSignature = info.getGenericSignature();
    String anchor = null;
    if (genericSignature != null) {
        genericSignature = CharOperation.replaceOnCopy(genericSignature, '/', '.');
        anchor = Util.toAnchor(0, genericSignature, methodName, Flags.isVarargs(method.getFlags()));
        if (anchor == null)
            throw new JavaModelException(
                    new JavaModelStatus(IJavaModelStatusConstants.UNKNOWN_JAVADOC_FORMAT, method));
    } else {
        anchor = Signature.toString(method.getSignature().replace('/', '.'), methodName, null, true, false,
                Flags.isVarargs(method.getFlags()));
    }
    IType declaringType = this.type;
    if (declaringType.isMember()) {
        // might need to remove a part of the signature corresponding to the synthetic argument (only for constructor)
        if (method.isConstructor() && !Flags.isStatic(declaringType.getFlags())) {
            int indexOfOpeningParen = anchor.indexOf('(');
            if (indexOfOpeningParen == -1) {
                // should not happen as this is a method signature
                return null;
            }
            int index = indexOfOpeningParen;
            indexOfOpeningParen++;
            int indexOfComma = anchor.indexOf(',', index);
            if (indexOfComma != -1) {
                index = indexOfComma + 2;
            } else {
                // no argument, but a synthetic argument
                index = anchor.indexOf(')', index);
            }
            anchor = anchor.substring(0, indexOfOpeningParen) + anchor.substring(index);
        }
    }
    return anchor + JavadocConstants.ANCHOR_PREFIX_END;
}