22 * or visit www.oracle.com if you need additional information or have any |
22 * or visit www.oracle.com if you need additional information or have any |
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 |
25 |
26 package jdk.javadoc.internal.doclets.formats.html; |
26 package jdk.javadoc.internal.doclets.formats.html; |
27 |
|
28 import java.io.*; |
|
29 |
27 |
30 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; |
28 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; |
31 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; |
29 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; |
32 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; |
30 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; |
33 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; |
31 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; |
34 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; |
32 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; |
35 import jdk.javadoc.internal.doclets.toolkit.Content; |
33 import jdk.javadoc.internal.doclets.toolkit.Content; |
36 import jdk.javadoc.internal.doclets.toolkit.Messages; |
34 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; |
37 import jdk.javadoc.internal.doclets.toolkit.util.DocPath; |
35 import jdk.javadoc.internal.doclets.toolkit.util.DocPath; |
38 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; |
36 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; |
39 import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException; |
|
40 |
37 |
41 |
38 |
42 /** |
39 /** |
43 * Generate the Help File for the generated API documentation. The help file |
40 * Generate the Help File for the generated API documentation. The help file |
44 * contents are helpful for browsing the generated documentation. |
41 * contents are helpful for browsing the generated documentation. |
66 /** |
63 /** |
67 * Construct the HelpWriter object and then use it to generate the help |
64 * Construct the HelpWriter object and then use it to generate the help |
68 * file. The name of the generated file is "help-doc.html". The help file |
65 * file. The name of the generated file is "help-doc.html". The help file |
69 * will get generated if and only if "-helpfile" and "-nohelp" is not used |
66 * will get generated if and only if "-helpfile" and "-nohelp" is not used |
70 * on the command line. |
67 * on the command line. |
71 * @throws DocletAbortException |
68 * |
|
69 * @throws DocFileIOException if there is a problem while generating the documentation |
72 */ |
70 */ |
73 public static void generate(ConfigurationImpl configuration) { |
71 public static void generate(ConfigurationImpl configuration) throws DocFileIOException { |
74 HelpWriter helpgen; |
72 DocPath filename = DocPaths.HELP_DOC; |
75 DocPath filename = DocPath.empty; |
73 HelpWriter helpgen = new HelpWriter(configuration, filename); |
76 try { |
74 helpgen.generateHelpFile(); |
77 filename = DocPaths.HELP_DOC; |
|
78 helpgen = new HelpWriter(configuration, filename); |
|
79 helpgen.generateHelpFile(); |
|
80 } catch (IOException exc) { |
|
81 Messages messages = configuration.getMessages(); |
|
82 messages.error("doclet.exception_encountered", |
|
83 exc.toString(), filename); |
|
84 throw new DocletAbortException(exc); |
|
85 } |
|
86 } |
75 } |
87 |
76 |
88 /** |
77 /** |
89 * Generate the help file contents. |
78 * Generate the help file contents. |
|
79 * |
|
80 * @throws DocFileIOException if there is a problem while generating the documentation |
90 */ |
81 */ |
91 protected void generateHelpFile() throws IOException { |
82 protected void generateHelpFile() throws DocFileIOException { |
92 String title = configuration.getText("doclet.Window_Help_title"); |
83 String title = configuration.getText("doclet.Window_Help_title"); |
93 HtmlTree body = getBody(true, getWindowTitle(title)); |
84 HtmlTree body = getBody(true, getWindowTitle(title)); |
94 HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER)) |
85 HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER)) |
95 ? HtmlTree.HEADER() |
86 ? HtmlTree.HEADER() |
96 : body; |
87 : body; |