30 |
30 |
31 import javax.lang.model.element.ModuleElement; |
31 import javax.lang.model.element.ModuleElement; |
32 import javax.lang.model.element.PackageElement; |
32 import javax.lang.model.element.PackageElement; |
33 import javax.lang.model.element.TypeElement; |
33 import javax.lang.model.element.TypeElement; |
34 |
34 |
35 import com.sun.javadoc.PackageDoc; |
|
36 import jdk.javadoc.doclet.Doclet.Option; |
35 import jdk.javadoc.doclet.Doclet.Option; |
37 import jdk.javadoc.doclet.DocletEnvironment; |
36 import jdk.javadoc.doclet.DocletEnvironment; |
38 import jdk.javadoc.doclet.Reporter; |
37 import jdk.javadoc.doclet.Reporter; |
39 import jdk.javadoc.internal.doclets.toolkit.AbstractDoclet; |
38 import jdk.javadoc.internal.doclets.toolkit.AbstractDoclet; |
40 import jdk.javadoc.internal.doclets.toolkit.Configuration; |
39 import jdk.javadoc.internal.doclets.toolkit.Configuration; |
75 |
79 |
76 |
80 |
77 private static final DocPath DOCLET_RESOURCES = DocPath |
81 private static final DocPath DOCLET_RESOURCES = DocPath |
78 .create("/jdk/javadoc/internal/doclets/formats/html/resources"); |
82 .create("/jdk/javadoc/internal/doclets/formats/html/resources"); |
79 |
83 |
|
84 @Override // defined by Doclet |
80 public void init(Locale locale, Reporter reporter) { |
85 public void init(Locale locale, Reporter reporter) { |
81 configuration.reporter = reporter; |
86 configuration.reporter = reporter; |
82 configuration.locale = locale; |
87 configuration.locale = locale; |
83 messages = configuration.getMessages(); |
88 messages = configuration.getMessages(); |
84 } |
89 } |
85 |
90 |
86 /** |
91 /** |
87 * The "start" method as required by Javadoc. |
|
88 * |
|
89 * @param docEnv the root of the documentation tree. |
|
90 * @see jdk.doclet.DocletEnvironment |
|
91 * @return true if the doclet ran without encountering any errors. |
|
92 */ |
|
93 public boolean run(DocletEnvironment docEnv) { |
|
94 return startDoclet(docEnv); |
|
95 } |
|
96 |
|
97 /** |
|
98 * Create the configuration instance. |
92 * Create the configuration instance. |
99 * Override this method to use a different |
93 * Override this method to use a different |
100 * configuration. |
94 * configuration. |
101 */ |
95 */ |
|
96 @Override // defined by AbstractDoclet |
102 public Configuration configuration() { |
97 public Configuration configuration() { |
103 return configuration; |
98 return configuration; |
104 } |
99 } |
105 |
100 |
106 /** |
101 /** |
111 * |
106 * |
112 * For new format. |
107 * For new format. |
113 * |
108 * |
114 * @see jdk.doclet.RootDoc |
109 * @see jdk.doclet.RootDoc |
115 */ |
110 */ |
|
111 @Override // defined by AbstractDoclet |
116 protected void generateOtherFiles(DocletEnvironment docEnv, ClassTree classtree) |
112 protected void generateOtherFiles(DocletEnvironment docEnv, ClassTree classtree) |
117 throws Exception { |
113 throws Exception { |
118 super.generateOtherFiles(docEnv, classtree); |
114 super.generateOtherFiles(docEnv, classtree); |
119 if (configuration.linksource) { |
115 if (configuration.linksource) { |
120 SourceToHTMLConverter.convertRoot(configuration, |
116 SourceToHTMLConverter.convertRoot(configuration, |
226 } |
222 } |
227 |
223 |
228 /** |
224 /** |
229 * {@inheritDoc} |
225 * {@inheritDoc} |
230 */ |
226 */ |
|
227 @Override // defined by AbstractDoclet |
231 protected void generateClassFiles(SortedSet<TypeElement> arr, ClassTree classtree) { |
228 protected void generateClassFiles(SortedSet<TypeElement> arr, ClassTree classtree) { |
232 List<TypeElement> list = new ArrayList<>(arr); |
229 List<TypeElement> list = new ArrayList<>(arr); |
233 ListIterator<TypeElement> iterator = list.listIterator(); |
230 ListIterator<TypeElement> iterator = list.listIterator(); |
234 TypeElement klass = null; |
231 TypeElement klass = null; |
235 while (iterator.hasNext()) { |
232 while (iterator.hasNext()) { |
268 } |
265 } |
269 |
266 |
270 /** |
267 /** |
271 * {@inheritDoc} |
268 * {@inheritDoc} |
272 */ |
269 */ |
|
270 @Override // defined by AbstractDoclet |
273 protected void generateModuleFiles() throws Exception { |
271 protected void generateModuleFiles() throws Exception { |
274 if (configuration.showModules) { |
272 if (configuration.showModules) { |
275 ModuleIndexFrameWriter.generate(configuration); |
273 ModuleIndexFrameWriter.generate(configuration); |
276 ModuleElement prevModule = null, nextModule; |
274 ModuleElement prevModule = null, nextModule; |
277 List<ModuleElement> mdles = new ArrayList<>(configuration.modulePackages.keySet()); |
275 List<ModuleElement> mdles = new ArrayList<>(configuration.modulePackages.keySet()); |
301 } |
299 } |
302 |
300 |
303 /** |
301 /** |
304 * {@inheritDoc} |
302 * {@inheritDoc} |
305 */ |
303 */ |
|
304 @Override // defined by AbstractDoclet |
306 protected void generatePackageFiles(ClassTree classtree) throws Exception { |
305 protected void generatePackageFiles(ClassTree classtree) throws Exception { |
307 Set<PackageElement> packages = configuration.packages; |
306 Set<PackageElement> packages = configuration.packages; |
308 if (packages.size() > 1) { |
307 if (packages.size() > 1) { |
309 PackageIndexFrameWriter.generate(configuration); |
308 PackageIndexFrameWriter.generate(configuration); |
310 } |
309 } |