Java Code Examples for com.sun.source.doctree.DocTree.Kind#TEXT

The following examples show how to use com.sun.source.doctree.DocTree.Kind#TEXT . 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: DocTreeMaker.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private boolean isTextTree(DocTree tree) {
    return tree.getKind() == Kind.TEXT;
}
 
Example 2
Source File: DocTreeMaker.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private boolean isTextTree(DocTree tree) {
    return tree.getKind() == Kind.TEXT;
}
 
Example 3
Source File: JavaScriptScanner.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override @DefinedBy(Api.COMPILER_TREE)
public Void visitAttribute(AttributeTree tree, Consumer<DocTreePath> f) {
    String name = tree.getName().toString().toLowerCase(Locale.ENGLISH);
    switch (name) {
        // See https://www.w3.org/TR/html-markup/global-attributes.html#common.attrs.event-handler
        case "onabort":  case "onblur":  case "oncanplay":  case "oncanplaythrough":
        case "onchange":  case "onclick":  case "oncontextmenu":  case "ondblclick":
        case "ondrag":  case "ondragend":  case "ondragenter":  case "ondragleave":
        case "ondragover":  case "ondragstart":  case "ondrop":  case "ondurationchange":
        case "onemptied":  case "onended":  case "onerror":  case "onfocus":  case "oninput":
        case "oninvalid":  case "onkeydown":  case "onkeypress":  case "onkeyup":
        case "onload":  case "onloadeddata":  case "onloadedmetadata":  case "onloadstart":
        case "onmousedown":  case "onmousemove":  case "onmouseout":  case "onmouseover":
        case "onmouseup":  case "onmousewheel":  case "onpause":  case "onplay":
        case "onplaying":  case "onprogress":  case "onratechange":  case "onreadystatechange":
        case "onreset":  case "onscroll":  case "onseeked":  case "onseeking":
        case "onselect":  case "onshow":  case "onstalled":  case "onsubmit":  case "onsuspend":
        case "ontimeupdate":  case "onvolumechange":  case "onwaiting":

        // See https://www.w3.org/TR/html4/sgml/dtd.html
        // Most of the attributes that take a %Script are also defined as event handlers
        // in HTML 5. The one exception is onunload.
        // case "onchange":  case "onclick":   case "ondblclick":  case "onfocus":
        // case "onkeydown":  case "onkeypress":  case "onkeyup":  case "onload":
        // case "onmousedown":  case "onmousemove":  case "onmouseout":  case "onmouseover":
        // case "onmouseup":  case "onreset":  case "onselect":  case "onsubmit":
        case "onunload":
            f.accept(getCurrentPath());
            break;

        // See https://www.w3.org/TR/html4/sgml/dtd.html
        //     https://www.w3.org/TR/html5/
        // These are all the attributes that take a %URI or a valid URL potentially surrounded
        // by spaces
        case "action":  case "cite":  case "classid":  case "codebase":  case "data":
        case "datasrc":  case "for":  case "href":  case "longdesc":  case "profile":
        case "src":  case "usemap":
            List<? extends DocTree> value = tree.getValue();
            if (value != null && !value.isEmpty() && value.get(0).getKind() == Kind.TEXT) {
                String v = value.get(0).toString().trim().toLowerCase(Locale.ENGLISH);
                if (v.startsWith("javascript:")) {
                    f.accept(getCurrentPath());
                }
            }
            break;
    }
    return super.visitAttribute(tree, f);
}