Example usage for org.eclipse.jdt.core.dom TagElement TAG_CODE

List of usage examples for org.eclipse.jdt.core.dom TagElement TAG_CODE

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom TagElement TAG_CODE.

Prototype

String TAG_CODE

To view the source code for org.eclipse.jdt.core.dom TagElement TAG_CODE.

Click Source Link

Document

Standard inline doc tag name (value ).

Usage

From source file:at.bestsolution.fxide.jdt.text.javadoc.JavaDoc2HTMLTextReader.java

License:Open Source License

private String printBlockTag(String tag, String tagContent) {

    if (TagElement.TAG_LINK.equals(tag) || TagElement.TAG_LINKPLAIN.equals(tag)) {

        char[] contentChars = tagContent.toCharArray();
        boolean inParentheses = false;
        int labelStart = 0;

        for (int i = 0; i < contentChars.length; i++) {
            char nextChar = contentChars[i];

            // tagContent always has a leading space
            if (i == 0 && Character.isWhitespace(nextChar)) {
                labelStart = 1;//from  w  w w.  ja v  a 2  s  .c  o  m
                continue;
            }

            if (nextChar == '(') {
                inParentheses = true;
                continue;
            }

            if (nextChar == ')') {
                inParentheses = false;
                continue;
            }

            // Stop at first whitespace that is not in parentheses
            if (!inParentheses && Character.isWhitespace(nextChar)) {
                labelStart = i + 1;
                break;
            }
        }
        if (TagElement.TAG_LINK.equals(tag))
            return "<code>" + substituteQualification(tagContent.substring(labelStart)) + "</code>"; //$NON-NLS-1$//$NON-NLS-2$
        else
            return substituteQualification(tagContent.substring(labelStart));

    } else if (TagElement.TAG_LITERAL.equals(tag)) {
        return printLiteral(tagContent);

    } else if (TagElement.TAG_CODE.equals(tag)) {
        return "<code>" + printLiteral(tagContent) + "</code>"; //$NON-NLS-1$//$NON-NLS-2$
    }

    // If something went wrong at least replace the {} with the content
    return substituteQualification(tagContent);
}

From source file:at.bestsolution.fxide.jdt.text.javadoc.JavadocContentAccess2.java

License:Open Source License

private void handleInlineTagElement(TagElement node) {
    String name = node.getTagName();

    if (TagElement.TAG_VALUE.equals(name) && handleValueTag(node))
        return;/*from  w w  w  . ja va  2s.  co  m*/

    boolean isLink = TagElement.TAG_LINK.equals(name);
    boolean isLinkplain = TagElement.TAG_LINKPLAIN.equals(name);
    boolean isCode = TagElement.TAG_CODE.equals(name);
    boolean isLiteral = TagElement.TAG_LITERAL.equals(name);

    if (isLiteral || isCode)
        fLiteralContent++;
    if (isLink || isCode)
        fBuf.append("<code>"); //$NON-NLS-1$

    if (isLink || isLinkplain)
        handleLink(node.fragments());
    else if (isCode || isLiteral)
        handleContentElements(node.fragments(), true);
    else if (handleInheritDoc(node)) {
        // handled
    } else if (handleDocRoot(node)) {
        // handled
    } else {
        //print uninterpreted source {@tagname ...} for unknown tags
        int start = node.getStartPosition();
        String text = fSource.substring(start, start + node.getLength());
        fBuf.append(removeDocLineIntros(text));
    }

    if (isLink || isCode)
        fBuf.append("</code>"); //$NON-NLS-1$
    if (isLiteral || isCode)
        fLiteralContent--;

}

From source file:org.eclipse.xtext.xbase.ui.hover.XbaseHoverDocumentationProvider.java

License:Open Source License

protected void handleInlineTagElement(TagElement node) {
    String name = node.getTagName();
    if (TagElement.TAG_VALUE.equals(name) && handleValueTag(node))
        return;//from   www  . j a v a  2s  .co  m
    boolean isLink = TagElement.TAG_LINK.equals(name);
    boolean isLinkplain = TagElement.TAG_LINKPLAIN.equals(name);
    boolean isCode = TagElement.TAG_CODE.equals(name);
    boolean isLiteral = TagElement.TAG_LITERAL.equals(name);
    if (isLiteral || isCode)
        fLiteralContent++;
    if (isLink || isCode)
        buffer.append("<code>"); //$NON-NLS-1$
    if (isLink || isLinkplain)
        handleLink(node.fragments());
    else if (isCode || isLiteral) {
        @SuppressWarnings("unchecked")
        List<ASTNode> fragments = node.fragments();
        handleContentElements(fragments, true);
    } else if (handleInheritDoc(node)) {
        // handled
    } else if (handleDocRoot(node)) {
        // handled
    } else {
        //print uninterpreted source {@tagname ...} for unknown tags
        int start = node.getStartPosition();
        String text = rawJavaDoc.substring(start, start + node.getLength());
        buffer.append(removeDocLineIntros(text));
    }
    if (isLink || isCode)
        buffer.append("</code>"); //$NON-NLS-1$
    if (isLiteral || isCode)
        fLiteralContent--;

}

From source file:org.jboss.tools.vscode.javadoc.internal.JavaDoc2MarkdownTextReader.java

License:Open Source License

private String printBlockTag(String tag, String tagContent) {

    if (TagElement.TAG_LINK.equals(tag) || TagElement.TAG_LINKPLAIN.equals(tag)) {

        char[] contentChars = tagContent.toCharArray();
        boolean inParentheses = false;
        int labelStart = 0;

        for (int i = 0; i < contentChars.length; i++) {
            char nextChar = contentChars[i];

            // tagContent always has a leading space
            if (i == 0 && Character.isWhitespace(nextChar)) {
                labelStart = 1;/*from  w  w w  . ja  v  a 2s .co m*/
                continue;
            }

            if (nextChar == '(') {
                inParentheses = true;
                continue;
            }

            if (nextChar == ')') {
                inParentheses = false;
                continue;
            }

            // Stop at first whitespace that is not in parentheses
            if (!inParentheses && Character.isWhitespace(nextChar)) {
                labelStart = i + 1;
                break;
            }
        }
        if (TagElement.TAG_LINK.equals(tag))
            return "`" + substituteQualification(tagContent.substring(labelStart)) + "`"; //$NON-NLS-1$//$NON-NLS-2$
        else
            return substituteQualification(tagContent.substring(labelStart));

    } else if (TagElement.TAG_LITERAL.equals(tag)) {
        return printLiteral(tagContent);

    } else if (TagElement.TAG_CODE.equals(tag)) {
        return "`" + printLiteral(tagContent) + "`"; //$NON-NLS-1$//$NON-NLS-2$
    }

    // If something went wrong at least replace the {} with the content
    return substituteQualification(tagContent);
}

From source file:org.moe.natjgen.XcodeFullDocumentation.java

License:Apache License

public Javadoc getJavaDoc(ASTRewrite rewrite, ArrayList<CalleeArgument> args) {
    Javadoc doc = rewrite.getAST().newJavadoc();

    addTag(doc, rewrite, null, "<h1>Abstract:</h1>\n" + prettyString(Abstract));
    if (Discussion != null) {
        addTag(doc, rewrite, null, "<h1>Discussion:</h1>\n" + prettyString(Discussion));
    }/*from ww w .  jav  a 2 s  .  c  om*/

    // @code
    addTag(doc, rewrite, TagElement.TAG_CODE, prettyString(Declaration));

    // @param
    if (args.size() == ParameterNames.size()) {
        for (int i = 0; i < ParameterNames.size(); ++i) {
            addTag(doc, rewrite, TagElement.TAG_PARAM,
                    args.get(i).getName() + " " + prettyString(ParameterDescriptions.get(i)));
        }
    } else {
        for (int i = 0; i < ParameterNames.size(); ++i) {
            addTag(doc, rewrite, TagElement.TAG_PARAM,
                    ParameterNames.get(i) + " " + prettyString(ParameterDescriptions.get(i)));
        }
    }

    // @return
    addTag(doc, rewrite, TagElement.TAG_RETURN, prettyString(ResultDescription));

    // @since
    for (int i = 0; i < Availabilities.size(); ++i) {
        addTag(doc, rewrite, TagElement.TAG_SINCE, prettyString(Availabilities.get(i)));
    }

    return doc;
}