8223252: Update Javadoc help page with new search features

Reviewed-by: jjg
This commit is contained in:
Hannes Wallnöfer 2019-12-02 18:52:18 +01:00
parent 13569d67de
commit ff2f628e33
2 changed files with 32 additions and 6 deletions

View file

@ -54,6 +54,12 @@ public class HelpWriter extends HtmlDocletWriter {
private final Navigation navBar;
private final String[][] SEARCH_EXAMPLES = {
{"j.l.obj", "\"java.lang.Object\""},
{"InpStr", "\"java.io.InputStream\""},
{"HM.cK", "\"java.util.HashMap.containsKey(Object)\""}
};
/**
* Constructor to construct HelpWriter object.
* @param configuration the configuration
@ -326,9 +332,20 @@ public class HelpWriter extends HtmlDocletWriter {
Content searchHead = HtmlTree.HEADING(Headings.CONTENT_HEADING,
contents.getContent("doclet.help.search.head"));
htmlTree = HtmlTree.SECTION(HtmlStyle.helpSection, searchHead);
Content searchBody = contents.getContent("doclet.help.search.body");
Content searchPara = HtmlTree.P(searchBody);
htmlTree.add(searchPara);
Content searchIntro = HtmlTree.P(contents.getContent("doclet.help.search.intro"));
Content searchExamples = new HtmlTree(HtmlTag.UL);
for (String[] example : SEARCH_EXAMPLES) {
searchExamples.add(HtmlTree.LI(
contents.getContent("doclet.help.search.example",
HtmlTree.CODE(new StringContent(example[0])), example[1])));
}
Content searchSpecLink = HtmlTree.A(
resources.getText("doclet.help.search.spec.url", Runtime.version().feature()),
contents.getContent("doclet.help.search.spec.title"));
Content searchRefer = HtmlTree.P(contents.getContent("doclet.help.search.refer", searchSpecLink));
htmlTree.add(searchIntro);
htmlTree.add(searchExamples);
htmlTree.add(searchRefer);
ul.add(HtmlTree.LI(HtmlStyle.blockList, htmlTree));
Content divContent = HtmlTree.DIV(HtmlStyle.contentContainer, ul);

View file

@ -215,9 +215,18 @@ doclet.help.annotation_type.declaration=\
doclet.help.annotation_type.description=\
Annotation Type Description
doclet.help.search.head=Search
doclet.help.search.body=You can search for definitions of modules, packages, types, fields, methods \
and other terms defined in the API, using some or all of the name. "Camel-case" abbreviations \
are supported: for example, "InpStr" will find "InputStream" and "InputStreamReader".
# Introduction to Javadoc search features, followed by a list of examples
doclet.help.search.intro=You can search for definitions of modules, packages, types, fields, methods, \
system properties and other terms defined in the API, using some or all of the name, optionally \
using "camel-case" abbreviations. For example:
# Used to list search examples, {0} is a search term and {1} the matching result
doclet.help.search.example={0} will match {1}
# {0} contains a link to the current Javadoc Search Specification
doclet.help.search.refer=Refer to {0} for a full description of search features.
# The URL for the Javadoc Search Specification. {0} will be replaced by the JDK version number
doclet.help.search.spec.url=https://docs.oracle.com/en/java/javase/{0}/docs/specs/javadoc/javadoc-search-spec.html
# The title for the Javadoc Search Specification
doclet.help.search.spec.title=the Javadoc Search Specification
doclet.ClassUse_Packages.that.use.0=Packages that use {0}
doclet.ClassUse_Uses.of.0.in.1=Uses of {0} in {1}