Search in sources :

Example 26 with TagElement

use of org.eclipse.jdt.core.dom.TagElement in project xtext-eclipse by eclipse.

the class XbaseHoverDocumentationProvider method handleBlockTags.

protected void handleBlockTags(String title, List<TagElement> tags) {
    if (tags.isEmpty())
        return;
    handleBlockTagTitle(title);
    for (Iterator<TagElement> iter = tags.iterator(); iter.hasNext(); ) {
        TagElement tag = iter.next();
        buffer.append(BlOCK_TAG_ENTRY_START);
        if (TagElement.TAG_SEE.equals(tag.getTagName())) {
            handleSeeTag(tag);
        } else {
            @SuppressWarnings("unchecked") List<ASTNode> fragments = tag.fragments();
            handleContentElements(fragments);
        }
        buffer.append(BlOCK_TAG_ENTRY_END);
    }
}
Also used : ASTNode(org.eclipse.jdt.core.dom.ASTNode) TagElement(org.eclipse.jdt.core.dom.TagElement)

Example 27 with TagElement

use of org.eclipse.jdt.core.dom.TagElement in project xtext-eclipse by eclipse.

the class XbaseHoverDocumentationProvider method handleParameters.

protected void handleParameters(EObject object, List<TagElement> parameters, List<String> parameterNames) {
    if (parameters.size() == 0 && containsOnlyNull(parameterNames))
        return;
    handleBlockTagTitle("Parameters:");
    for (Iterator<TagElement> iter = parameters.iterator(); iter.hasNext(); ) {
        TagElement tag = iter.next();
        buffer.append(BlOCK_TAG_ENTRY_START);
        handleParamTag(tag);
        buffer.append(BlOCK_TAG_ENTRY_END);
    }
    for (int i = 0; i < parameterNames.size(); i++) {
        String name = parameterNames.get(i);
        if (name != null) {
            buffer.append(BlOCK_TAG_ENTRY_START);
            buffer.append(PARAM_NAME_START);
            buffer.append(name);
            buffer.append(PARAM_NAME_END);
            buffer.append(BlOCK_TAG_ENTRY_END);
        }
    }
}
Also used : TagElement(org.eclipse.jdt.core.dom.TagElement)

Example 28 with TagElement

use of org.eclipse.jdt.core.dom.TagElement in project xtext-eclipse by eclipse.

the class XbaseHoverDocumentationProvider method handleExceptionTags.

protected void handleExceptionTags(List<TagElement> tags, Map<String, URI> exceptionNamesToURI) {
    if (tags.size() == 0 && containsOnlyNull(exceptionNamesToURI.values()))
        return;
    handleBlockTagTitle("Throws:");
    for (Iterator<TagElement> iter = tags.iterator(); iter.hasNext(); ) {
        TagElement tag = iter.next();
        buffer.append(BlOCK_TAG_ENTRY_START);
        handleThrowsTag(tag);
        buffer.append(BlOCK_TAG_ENTRY_END);
    }
    for (int i = 0; i < exceptionNamesToURI.size(); i++) {
        String name = Lists.newArrayList(exceptionNamesToURI.keySet()).get(i);
        if (name != null && exceptionNamesToURI.get(name) != null) {
            buffer.append(BlOCK_TAG_ENTRY_START);
            buffer.append(createLinkWithLabel(XtextElementLinks.XTEXTDOC_SCHEME, exceptionNamesToURI.get(name), name));
            buffer.append(BlOCK_TAG_ENTRY_END);
        }
    }
}
Also used : TagElement(org.eclipse.jdt.core.dom.TagElement)

Example 29 with TagElement

use of org.eclipse.jdt.core.dom.TagElement in project whole by wholeplatform.

the class CompilationUnitBuilder method newTagElement.

public TagElement newTagElement(String tagName) {
    TagElement tag = ast.newTagElement();
    tag.setTagName(tagName);
    return tag;
}
Also used : TagElement(org.eclipse.jdt.core.dom.TagElement)

Example 30 with TagElement

use of org.eclipse.jdt.core.dom.TagElement in project whole by wholeplatform.

the class CompilationUnitBuilder method putCUDocComment.

public void putCUDocComment() {
    String copyright = generator.getCopyright();
    String license = generator.getLicense();
    String comment = copyright;
    if (comment != null && comment.length() > 0)
        comment += "\n " + license;
    else
        comment = license;
    if (comment != null && comment.length() > 0) {
        TagElement te = newTagElement(null, comment);
        Javadoc cuDoc = newJavadoc();
        cuDoc.tags().add(te);
        packageDec.setJavadoc(cuDoc);
    }
}
Also used : TagElement(org.eclipse.jdt.core.dom.TagElement) Javadoc(org.eclipse.jdt.core.dom.Javadoc)

Aggregations

TagElement (org.eclipse.jdt.core.dom.TagElement)59 ASTNode (org.eclipse.jdt.core.dom.ASTNode)29 Javadoc (org.eclipse.jdt.core.dom.Javadoc)25 AST (org.eclipse.jdt.core.dom.AST)17 TextElement (org.eclipse.jdt.core.dom.TextElement)16 MethodDeclaration (org.eclipse.jdt.core.dom.MethodDeclaration)15 ASTRewrite (org.eclipse.jdt.core.dom.rewrite.ASTRewrite)15 Type (org.eclipse.jdt.core.dom.Type)14 ImportRewriteContext (org.eclipse.jdt.core.dom.rewrite.ImportRewrite.ImportRewriteContext)14 ICompilationUnit (org.eclipse.jdt.core.ICompilationUnit)13 CompilationUnit (org.eclipse.jdt.core.dom.CompilationUnit)12 ImportRewrite (org.eclipse.jdt.core.dom.rewrite.ImportRewrite)12 SimpleName (org.eclipse.jdt.core.dom.SimpleName)11 ListRewrite (org.eclipse.jdt.core.dom.rewrite.ListRewrite)11 BodyDeclaration (org.eclipse.jdt.core.dom.BodyDeclaration)8 PrimitiveType (org.eclipse.jdt.core.dom.PrimitiveType)8 SingleVariableDeclaration (org.eclipse.jdt.core.dom.SingleVariableDeclaration)7 ContextSensitiveImportRewriteContext (org.eclipse.jdt.internal.corext.codemanipulation.ContextSensitiveImportRewriteContext)7 ContextSensitiveImportRewriteContext (org.eclipse.jdt.ls.core.internal.corext.codemanipulation.ContextSensitiveImportRewriteContext)7 ArrayList (java.util.ArrayList)6