Java Code Examples for com.sun.source.doctree.AttributeTree#getValue()

The following examples show how to use com.sun.source.doctree.AttributeTree#getValue() . 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: Checker.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private String getAttrValue(AttributeTree tree) {
    if (tree.getValue() == null)
        return null;

    StringWriter sw = new StringWriter();
    try {
        new DocPretty(sw).print(tree.getValue());
    } catch (IOException e) {
        // cannot happen
    }
    // ignore potential use of entities for now
    return sw.toString();
}
 
Example 2
Source File: Checker.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private String getAttrValue(AttributeTree tree) {
    if (tree.getValue() == null)
        return null;

    StringWriter sw = new StringWriter();
    try {
        new DocPretty(sw).print(tree.getValue());
    } catch (IOException e) {
        // cannot happen
    }
    // ignore potential use of entities for now
    return sw.toString();
}
 
Example 3
Source File: Checker.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private String getAttrValue(AttributeTree tree) {
    if (tree.getValue() == null)
        return null;

    StringWriter sw = new StringWriter();
    try {
        new DocPretty(sw).print(tree.getValue());
    } catch (IOException e) {
        // cannot happen
    }
    // ignore potential use of entities for now
    return sw.toString();
}
 
Example 4
Source File: ImmutableDocTreeTranslator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected final AttributeTree rewriteChildren(AttributeTree tree) {
    AttributeTree value = tree;
    List<? extends DocTree> vl = translateDoc(tree.getValue());
    if (vl != tree.getValue()) {
        value = make.Attribute((Name) tree.getName(), tree.getValueKind(), vl);
    }
    return value;
}
 
Example 5
Source File: VeryPretty.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Void visitAttribute(AttributeTree node, Void p) {
    print(node.getName());
    String quote;
    switch (node.getValueKind()) {
        case EMPTY:
            return null;
        case UNQUOTED:
            quote = "";
            break;
        case SINGLE:
            quote = "'";
            break;
        case DOUBLE:
            quote = "\"";
            break;
        default:
            throw new AssertionError();
    }
    print("=");
    print(quote);
    for (DocTree docTree : node.getValue()) {
        doAccept((DCTree)docTree);
    }
    print(quote);
    return null;
}
 
Example 6
Source File: Checker.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private String getAttrValue(AttributeTree tree) {
    if (tree.getValue() == null)
        return null;

    StringWriter sw = new StringWriter();
    try {
        new DocPretty(sw).print(tree.getValue());
    } catch (IOException e) {
        // cannot happen
    }
    // ignore potential use of entities for now
    return sw.toString();
}
 
Example 7
Source File: Checker.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private String getAttrValue(AttributeTree tree) {
    if (tree.getValue() == null)
        return null;

    StringWriter sw = new StringWriter();
    try {
        new DocPretty(sw).print(tree.getValue());
    } catch (IOException e) {
        // cannot happen
    }
    // ignore potential use of entities for now
    return sw.toString();
}
 
Example 8
Source File: Checker.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private String getAttrValue(AttributeTree tree) {
    if (tree.getValue() == null)
        return null;

    StringWriter sw = new StringWriter();
    try {
        new DocPretty(sw).print(tree.getValue());
    } catch (IOException e) {
        // cannot happen
    }
    // ignore potential use of entities for now
    return sw.toString();
}
 
Example 9
Source File: Checker.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private String getAttrValue(AttributeTree tree) {
    if (tree.getValue() == null)
        return null;

    StringWriter sw = new StringWriter();
    try {
        new DocPretty(sw).print(tree.getValue());
    } catch (IOException e) {
        // cannot happen
    }
    // ignore potential use of entities for now
    return sw.toString();
}
 
Example 10
Source File: Checker.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private String getAttrValue(AttributeTree tree) {
    if (tree.getValue() == null)
        return null;

    StringWriter sw = new StringWriter();
    try {
        new DocPretty(sw).print(tree.getValue());
    } catch (IOException e) {
        // cannot happen
    }
    // ignore potential use of entities for now
    return sw.toString();
}
 
Example 11
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);
}