当前位置: 首页>>代码示例>>Java>>正文


Java EndElementTree类代码示例

本文整理汇总了Java中com.sun.source.doctree.EndElementTree的典型用法代码示例。如果您正苦于以下问题:Java EndElementTree类的具体用法?Java EndElementTree怎么用?Java EndElementTree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EndElementTree类属于com.sun.source.doctree包,在下文中一共展示了EndElementTree类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ignoreNonInlineTag

import com.sun.source.doctree.EndElementTree; //导入依赖的package包/类
boolean ignoreNonInlineTag(DocTree dtree) {
    Name name = null;
    if (dtree.getKind() == Kind.START_ELEMENT) {
        StartElementTree setree = (StartElementTree)dtree;
        name = setree.getName();
    } else if (dtree.getKind() == Kind.END_ELEMENT) {
        EndElementTree eetree = (EndElementTree)dtree;
        name = eetree.getName();
    }

    if (name != null) {
        com.sun.tools.doclint.HtmlTag htmlTag = com.sun.tools.doclint.HtmlTag.get(name);
        if (htmlTag != null &&
                htmlTag.blockType != com.sun.tools.doclint.HtmlTag.BlockType.INLINE) {
            return true;
        }
    }
    return false;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:HtmlDocletWriter.java

示例2: visitEndElement

import com.sun.source.doctree.EndElementTree; //导入依赖的package包/类
@Override
public Void visitEndElement(EndElementTree node, Void p) {
    print("</");
    print(node.getName());
    print(">");
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:VeryPretty.java

示例3: isSentenceBreak

import com.sun.source.doctree.EndElementTree; //导入依赖的package包/类
private boolean isSentenceBreak(DocTree dt, boolean isFirstDocTree) {
    switch (dt.getKind()) {
        case START_ELEMENT:
                StartElementTree set = (StartElementTree)dt;
                return !isFirstDocTree && ((DCTree) dt).pos > 1 && isSentenceBreak(set.getName());
        case END_ELEMENT:
                EndElementTree eet = (EndElementTree)dt;
                return !isFirstDocTree && ((DCTree) dt).pos > 1 && isSentenceBreak(eet.getName());
        default:
            return false;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:13,代码来源:DocTreeMaker.java

示例4: rewriteChildren

import com.sun.source.doctree.EndElementTree; //导入依赖的package包/类
protected final EndElementTree rewriteChildren(EndElementTree tree) {
    return tree; // Nothing to do for a string
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:ImmutableDocTreeTranslator.java

示例5: visitEndElement

import com.sun.source.doctree.EndElementTree; //导入依赖的package包/类
@Override
public DocTree visitEndElement(EndElementTree tree, Object p) {
    return rewriteChildren(tree);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:ImmutableDocTreeTranslator.java

示例6: EndElement

import com.sun.source.doctree.EndElementTree; //导入依赖的package包/类
public EndElementTree EndElement(CharSequence name) {
    return docMake.at(NOPOS).newEndElementTree(names.fromString(name.toString()));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:TreeFactory.java

示例7: visitEndElement

import com.sun.source.doctree.EndElementTree; //导入依赖的package包/类
/**
 * @since 1.47
 */
@Override
public DocTree visitEndElement(EndElementTree node, Element p) {
    return docScanner.visitEndElement(node, p, null);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:RefactoringVisitor.java

示例8: visitEndElement

import com.sun.source.doctree.EndElementTree; //导入依赖的package包/类
@Override
    @Messages({"# {0} - Tag Name", "TAG_END_NOT_PERMITTED=Invalid End Tag: </{0}>",
               "# {0} - Tag Name", "TAG_END_UNEXPECTED=Unexpected End Tag: </{0}>",
               "# {0} - Tag Name", "TAG_START_UNMATCHED=End Tag Missing: </{0}>"})
    public Void visitEndElement(EndElementTree node, List<ErrorDescription> errors) {
        DocTreePath currentDocPath = getCurrentPath();
        DocTreePathHandle dtph = DocTreePathHandle.create(currentDocPath, javac);
        if(dtph == null) {
            return null;
        }
        DocSourcePositions sp = (DocSourcePositions) javac.getTrees().getSourcePositions();
        int start = (int) sp.getStartPosition(javac.getCompilationUnit(), currentDocPath.getDocComment(), node);
        int end = (int) sp.getEndPosition(javac.getCompilationUnit(), currentDocPath.getDocComment(), node);

        final Name treeName = node.getName();
        final HtmlTag t = HtmlTag.get(treeName);
        if (t == null) {
             errors.add(ErrorDescriptionFactory.forSpan(ctx, start, end, TAG_END_UNKNOWN(treeName)));
        } else if (t.endKind == HtmlTag.EndKind.NONE) {
//            env.messages.error(HTML, node, "dc.tag.end.not.permitted", treeName);
            errors.add(ErrorDescriptionFactory.forSpan(ctx, start, end, TAG_END_NOT_PERMITTED(treeName)));
        } else {
            boolean done = false;
            while (!tagStack.isEmpty()) {
                StartElementTree startTree = tagStack.peek();
                Name tagName = startTree.getName();
                HtmlTag tag = HtmlTag.get(tagName);
                if (t == tag) {
                    tagStack.pop();
                    done = true;
                    break;
                } else if (tag.endKind != HtmlTag.EndKind.REQUIRED) {
                    tagStack.pop();
                } else {
                    boolean found = false;
                    for (StartElementTree set : tagStack) {
                        HtmlTag si = HtmlTag.get(set.getName());
                        if (si == t) {
                            found = true;
                            break;
                        }
                    }
                    if (found) {
                        int s = (int) sp.getStartPosition(javac.getCompilationUnit(), currentDocPath.getDocComment(), startTree);
                        int e = (int) sp.getEndPosition(javac.getCompilationUnit(), currentDocPath.getDocComment(), startTree);
                        errors.add(ErrorDescriptionFactory.forSpan(ctx, s, e, TAG_START_UNMATCHED(tagName)));
                        tagStack.pop();
                    } else {
                        errors.add(ErrorDescriptionFactory.forSpan(ctx, start, end, TAG_END_UNEXPECTED(treeName)));
                        done = true;
                        break;
                    }
                }
            }
            if (!done && tagStack.isEmpty()) {
                errors.add(ErrorDescriptionFactory.forSpan(ctx, start, end, TAG_END_UNEXPECTED(treeName)));
            }
        }
        return super.visitEndElement(node, errors);
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:61,代码来源:Analyzer.java

示例9: visitEndElement

import com.sun.source.doctree.EndElementTree; //导入依赖的package包/类
@Override
public Void visitEndElement(EndElementTree tree, Void ignore) {
    final Name treeName = tree.getName();
    final HtmlTag t = HtmlTag.get(treeName);
    if (t == null) {
        env.messages.error(HTML, tree, "dc.tag.unknown", treeName);
    } else if (t.endKind == HtmlTag.EndKind.NONE) {
        env.messages.error(HTML, tree, "dc.tag.end.not.permitted", treeName);
    } else {
        boolean done = false;
        while (!tagStack.isEmpty()) {
            TagStackItem top = tagStack.peek();
            if (t == top.tag) {
                switch (t) {
                    case TABLE:
                        if (!top.attrs.contains(HtmlTag.Attr.SUMMARY)
                                && !top.flags.contains(Flag.TABLE_HAS_CAPTION)) {
                            env.messages.error(ACCESSIBILITY, tree,
                                    "dc.no.summary.or.caption.for.table");
                        }
                }
                warnIfEmpty(top, tree);
                tagStack.pop();
                done = true;
                break;
            } else if (top.tag == null || top.tag.endKind != HtmlTag.EndKind.REQUIRED) {
                tagStack.pop();
            } else {
                boolean found = false;
                for (TagStackItem si: tagStack) {
                    if (si.tag == t) {
                        found = true;
                        break;
                    }
                }
                if (found && top.tree.getKind() == DocTree.Kind.START_ELEMENT) {
                    env.messages.error(HTML, top.tree, "dc.tag.start.unmatched",
                            ((StartElementTree) top.tree).getName());
                    tagStack.pop();
                } else {
                    env.messages.error(HTML, tree, "dc.tag.end.unexpected", treeName);
                    done = true;
                    break;
                }
            }
        }

        if (!done && tagStack.isEmpty()) {
            env.messages.error(HTML, tree, "dc.tag.end.unexpected", treeName);
        }
    }

    return super.visitEndElement(tree, ignore);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:55,代码来源:Checker.java

示例10: visitEndElement

import com.sun.source.doctree.EndElementTree; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER_TREE)
public Object visitEndElement(EndElementTree node, Object p) {
    handleEndElement(node.getName());
    return super.visitEndElement(node, p);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:6,代码来源:JavadocFormatter.java

示例11: visitEndElement

import com.sun.source.doctree.EndElementTree; //导入依赖的package包/类
@Override @DefinedBy(Api.COMPILER_TREE)
public Void visitEndElement(EndElementTree tree, Void ignore) {
    final Name treeName = tree.getName();
    final HtmlTag t = HtmlTag.get(treeName);
    if (t == null) {
        env.messages.error(HTML, tree, "dc.tag.unknown", treeName);
    } else if (t.endKind == HtmlTag.EndKind.NONE) {
        env.messages.error(HTML, tree, "dc.tag.end.not.permitted", treeName);
    } else {
        boolean done = false;
        while (!tagStack.isEmpty()) {
            TagStackItem top = tagStack.peek();
            if (t == top.tag) {
                switch (t) {
                    case TABLE:
                        if (!top.attrs.contains(HtmlTag.Attr.SUMMARY)
                                && !top.flags.contains(Flag.TABLE_HAS_CAPTION)) {
                            env.messages.error(ACCESSIBILITY, tree,
                                    "dc.no.summary.or.caption.for.table");
                        }
                        break;

                    case SECTION:
                    case ARTICLE:
                        if (env.htmlVersion == HtmlVersion.HTML5 && !top.flags.contains(Flag.HAS_HEADING)) {
                            env.messages.error(HTML, tree, "dc.tag.requires.heading", treeName);
                        }
                        break;
                }
                warnIfEmpty(top, tree);
                tagStack.pop();
                done = true;
                break;
            } else if (top.tag == null || top.tag.endKind != HtmlTag.EndKind.REQUIRED) {
                tagStack.pop();
            } else {
                boolean found = false;
                for (TagStackItem si: tagStack) {
                    if (si.tag == t) {
                        found = true;
                        break;
                    }
                }
                if (found && top.tree.getKind() == DocTree.Kind.START_ELEMENT) {
                    env.messages.error(HTML, top.tree, "dc.tag.start.unmatched",
                            ((StartElementTree) top.tree).getName());
                    tagStack.pop();
                } else {
                    env.messages.error(HTML, tree, "dc.tag.end.unexpected", treeName);
                    done = true;
                    break;
                }
            }
        }

        if (!done && tagStack.isEmpty()) {
            env.messages.error(HTML, tree, "dc.tag.end.unexpected", treeName);
        }
    }

    return super.visitEndElement(tree, ignore);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:63,代码来源:Checker.java

示例12: EndElement

import com.sun.source.doctree.EndElementTree; //导入依赖的package包/类
/**Creates the DocTree's HTML EndElementTree.
 * 
 * @param name name of the element to be closed
 * @return newly created EndElementTree
 * @since 0.124
 */
public EndElementTree EndElement(CharSequence name) {
    return delegate.EndElement(name);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:TreeMaker.java

示例13: newEndElementTree

import com.sun.source.doctree.EndElementTree; //导入依赖的package包/类
/**
 * Create a new {@code EndElement} object, to represent the end of an HTML element.
 * @param name the name of the HTML element
 * @return an {@code EndElementTree} object
 */
EndElementTree newEndElementTree(Name name);
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:DocTreeFactory.java


注:本文中的com.sun.source.doctree.EndElementTree类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。