Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.
/ jdk13u-dev Public archive

Commit

Permalink
8223252: Update Javadoc help page with new search features
Browse files Browse the repository at this point in the history
Reviewed-by: jjg
  • Loading branch information
hns committed Dec 2, 2019
1 parent 13569d6 commit ff2f628
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
Expand Up @@ -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
Expand Down Expand Up @@ -326,9 +332,20 @@ protected void addHelpFileContents(Content contentTree) {
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);
Expand Down
Expand Up @@ -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}
Expand Down

0 comments on commit ff2f628

Please sign in to comment.