com.sun.source.doctree.StartElementTree Java Examples
The following examples show how to use
com.sun.source.doctree.StartElementTree.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Analyzer.java From netbeans with Apache License 2.0 | 6 votes |
@Override public Void visitDocComment(DocCommentTree node, List<ErrorDescription> errors) { DocTreePath currentDocPath = getCurrentPath(); Void value = super.visitDocComment(node, errors); DocSourcePositions sp = (DocSourcePositions) javac.getTrees().getSourcePositions(); while (!tagStack.isEmpty()) { StartElementTree startTree = tagStack.pop(); Name tagName = startTree.getName(); HtmlTag tag = HtmlTag.get(tagName); if (tag.endKind == HtmlTag.EndKind.REQUIRED) { 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))); } } return value; }
Example #2
Source File: VeryPretty.java From netbeans with Apache License 2.0 | 6 votes |
@Override public Void visitStartElement(StartElementTree node, Void p) { print("<"); print(node.getName()); java.util.List<? extends DocTree> attrs = node.getAttributes(); if (!attrs.isEmpty()) { print(" "); for (DocTree docTree : attrs) { doAccept((DCTree)docTree); } DocTree last = attrs.get(attrs.size() - 1); if (node.isSelfClosing() && last instanceof AttributeTree && ((AttributeTree) last).getValueKind() == ValueKind.UNQUOTED) print(" "); } if (node.isSelfClosing()) print("/"); print(">"); return null; }
Example #3
Source File: HtmlDocletWriter.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
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; }
Example #4
Source File: JavaScriptScanner.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override @DefinedBy(Api.COMPILER_TREE) public Void visitStartElement(StartElementTree tree, Consumer<DocTreePath> f) { String name = tree.getName().toString(); if (name.equalsIgnoreCase("script")) f.accept(getCurrentPath()); return super.visitStartElement(tree, f); }
Example #5
Source File: Analyzer.java From netbeans with Apache License 2.0 | 5 votes |
@Override @Messages({"# {0} - Tag name", "TAG_UNKNOWN=Unknown HTML Tag: <{0}>", "# {0} - Tag name", "TAG_END_UNKNOWN=Unknown HTML End Tag: </{0}>", "TAG_SELF_CLOSING=Self-closing element not allowed"}) public Void visitStartElement(StartElementTree 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_UNKNOWN(treeName))); } else { if(t.endKind != HtmlTag.EndKind.NONE) { tagStack.push(node); } } if (node.isSelfClosing()) { errors.add(ErrorDescriptionFactory.forSpan(ctx, start, end, TAG_SELF_CLOSING())); } return super.visitStartElement(node, errors); }
Example #6
Source File: Checker.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override public Void visitDocComment(DocCommentTree tree, Void ignore) { super.visitDocComment(tree, ignore); for (TagStackItem tsi: tagStack) { warnIfEmpty(tsi, null); if (tsi.tree.getKind() == DocTree.Kind.START_ELEMENT && tsi.tag.endKind == HtmlTag.EndKind.REQUIRED) { StartElementTree t = (StartElementTree) tsi.tree; env.messages.error(HTML, t, "dc.tag.not.closed", t.getName()); } } return null; }
Example #7
Source File: Checker.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public Void visitDocComment(DocCommentTree tree, Void ignore) { super.visitDocComment(tree, ignore); for (TagStackItem tsi: tagStack) { warnIfEmpty(tsi, null); if (tsi.tree.getKind() == DocTree.Kind.START_ELEMENT && tsi.tag.endKind == HtmlTag.EndKind.REQUIRED) { StartElementTree t = (StartElementTree) tsi.tree; env.messages.error(HTML, t, "dc.tag.not.closed", t.getName()); } } return null; }
Example #8
Source File: Checker.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private void checkHeader(StartElementTree tree, HtmlTag tag) { // verify the new tag if (getHeaderLevel(tag) > getHeaderLevel(currHeaderTag) + 1) { if (currHeaderTag == null) { env.messages.error(ACCESSIBILITY, tree, "dc.tag.header.sequence.1", tag); } else { env.messages.error(ACCESSIBILITY, tree, "dc.tag.header.sequence.2", tag, currHeaderTag); } } currHeaderTag = tag; }
Example #9
Source File: Checker.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override @DefinedBy(Api.COMPILER_TREE) public Void visitDocComment(DocCommentTree tree, Void ignore) { super.visitDocComment(tree, ignore); for (TagStackItem tsi: tagStack) { warnIfEmpty(tsi, null); if (tsi.tree.getKind() == DocTree.Kind.START_ELEMENT && tsi.tag.endKind == HtmlTag.EndKind.REQUIRED) { StartElementTree t = (StartElementTree) tsi.tree; env.messages.error(HTML, t, "dc.tag.not.closed", t.getName()); } } return null; }
Example #10
Source File: Checker.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
void checkAllowsText(DocTree tree) { TagStackItem top = tagStack.peek(); if (top != null && top.tree.getKind() == DocTree.Kind.START_ELEMENT && !top.tag.acceptsText()) { if (top.flags.add(Flag.REPORTED_BAD_INLINE)) { env.messages.error(HTML, tree, "dc.text.not.allowed", ((StartElementTree) top.tree).getName()); } } }
Example #11
Source File: Checker.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private void checkHeader(StartElementTree tree, HtmlTag tag) { // verify the new tag if (getHeaderLevel(tag) > getHeaderLevel(currHeaderTag) + 1) { if (currHeaderTag == null) { env.messages.error(ACCESSIBILITY, tree, "dc.tag.header.sequence.1", tag); } else { env.messages.error(ACCESSIBILITY, tree, "dc.tag.header.sequence.2", tag, currHeaderTag); } } currHeaderTag = tag; }
Example #12
Source File: DocTreeMaker.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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; } }
Example #13
Source File: Checker.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
void checkAllowsText(DocTree tree) { TagStackItem top = tagStack.peek(); if (top != null && top.tree.getKind() == DocTree.Kind.START_ELEMENT && !top.tag.acceptsText()) { if (top.flags.add(Flag.REPORTED_BAD_INLINE)) { env.messages.error(HTML, tree, "dc.text.not.allowed", ((StartElementTree) top.tree).getName()); } } }
Example #14
Source File: Checker.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public Void visitDocComment(DocCommentTree tree, Void ignore) { super.visitDocComment(tree, ignore); for (TagStackItem tsi: tagStack) { warnIfEmpty(tsi, null); if (tsi.tree.getKind() == DocTree.Kind.START_ELEMENT && tsi.tag.endKind == HtmlTag.EndKind.REQUIRED) { StartElementTree t = (StartElementTree) tsi.tree; env.messages.error(HTML, t, "dc.tag.not.closed", t.getName()); } } return null; }
Example #15
Source File: Checker.java From hottub with GNU General Public License v2.0 | 5 votes |
void checkAllowsText(DocTree tree) { TagStackItem top = tagStack.peek(); if (top != null && top.tree.getKind() == DocTree.Kind.START_ELEMENT && !top.tag.acceptsText()) { if (top.flags.add(Flag.REPORTED_BAD_INLINE)) { env.messages.error(HTML, tree, "dc.text.not.allowed", ((StartElementTree) top.tree).getName()); } } }
Example #16
Source File: Checker.java From hottub with GNU General Public License v2.0 | 5 votes |
private void checkHeader(StartElementTree tree, HtmlTag tag) { // verify the new tag if (getHeaderLevel(tag) > getHeaderLevel(currHeaderTag) + 1) { if (currHeaderTag == null) { env.messages.error(ACCESSIBILITY, tree, "dc.tag.header.sequence.1", tag); } else { env.messages.error(ACCESSIBILITY, tree, "dc.tag.header.sequence.2", tag, currHeaderTag); } } currHeaderTag = tag; }
Example #17
Source File: Checker.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public Void visitDocComment(DocCommentTree tree, Void ignore) { super.visitDocComment(tree, ignore); for (TagStackItem tsi: tagStack) { warnIfEmpty(tsi, null); if (tsi.tree.getKind() == DocTree.Kind.START_ELEMENT && tsi.tag.endKind == HtmlTag.EndKind.REQUIRED) { StartElementTree t = (StartElementTree) tsi.tree; env.messages.error(HTML, t, "dc.tag.not.closed", t.getName()); } } return null; }
Example #18
Source File: Checker.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
void checkAllowsText(DocTree tree) { TagStackItem top = tagStack.peek(); if (top != null && top.tree.getKind() == DocTree.Kind.START_ELEMENT && !top.tag.acceptsText()) { if (top.flags.add(Flag.REPORTED_BAD_INLINE)) { env.messages.error(HTML, tree, "dc.text.not.allowed", ((StartElementTree) top.tree).getName()); } } }
Example #19
Source File: Checker.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private void checkHeader(StartElementTree tree, HtmlTag tag) { // verify the new tag if (getHeaderLevel(tag) > getHeaderLevel(currHeaderTag) + 1) { if (currHeaderTag == null) { env.messages.error(ACCESSIBILITY, tree, "dc.tag.header.sequence.1", tag); } else { env.messages.error(ACCESSIBILITY, tree, "dc.tag.header.sequence.2", tag, currHeaderTag); } } currHeaderTag = tag; }
Example #20
Source File: Checker.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public Void visitDocComment(DocCommentTree tree, Void ignore) { super.visitDocComment(tree, ignore); for (TagStackItem tsi: tagStack) { warnIfEmpty(tsi, null); if (tsi.tree.getKind() == DocTree.Kind.START_ELEMENT && tsi.tag.endKind == HtmlTag.EndKind.REQUIRED) { StartElementTree t = (StartElementTree) tsi.tree; env.messages.error(HTML, t, "dc.tag.not.closed", t.getName()); } } return null; }
Example #21
Source File: Checker.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
void checkAllowsText(DocTree tree) { TagStackItem top = tagStack.peek(); if (top != null && top.tree.getKind() == DocTree.Kind.START_ELEMENT && !top.tag.acceptsText()) { if (top.flags.add(Flag.REPORTED_BAD_INLINE)) { env.messages.error(HTML, tree, "dc.text.not.allowed", ((StartElementTree) top.tree).getName()); } } }
Example #22
Source File: Checker.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private void checkHeader(StartElementTree tree, HtmlTag tag) { // verify the new tag if (getHeaderLevel(tag) > getHeaderLevel(currHeaderTag) + 1) { if (currHeaderTag == null) { env.messages.error(ACCESSIBILITY, tree, "dc.tag.header.sequence.1", tag); } else { env.messages.error(ACCESSIBILITY, tree, "dc.tag.header.sequence.2", tag, currHeaderTag); } } currHeaderTag = tag; }
Example #23
Source File: JavadocConverter.java From j2objc with Apache License 2.0 | 5 votes |
@Override public Void visitStartElement(StartElementTree node, TagElement tag) { StringBuilder sb = new StringBuilder("<"); sb.append(node.getName()); for (DocTree attr : node.getAttributes()) { sb.append(' '); sb.append(attr); } sb.append('>'); tag.addFragment(setPos(node, new TextElement().setText(sb.toString()))); return null; }
Example #24
Source File: Checker.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
void checkAllowsText(DocTree tree) { TagStackItem top = tagStack.peek(); if (top != null && top.tree.getKind() == DocTree.Kind.START_ELEMENT && !top.tag.acceptsText()) { if (top.flags.add(Flag.REPORTED_BAD_INLINE)) { env.messages.error(HTML, tree, "dc.text.not.allowed", ((StartElementTree) top.tree).getName()); } } }
Example #25
Source File: Checker.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public Void visitDocComment(DocCommentTree tree, Void ignore) { super.visitDocComment(tree, ignore); for (TagStackItem tsi: tagStack) { warnIfEmpty(tsi, null); if (tsi.tree.getKind() == DocTree.Kind.START_ELEMENT && tsi.tag.endKind == HtmlTag.EndKind.REQUIRED) { StartElementTree t = (StartElementTree) tsi.tree; env.messages.error(HTML, t, "dc.tag.not.closed", t.getName()); } } return null; }
Example #26
Source File: Checker.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
void checkAllowsText(DocTree tree) { TagStackItem top = tagStack.peek(); if (top != null && top.tree.getKind() == DocTree.Kind.START_ELEMENT && !top.tag.acceptsText()) { if (top.flags.add(Flag.REPORTED_BAD_INLINE)) { env.messages.error(HTML, tree, "dc.text.not.allowed", ((StartElementTree) top.tree).getName()); } } }
Example #27
Source File: Checker.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private void checkHeader(StartElementTree tree, HtmlTag tag) { // verify the new tag if (getHeaderLevel(tag) > getHeaderLevel(currHeaderTag) + 1) { if (currHeaderTag == null) { env.messages.error(ACCESSIBILITY, tree, "dc.tag.header.sequence.1", tag); } else { env.messages.error(ACCESSIBILITY, tree, "dc.tag.header.sequence.2", tag, currHeaderTag); } } currHeaderTag = tag; }
Example #28
Source File: Checker.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private void checkHeader(StartElementTree tree, HtmlTag tag) { // verify the new tag if (getHeaderLevel(tag) > getHeaderLevel(currHeaderTag) + 1) { if (currHeaderTag == null) { env.messages.error(ACCESSIBILITY, tree, "dc.tag.header.sequence.1", tag); } else { env.messages.error(ACCESSIBILITY, tree, "dc.tag.header.sequence.2", tag, currHeaderTag); } } currHeaderTag = tag; }
Example #29
Source File: Checker.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
void checkAllowsText(DocTree tree) { TagStackItem top = tagStack.peek(); if (top != null && top.tree.getKind() == DocTree.Kind.START_ELEMENT && !top.tag.acceptsText()) { if (top.flags.add(Flag.REPORTED_BAD_INLINE)) { env.messages.error(HTML, tree, "dc.text.not.allowed", ((StartElementTree) top.tree).getName()); } } }
Example #30
Source File: DocTreeMaker.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 5 votes |
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; } }