author | ksrini |
Tue, 12 Dec 2017 14:16:24 -0800 | |
changeset 48254 | 111104f1e033 |
parent 47748 | dfc709c80775 |
child 48756 | ce608a09a666 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
44388 | 2 |
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. |
10 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5520 | 7 |
* published by the Free Software Foundation. Oracle designates this |
10 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
10 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5520 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
10 | 24 |
*/ |
34752
9c262a013456
8145342: Some copyright notices are inconsistently and ill formatted
vasya
parents:
33920
diff
changeset
|
25 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
26 |
package jdk.javadoc.internal.doclets.formats.html; |
10 | 27 |
|
14258 | 28 |
import java.util.*; |
29 |
||
36526 | 30 |
import javax.lang.model.element.ModuleElement; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
31 |
import javax.lang.model.element.PackageElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
32 |
import javax.lang.model.element.TypeElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
33 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
34 |
import jdk.javadoc.doclet.DocletEnvironment; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
35 |
import jdk.javadoc.doclet.Reporter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
36 |
import jdk.javadoc.internal.doclets.toolkit.AbstractDoclet; |
40587 | 37 |
import jdk.javadoc.internal.doclets.toolkit.DocletException; |
40303 | 38 |
import jdk.javadoc.internal.doclets.toolkit.Messages; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
39 |
import jdk.javadoc.internal.doclets.toolkit.builders.AbstractBuilder; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
40 |
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
41 |
import jdk.javadoc.internal.doclets.toolkit.util.DocFile; |
40587 | 42 |
import jdk.javadoc.internal.doclets.toolkit.util.DocFileIOException; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
43 |
import jdk.javadoc.internal.doclets.toolkit.util.DocPath; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
44 |
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
45 |
import jdk.javadoc.internal.doclets.toolkit.util.IndexBuilder; |
10 | 46 |
|
47 |
/** |
|
48 |
* The class with "start" method, calls individual Writers. |
|
49 |
* |
|
14260
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
50 |
* <p><b>This is NOT part of any supported API. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
51 |
* If you write code that depends on this, you do so at your own risk. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
52 |
* This code and its internal interfaces are subject to change or |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
53 |
* deletion without notice.</b> |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
54 |
* |
10 | 55 |
* @author Atul M Dambalkar |
56 |
* @author Robert Field |
|
57 |
* @author Jamie Ho |
|
58 |
* |
|
59 |
*/ |
|
60 |
public class HtmlDoclet extends AbstractDoclet { |
|
14542 | 61 |
|
1475 | 62 |
public HtmlDoclet() { |
45417 | 63 |
configuration = new HtmlConfiguration(this); |
1475 | 64 |
} |
10 | 65 |
|
40315
9e994c77db6a
8160137: HTMLDoclet and AbstractDoclet should implement Doclet
jjg
parents:
40303
diff
changeset
|
66 |
@Override // defined by Doclet |
9e994c77db6a
8160137: HTMLDoclet and AbstractDoclet should implement Doclet
jjg
parents:
40303
diff
changeset
|
67 |
public String getName() { |
9e994c77db6a
8160137: HTMLDoclet and AbstractDoclet should implement Doclet
jjg
parents:
40303
diff
changeset
|
68 |
return "Html"; |
9e994c77db6a
8160137: HTMLDoclet and AbstractDoclet should implement Doclet
jjg
parents:
40303
diff
changeset
|
69 |
} |
9e994c77db6a
8160137: HTMLDoclet and AbstractDoclet should implement Doclet
jjg
parents:
40303
diff
changeset
|
70 |
|
10 | 71 |
/** |
72 |
* The global configuration information for this run. |
|
73 |
*/ |
|
45417 | 74 |
private final HtmlConfiguration configuration; |
40303 | 75 |
|
76 |
private Messages messages; |
|
10 | 77 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
78 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
79 |
private static final DocPath DOCLET_RESOURCES = DocPath |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
80 |
.create("/jdk/javadoc/internal/doclets/formats/html/resources"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
81 |
|
40315
9e994c77db6a
8160137: HTMLDoclet and AbstractDoclet should implement Doclet
jjg
parents:
40303
diff
changeset
|
82 |
@Override // defined by Doclet |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
83 |
public void init(Locale locale, Reporter reporter) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
84 |
configuration.reporter = reporter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
85 |
configuration.locale = locale; |
40303 | 86 |
messages = configuration.getMessages(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
87 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
88 |
|
10 | 89 |
/** |
90 |
* Create the configuration instance. |
|
91 |
* Override this method to use a different |
|
92 |
* configuration. |
|
42277 | 93 |
* |
94 |
* @return the configuration |
|
10 | 95 |
*/ |
40315
9e994c77db6a
8160137: HTMLDoclet and AbstractDoclet should implement Doclet
jjg
parents:
40303
diff
changeset
|
96 |
@Override // defined by AbstractDoclet |
45417 | 97 |
public HtmlConfiguration getConfiguration() { |
14542 | 98 |
return configuration; |
10 | 99 |
} |
100 |
||
101 |
/** |
|
102 |
* Start the generation of files. Call generate methods in the individual |
|
40587 | 103 |
* writers, which will in turn generate the documentation files. Call the |
10 | 104 |
* TreeWriter generation first to ensure the Class Hierarchy is built |
105 |
* first and then can be used in the later generation. |
|
106 |
* |
|
107 |
* For new format. |
|
108 |
* |
|
40587 | 109 |
* @throws DocletException if there is a problem while writing the other files |
40500
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40315
diff
changeset
|
110 |
* @see jdk.doclet.DocletEnvironment |
10 | 111 |
*/ |
40315
9e994c77db6a
8160137: HTMLDoclet and AbstractDoclet should implement Doclet
jjg
parents:
40303
diff
changeset
|
112 |
@Override // defined by AbstractDoclet |
39364
bd6d4a7936b4
8160301: javadoc RootDoclmpl and DocEnv needs to be renamed
ksrini
parents:
37009
diff
changeset
|
113 |
protected void generateOtherFiles(DocletEnvironment docEnv, ClassTree classtree) |
40587 | 114 |
throws DocletException { |
39364
bd6d4a7936b4
8160301: javadoc RootDoclmpl and DocEnv needs to be renamed
ksrini
parents:
37009
diff
changeset
|
115 |
super.generateOtherFiles(docEnv, classtree); |
10 | 116 |
if (configuration.linksource) { |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14260
diff
changeset
|
117 |
SourceToHTMLConverter.convertRoot(configuration, |
39364
bd6d4a7936b4
8160301: javadoc RootDoclmpl and DocEnv needs to be renamed
ksrini
parents:
37009
diff
changeset
|
118 |
docEnv, DocPaths.SOURCE_OUTPUT); |
10 | 119 |
} |
48254 | 120 |
// Modules with no documented classes may be specified on the |
121 |
// command line to specify a service provider, allow these. |
|
122 |
if (configuration.getSpecifiedModuleElements().isEmpty() && |
|
123 |
configuration.topFile.isEmpty()) { |
|
40303 | 124 |
messages.error("doclet.No_Non_Deprecated_Classes_To_Document"); |
10 | 125 |
return; |
126 |
} |
|
127 |
boolean nodeprecated = configuration.nodeprecated; |
|
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
128 |
performCopy(configuration.helpfile); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
129 |
performCopy(configuration.stylesheetfile); |
47748
dfc709c80775
8185371: Support for multiple stylesheets in javadoc
bpatel
parents:
47216
diff
changeset
|
130 |
for (String stylesheet : configuration.additionalStylesheets) { |
dfc709c80775
8185371: Support for multiple stylesheets in javadoc
bpatel
parents:
47216
diff
changeset
|
131 |
performCopy(stylesheet); |
dfc709c80775
8185371: Support for multiple stylesheets in javadoc
bpatel
parents:
47216
diff
changeset
|
132 |
} |
10 | 133 |
// do early to reduce memory footprint |
134 |
if (configuration.classuse) { |
|
135 |
ClassUseWriter.generate(configuration, classtree); |
|
136 |
} |
|
137 |
IndexBuilder indexbuilder = new IndexBuilder(configuration, nodeprecated); |
|
138 |
||
139 |
if (configuration.createtree) { |
|
140 |
TreeWriter.generate(configuration, classtree); |
|
141 |
} |
|
142 |
if (configuration.createindex) { |
|
33920 | 143 |
configuration.buildSearchTagIndex(); |
10 | 144 |
if (configuration.splitindex) { |
145 |
SplitIndexWriter.generate(configuration, indexbuilder); |
|
146 |
} else { |
|
147 |
SingleIndexWriter.generate(configuration, indexbuilder); |
|
148 |
} |
|
149 |
} |
|
150 |
||
151 |
if (!(configuration.nodeprecatedlist || nodeprecated)) { |
|
152 |
DeprecatedListWriter.generate(configuration); |
|
153 |
} |
|
154 |
||
155 |
AllClassesFrameWriter.generate(configuration, |
|
156 |
new IndexBuilder(configuration, nodeprecated, true)); |
|
157 |
||
40500
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40315
diff
changeset
|
158 |
if (configuration.frames) { |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40315
diff
changeset
|
159 |
FrameOutputWriter.generate(configuration); |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40315
diff
changeset
|
160 |
} |
10 | 161 |
|
162 |
if (configuration.createoverview) { |
|
39586
e35b6ab55e00
8157987: overview-summary.html generated by javadoc should include module information
bpatel
parents:
39364
diff
changeset
|
163 |
if (configuration.showModules) { |
e35b6ab55e00
8157987: overview-summary.html generated by javadoc should include module information
bpatel
parents:
39364
diff
changeset
|
164 |
ModuleIndexWriter.generate(configuration); |
e35b6ab55e00
8157987: overview-summary.html generated by javadoc should include module information
bpatel
parents:
39364
diff
changeset
|
165 |
} else { |
e35b6ab55e00
8157987: overview-summary.html generated by javadoc should include module information
bpatel
parents:
39364
diff
changeset
|
166 |
PackageIndexWriter.generate(configuration); |
e35b6ab55e00
8157987: overview-summary.html generated by javadoc should include module information
bpatel
parents:
39364
diff
changeset
|
167 |
} |
10 | 168 |
} |
40500
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40315
diff
changeset
|
169 |
|
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40315
diff
changeset
|
170 |
if (!configuration.frames && !configuration.createoverview) { |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40315
diff
changeset
|
171 |
IndexRedirectWriter.generate(configuration); |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40315
diff
changeset
|
172 |
} |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40315
diff
changeset
|
173 |
|
42277 | 174 |
if (configuration.helpfile.isEmpty() && !configuration.nohelp) { |
10 | 175 |
HelpWriter.generate(configuration); |
176 |
} |
|
7641
8b552db25f99
7006270: Several javadoc regression tests are failing on windows
bpatel
parents:
7614
diff
changeset
|
177 |
// If a stylesheet file is not specified, copy the default stylesheet |
8b552db25f99
7006270: Several javadoc regression tests are failing on windows
bpatel
parents:
7614
diff
changeset
|
178 |
// and replace newline with platform-specific newline. |
14549
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
179 |
DocFile f; |
10 | 180 |
if (configuration.stylesheetfile.length() == 0) { |
14549
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
181 |
f = DocFile.createFileForOutput(configuration, DocPaths.STYLESHEET); |
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
182 |
f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.STYLESHEET), false, true); |
10 | 183 |
} |
14549
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
184 |
f = DocFile.createFileForOutput(configuration, DocPaths.JAVASCRIPT); |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
185 |
f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.JAVASCRIPT), true, true); |
33920 | 186 |
if (configuration.createindex) { |
187 |
f = DocFile.createFileForOutput(configuration, DocPaths.SEARCH_JS); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
188 |
f.copyResource(DOCLET_RESOURCES.resolve(DocPaths.SEARCH_JS), true, true); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
189 |
|
33920 | 190 |
f = DocFile.createFileForOutput(configuration, DocPaths.RESOURCES.resolve(DocPaths.GLASS_IMG)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
191 |
f.copyResource(DOCLET_RESOURCES.resolve(DocPaths.GLASS_IMG), true, false); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
192 |
|
33920 | 193 |
f = DocFile.createFileForOutput(configuration, DocPaths.RESOURCES.resolve(DocPaths.X_IMG)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
194 |
f.copyResource(DOCLET_RESOURCES.resolve(DocPaths.X_IMG), true, false); |
33920 | 195 |
copyJqueryFiles(); |
196 |
} |
|
197 |
} |
|
198 |
||
40587 | 199 |
protected void copyJqueryFiles() throws DocletException { |
33920 | 200 |
List<String> files = Arrays.asList( |
201 |
"jquery-1.10.2.js", |
|
202 |
"jquery-ui.js", |
|
203 |
"jquery-ui.css", |
|
204 |
"jquery-ui.min.js", |
|
205 |
"jquery-ui.min.css", |
|
206 |
"jquery-ui.structure.min.css", |
|
207 |
"jquery-ui.structure.css", |
|
208 |
"external/jquery/jquery.js", |
|
209 |
"jszip/dist/jszip.js", |
|
210 |
"jszip/dist/jszip.min.js", |
|
211 |
"jszip-utils/dist/jszip-utils.js", |
|
212 |
"jszip-utils/dist/jszip-utils.min.js", |
|
213 |
"jszip-utils/dist/jszip-utils-ie.js", |
|
214 |
"jszip-utils/dist/jszip-utils-ie.min.js", |
|
215 |
"images/ui-bg_flat_0_aaaaaa_40x100.png", |
|
216 |
"images/ui-icons_454545_256x240.png", |
|
217 |
"images/ui-bg_glass_95_fef1ec_1x400.png", |
|
218 |
"images/ui-bg_glass_75_dadada_1x400.png", |
|
219 |
"images/ui-bg_highlight-soft_75_cccccc_1x100.png", |
|
220 |
"images/ui-icons_888888_256x240.png", |
|
221 |
"images/ui-icons_2e83ff_256x240.png", |
|
222 |
"images/ui-bg_glass_65_ffffff_1x400.png", |
|
223 |
"images/ui-icons_cd0a0a_256x240.png", |
|
224 |
"images/ui-bg_glass_55_fbf9ee_1x400.png", |
|
225 |
"images/ui-icons_222222_256x240.png", |
|
226 |
"images/ui-bg_glass_75_e6e6e6_1x400.png", |
|
227 |
"images/ui-bg_flat_75_ffffff_40x100.png"); |
|
228 |
DocFile f; |
|
229 |
for (String file : files) { |
|
230 |
DocPath filePath = DocPaths.JQUERY_FILES.resolve(file); |
|
231 |
f = DocFile.createFileForOutput(configuration, filePath); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
232 |
f.copyResource(DOCLET_RESOURCES.resolve(filePath), true, false); |
33920 | 233 |
} |
10 | 234 |
} |
235 |
||
236 |
/** |
|
237 |
* {@inheritDoc} |
|
238 |
*/ |
|
40315
9e994c77db6a
8160137: HTMLDoclet and AbstractDoclet should implement Doclet
jjg
parents:
40303
diff
changeset
|
239 |
@Override // defined by AbstractDoclet |
40587 | 240 |
protected void generateClassFiles(SortedSet<TypeElement> arr, ClassTree classtree) |
241 |
throws DocletException { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
242 |
List<TypeElement> list = new ArrayList<>(arr); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
243 |
ListIterator<TypeElement> iterator = list.listIterator(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
244 |
TypeElement klass = null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
245 |
while (iterator.hasNext()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
246 |
TypeElement prev = iterator.hasPrevious() ? klass : null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
247 |
klass = iterator.next(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
248 |
TypeElement next = iterator.nextIndex() == list.size() |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
249 |
? null : list.get(iterator.nextIndex()); |
40587 | 250 |
|
37009
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
251 |
if (utils.isHidden(klass) || |
476d8d615222
8073100: [javadoc] Provide an ability to suppress document generation for specific elements.
ksrini
parents:
36526
diff
changeset
|
252 |
!(configuration.isGeneratedDoc(klass) && utils.isIncluded(klass))) { |
10 | 253 |
continue; |
254 |
} |
|
40587 | 255 |
|
256 |
if (utils.isAnnotationType(klass)) { |
|
257 |
AbstractBuilder annotationTypeBuilder = |
|
258 |
configuration.getBuilderFactory() |
|
259 |
.getAnnotationTypeBuilder(klass, |
|
260 |
prev == null ? null : prev.asType(), |
|
261 |
next == null ? null : next.asType()); |
|
262 |
annotationTypeBuilder.build(); |
|
263 |
} else { |
|
264 |
AbstractBuilder classBuilder = |
|
265 |
configuration.getBuilderFactory().getClassBuilder(klass, |
|
266 |
prev, next, classtree); |
|
267 |
classBuilder.build(); |
|
10 | 268 |
} |
269 |
} |
|
270 |
} |
|
271 |
||
36526 | 272 |
/** |
273 |
* {@inheritDoc} |
|
274 |
*/ |
|
40315
9e994c77db6a
8160137: HTMLDoclet and AbstractDoclet should implement Doclet
jjg
parents:
40303
diff
changeset
|
275 |
@Override // defined by AbstractDoclet |
40587 | 276 |
protected void generateModuleFiles() throws DocletException { |
36526 | 277 |
if (configuration.showModules) { |
44879
49beafe2faf3
8166306: Broken link for All Packages in java.jnlp module
bpatel
parents:
44388
diff
changeset
|
278 |
if (configuration.frames && configuration.modules.size() > 1) { |
40500
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40315
diff
changeset
|
279 |
ModuleIndexFrameWriter.generate(configuration); |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40315
diff
changeset
|
280 |
} |
36526 | 281 |
ModuleElement prevModule = null, nextModule; |
282 |
List<ModuleElement> mdles = new ArrayList<>(configuration.modulePackages.keySet()); |
|
283 |
int i = 0; |
|
284 |
for (ModuleElement mdle : mdles) { |
|
44879
49beafe2faf3
8166306: Broken link for All Packages in java.jnlp module
bpatel
parents:
44388
diff
changeset
|
285 |
if (configuration.frames && configuration.modules.size() > 1) { |
40500
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40315
diff
changeset
|
286 |
ModulePackageIndexFrameWriter.generate(configuration, mdle); |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40315
diff
changeset
|
287 |
ModuleFrameWriter.generate(configuration, mdle); |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40315
diff
changeset
|
288 |
} |
36526 | 289 |
nextModule = (i + 1 < mdles.size()) ? mdles.get(i + 1) : null; |
290 |
AbstractBuilder moduleSummaryBuilder = |
|
291 |
configuration.getBuilderFactory().getModuleSummaryBuilder( |
|
292 |
mdle, prevModule, nextModule); |
|
293 |
moduleSummaryBuilder.build(); |
|
294 |
prevModule = mdle; |
|
295 |
i++; |
|
296 |
} |
|
297 |
} |
|
298 |
} |
|
299 |
||
300 |
PackageElement getNamedPackage(List<PackageElement> list, int idx) { |
|
301 |
if (idx < list.size()) { |
|
302 |
PackageElement pkg = list.get(idx); |
|
303 |
if (pkg != null && !pkg.isUnnamed()) { |
|
304 |
return pkg; |
|
305 |
} |
|
306 |
} |
|
307 |
return null; |
|
308 |
} |
|
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
309 |
|
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
310 |
/** |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
311 |
* {@inheritDoc} |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
312 |
*/ |
40315
9e994c77db6a
8160137: HTMLDoclet and AbstractDoclet should implement Doclet
jjg
parents:
40303
diff
changeset
|
313 |
@Override // defined by AbstractDoclet |
40587 | 314 |
protected void generatePackageFiles(ClassTree classtree) throws DocletException { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
315 |
Set<PackageElement> packages = configuration.packages; |
40500
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40315
diff
changeset
|
316 |
if (packages.size() > 1 && configuration.frames) { |
10 | 317 |
PackageIndexFrameWriter.generate(configuration); |
318 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
319 |
List<PackageElement> pList = new ArrayList<>(packages); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
320 |
PackageElement prev = null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
321 |
for (int i = 0 ; i < pList.size() ; i++) { |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
322 |
// if -nodeprecated option is set and the package is marked as |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
323 |
// deprecated, do not generate the package-summary.html, package-frame.html |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
324 |
// and package-tree.html pages for that package. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
325 |
PackageElement pkg = pList.get(i); |
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24221
diff
changeset
|
326 |
if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) { |
40500
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40315
diff
changeset
|
327 |
if (configuration.frames) { |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40315
diff
changeset
|
328 |
PackageFrameWriter.generate(configuration, pkg); |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40315
diff
changeset
|
329 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
330 |
int nexti = i + 1; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
331 |
PackageElement next = null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
332 |
if (nexti < pList.size()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
333 |
next = pList.get(nexti); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
334 |
// If the next package is unnamed package, skip 2 ahead if possible |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
335 |
if (next.isUnnamed() && ++nexti < pList.size()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
336 |
next = pList.get(nexti); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
337 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
338 |
} |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
339 |
AbstractBuilder packageSummaryBuilder = |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
340 |
configuration.getBuilderFactory().getPackageSummaryBuilder( |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
341 |
pkg, prev, next); |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
342 |
packageSummaryBuilder.build(); |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
343 |
if (configuration.createtree) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
344 |
PackageTreeWriter.generate(configuration, pkg, prev, next, |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
345 |
configuration.nodeprecated); |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
346 |
} |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
347 |
prev = pkg; |
10 | 348 |
} |
349 |
} |
|
350 |
} |
|
351 |
||
40315
9e994c77db6a
8160137: HTMLDoclet and AbstractDoclet should implement Doclet
jjg
parents:
40303
diff
changeset
|
352 |
@Override // defined by Doclet |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
353 |
public Set<Option> getSupportedOptions() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
354 |
return configuration.getSupportedOptions(); |
10 | 355 |
} |
356 |
||
40587 | 357 |
private void performCopy(String filename) throws DocFileIOException { |
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
358 |
if (filename.isEmpty()) |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
359 |
return; |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
360 |
|
40587 | 361 |
DocFile fromfile = DocFile.createFileForInput(configuration, filename); |
362 |
DocPath path = DocPath.create(fromfile.getName()); |
|
363 |
DocFile toFile = DocFile.createFileForOutput(configuration, path); |
|
364 |
if (toFile.isSameFile(fromfile)) |
|
365 |
return; |
|
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
366 |
|
40587 | 367 |
messages.notice("doclet.Copying_File_0_To_File_1", |
368 |
fromfile.toString(), path.getPath()); |
|
369 |
toFile.copyFile(fromfile); |
|
10 | 370 |
} |
371 |
} |