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 |
27 |
28 import java.io.*; |
|
29 import java.util.*; |
28 import java.util.*; |
30 |
29 |
31 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; |
30 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; |
32 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; |
31 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; |
33 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; |
32 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; |
34 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; |
33 import jdk.javadoc.internal.doclets.formats.html.markup.StringContent; |
35 import jdk.javadoc.internal.doclets.toolkit.Content; |
34 import jdk.javadoc.internal.doclets.toolkit.Content; |
36 import jdk.javadoc.internal.doclets.toolkit.Messages; |
35 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; |
37 import jdk.javadoc.internal.doclets.toolkit.util.DocPath; |
36 import jdk.javadoc.internal.doclets.toolkit.util.DocPath; |
38 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; |
37 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; |
39 import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException; |
|
40 import jdk.javadoc.internal.doclets.toolkit.util.IndexBuilder; |
38 import jdk.javadoc.internal.doclets.toolkit.util.IndexBuilder; |
41 |
39 |
42 |
40 |
43 /** |
41 /** |
44 * Generate only one index file for all the Member Names with Indexing in |
42 * Generate only one index file for all the Member Names with Indexing in |
60 |
58 |
61 /** |
59 /** |
62 * Construct the SingleIndexWriter with filename "index-all.html" and the |
60 * Construct the SingleIndexWriter with filename "index-all.html" and the |
63 * {@link IndexBuilder} |
61 * {@link IndexBuilder} |
64 * |
62 * |
|
63 * @param configuration the configuration for this doclet |
65 * @param filename Name of the index file to be generated. |
64 * @param filename Name of the index file to be generated. |
66 * @param indexbuilder Unicode based Index from {@link IndexBuilder} |
65 * @param indexbuilder Unicode based Index from {@link IndexBuilder} |
67 */ |
66 */ |
68 public SingleIndexWriter(ConfigurationImpl configuration, |
67 public SingleIndexWriter(ConfigurationImpl configuration, |
69 DocPath filename, |
68 DocPath filename, |
70 IndexBuilder indexbuilder) throws IOException { |
69 IndexBuilder indexbuilder) { |
71 super(configuration, filename, indexbuilder); |
70 super(configuration, filename, indexbuilder); |
72 } |
71 } |
73 |
72 |
74 /** |
73 /** |
75 * Generate single index file, for all Unicode characters. |
74 * Generate single index file, for all Unicode characters. |
76 * |
75 * |
|
76 * @param configuration the configuration for this doclet |
77 * @param indexbuilder IndexBuilder built by {@link IndexBuilder} |
77 * @param indexbuilder IndexBuilder built by {@link IndexBuilder} |
78 * @throws DocletAbortException |
78 * @throws DocFileIOException if there is a problem generating the index |
79 */ |
79 */ |
80 public static void generate(ConfigurationImpl configuration, |
80 public static void generate(ConfigurationImpl configuration, |
81 IndexBuilder indexbuilder) { |
81 IndexBuilder indexbuilder) throws DocFileIOException { |
82 SingleIndexWriter indexgen; |
|
83 DocPath filename = DocPaths.INDEX_ALL; |
82 DocPath filename = DocPaths.INDEX_ALL; |
84 try { |
83 SingleIndexWriter indexgen = new SingleIndexWriter(configuration, |
85 indexgen = new SingleIndexWriter(configuration, |
84 filename, indexbuilder); |
86 filename, indexbuilder); |
85 indexgen.generateIndexFile(); |
87 indexgen.generateIndexFile(); |
|
88 } catch (IOException exc) { |
|
89 Messages messages = configuration.getMessages(); |
|
90 messages.error("doclet.exception_encountered", |
|
91 exc.toString(), filename); |
|
92 throw new DocletAbortException(exc); |
|
93 } |
|
94 } |
86 } |
95 |
87 |
96 /** |
88 /** |
97 * Generate the contents of each index file, with Header, Footer, |
89 * Generate the contents of each index file, with Header, Footer, |
98 * Member Field, Method and Constructor Description. |
90 * Member Field, Method and Constructor Description. |
|
91 * @throws DocFileIOException if there is a problem generating the index |
99 */ |
92 */ |
100 protected void generateIndexFile() throws IOException { |
93 protected void generateIndexFile() throws DocFileIOException { |
101 String title = configuration.getText("doclet.Window_Single_Index"); |
94 String title = configuration.getText("doclet.Window_Single_Index"); |
102 HtmlTree body = getBody(true, getWindowTitle(title)); |
95 HtmlTree body = getBody(true, getWindowTitle(title)); |
103 HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER)) |
96 HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER)) |
104 ? HtmlTree.HEADER() |
97 ? HtmlTree.HEADER() |
105 : body; |
98 : body; |