changeset 57174:2baa1f8721b8

8223252: Update Javadoc help page with new search features Reviewed-by: jjg
author hannesw
date Mon, 02 Dec 2019 18:52:18 +0100
parents 73da8751c395
children d8b5e32ffa2f
files src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties
diffstat 2 files changed, 32 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java	Mon Dec 02 09:45:32 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HelpWriter.java	Mon Dec 02 18:52:18 2019 +0100
@@ -54,6 +54,12 @@
 
     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 @@
         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);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties	Mon Dec 02 09:45:32 2019 -0500
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties	Mon Dec 02 18:52:18 2019 +0100
@@ -215,9 +215,18 @@
 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}