src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/SimpleTaglet.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 21,37 ****
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
! package com.sun.tools.doclets.internal.toolkit.taglets;
! import com.sun.javadoc.*;
! import com.sun.tools.doclets.internal.toolkit.Content;
! import com.sun.tools.doclets.internal.toolkit.util.DocFinder;
! import com.sun.tools.javac.util.StringUtils;
/**
* A simple single argument custom tag.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
--- 21,44 ----
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
! package jdk.javadoc.internal.doclets.toolkit.taglets;
! import java.util.List;
! import java.util.Locale;
+ import javax.lang.model.element.Element;
+
+ import com.sun.source.doctree.DocTree;
+
+ import jdk.javadoc.internal.doclets.toolkit.Content;
+ import jdk.javadoc.internal.doclets.toolkit.util.CommentHelper;
+ import jdk.javadoc.internal.doclets.toolkit.util.DocFinder;
+ import jdk.javadoc.internal.doclets.toolkit.util.Utils;
+
/**
* A simple single argument custom tag.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
*** 109,119 ****
* and 'f' for field.
*/
public SimpleTaglet(String tagName, String header, String locations) {
this.tagName = tagName;
this.header = header;
! locations = StringUtils.toLowerCase(locations);
if (locations.contains(ALL) && !locations.contains(EXCLUDED)) {
this.locations = PACKAGE + TYPE + FIELD + METHOD + CONSTRUCTOR + OVERVIEW;
} else {
this.locations = locations;
}
--- 116,126 ----
* and 'f' for field.
*/
public SimpleTaglet(String tagName, String header, String locations) {
this.tagName = tagName;
this.header = header;
! locations = Utils.toLowerCase(locations);
if (locations.contains(ALL) && !locations.contains(EXCLUDED)) {
this.locations = PACKAGE + TYPE + FIELD + METHOD + CONSTRUCTOR + OVERVIEW;
} else {
this.locations = locations;
}
*** 202,232 ****
return false;
}
@Override
public void inherit(DocFinder.Input input, DocFinder.Output output) {
! Tag[] tags = input.element.tags(tagName);
! if (tags.length > 0) {
output.holder = input.element;
! output.holderTag = tags[0];
output.inlineTags = input.isFirstSentence
! ? tags[0].firstSentenceTags() : tags[0].inlineTags();
}
}
/**
* {@inheritDoc}
*/
! public Content getTagletOutput(Tag tag, TagletWriter writer) {
! return header == null || tag == null ? null : writer.simpleTagOutput(tag, header);
}
/**
* {@inheritDoc}
*/
! public Content getTagletOutput(Doc holder, TagletWriter writer) {
! if (header == null || holder.tags(getName()).length == 0) {
return null;
}
! return writer.simpleTagOutput(holder.tags(getName()), header);
}
}
--- 209,243 ----
return false;
}
@Override
public void inherit(DocFinder.Input input, DocFinder.Output output) {
! List<? extends DocTree> tags = input.utils.getBlockTags(input.element, tagName);
! if (!tags.isEmpty()) {
output.holder = input.element;
! output.holderTag = tags.get(0);
! CommentHelper ch = input.utils.getCommentHelper(output.holder);
output.inlineTags = input.isFirstSentence
! ? ch.getFirstSentenceTrees(input.utils.configuration, output.holderTag)
! : ch.getTags(input.utils.configuration, output.holderTag);
}
}
/**
* {@inheritDoc}
*/
! public Content getTagletOutput(Element element, DocTree tag, TagletWriter writer) {
! return header == null || tag == null ? null : writer.simpleTagOutput(element, tag, header);
}
/**
* {@inheritDoc}
*/
! public Content getTagletOutput(Element holder, TagletWriter writer) {
! Utils utils = writer.configuration().utils;
! List<? extends DocTree> tags = utils.getBlockTags(holder, getName());
! if (header == null || tags.isEmpty()) {
return null;
}
! return writer.simpleTagOutput(holder, tags, header);
}
}