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.ArrayList; |
28 import java.util.ArrayList; |
30 import java.util.EnumMap; |
29 import java.util.EnumMap; |
31 import java.util.List; |
30 import java.util.List; |
32 |
31 |
33 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; |
32 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlConstants; |
34 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; |
33 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle; |
35 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; |
34 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; |
36 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; |
35 import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree; |
37 import jdk.javadoc.internal.doclets.toolkit.Content; |
36 import jdk.javadoc.internal.doclets.toolkit.Content; |
38 import jdk.javadoc.internal.doclets.toolkit.Messages; |
|
39 import jdk.javadoc.internal.doclets.toolkit.util.DeprecatedAPIListBuilder; |
37 import jdk.javadoc.internal.doclets.toolkit.util.DeprecatedAPIListBuilder; |
|
38 import jdk.javadoc.internal.doclets.toolkit.util.DeprecatedAPIListBuilder.DeprElementKind; |
|
39 import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; |
40 import jdk.javadoc.internal.doclets.toolkit.util.DocPath; |
40 import jdk.javadoc.internal.doclets.toolkit.util.DocPath; |
41 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; |
41 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; |
42 import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException; |
|
43 |
|
44 import static jdk.javadoc.internal.doclets.toolkit.util.DeprecatedAPIListBuilder.*; |
|
45 |
42 |
46 /** |
43 /** |
47 * Generate File to list all the deprecated classes and class members with the |
44 * Generate File to list all the deprecated classes and class members with the |
48 * appropriate links. |
45 * appropriate links. |
49 * |
46 * |
187 private ConfigurationImpl configuration; |
184 private ConfigurationImpl configuration; |
188 |
185 |
189 /** |
186 /** |
190 * Constructor. |
187 * Constructor. |
191 * |
188 * |
192 * @param filename the file to be generated. |
189 * @param configuration the configuration for this doclet |
193 */ |
190 * @param filename the file to be generated |
194 |
191 */ |
195 public DeprecatedListWriter(ConfigurationImpl configuration, |
192 |
196 DocPath filename) throws IOException { |
193 public DeprecatedListWriter(ConfigurationImpl configuration, DocPath filename) { |
197 super(configuration, filename); |
194 super(configuration, filename); |
198 this.configuration = configuration; |
195 this.configuration = configuration; |
199 NestedClassWriterImpl classW = new NestedClassWriterImpl(this); |
196 NestedClassWriterImpl classW = new NestedClassWriterImpl(this); |
200 writerMap = new EnumMap<>(DeprElementKind.class); |
197 writerMap = new EnumMap<>(DeprElementKind.class); |
201 for (DeprElementKind kind : DeprElementKind.values()) { |
198 for (DeprElementKind kind : DeprElementKind.values()) { |
234 * Get list of all the deprecated classes and members in all the Packages |
231 * Get list of all the deprecated classes and members in all the Packages |
235 * specified on the Command Line. |
232 * specified on the Command Line. |
236 * Then instantiate DeprecatedListWriter and generate File. |
233 * Then instantiate DeprecatedListWriter and generate File. |
237 * |
234 * |
238 * @param configuration the current configuration of the doclet. |
235 * @param configuration the current configuration of the doclet. |
239 */ |
236 * @throws DocFileIOException if there is a problem writing the deprecated list |
240 public static void generate(ConfigurationImpl configuration) { |
237 */ |
|
238 public static void generate(ConfigurationImpl configuration) throws DocFileIOException { |
241 DocPath filename = DocPaths.DEPRECATED_LIST; |
239 DocPath filename = DocPaths.DEPRECATED_LIST; |
242 try { |
240 DeprecatedListWriter depr = new DeprecatedListWriter(configuration, filename); |
243 DeprecatedListWriter depr = |
241 depr.generateDeprecatedListFile( |
244 new DeprecatedListWriter(configuration, filename); |
242 new DeprecatedAPIListBuilder(configuration)); |
245 depr.generateDeprecatedListFile( |
|
246 new DeprecatedAPIListBuilder(configuration)); |
|
247 } catch (IOException exc) { |
|
248 Messages messages = configuration.getMessages(); |
|
249 messages.error("doclet.exception_encountered", |
|
250 exc.toString(), filename); |
|
251 throw new DocletAbortException(exc); |
|
252 } |
|
253 } |
243 } |
254 |
244 |
255 /** |
245 /** |
256 * Generate the deprecated API list. |
246 * Generate the deprecated API list. |
257 * |
247 * |
258 * @param deprapi list of deprecated API built already. |
248 * @param deprapi list of deprecated API built already. |
|
249 * @throws DocFileIOException if there is a problem writing the deprecated list |
259 */ |
250 */ |
260 protected void generateDeprecatedListFile(DeprecatedAPIListBuilder deprapi) |
251 protected void generateDeprecatedListFile(DeprecatedAPIListBuilder deprapi) |
261 throws IOException { |
252 throws DocFileIOException { |
262 HtmlTree body = getHeader(); |
253 HtmlTree body = getHeader(); |
263 HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN)) |
254 HtmlTree htmlTree = (configuration.allowTag(HtmlTag.MAIN)) |
264 ? HtmlTree.MAIN() |
255 ? HtmlTree.MAIN() |
265 : body; |
256 : body; |
266 htmlTree.addContent(getContentsList(deprapi)); |
257 htmlTree.addContent(getContentsList(deprapi)); |