author | bpatel |
Fri, 20 Nov 2015 20:55:07 +0000 | |
changeset 33920 | bd731341c405 |
parent 26269 | 0d8efbb110b4 |
child 34752 | 9c262a013456 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
2 |
* Copyright (c) 1997, 2014, 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 |
*/ |
25 |
package com.sun.tools.doclets.formats.html; |
|
26 |
||
14258 | 27 |
import java.io.*; |
28 |
import java.util.*; |
|
29 |
||
30 |
import com.sun.javadoc.*; |
|
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
31 |
import com.sun.tools.javac.jvm.Profile; |
10 | 32 |
import com.sun.tools.doclets.internal.toolkit.*; |
33 |
import com.sun.tools.doclets.internal.toolkit.builders.*; |
|
34 |
import com.sun.tools.doclets.internal.toolkit.util.*; |
|
35 |
||
36 |
/** |
|
37 |
* The class with "start" method, calls individual Writers. |
|
38 |
* |
|
14260
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
39 |
* <p><b>This is NOT part of any supported API. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
40 |
* 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
|
41 |
* 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
|
42 |
* deletion without notice.</b> |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
43 |
* |
10 | 44 |
* @author Atul M Dambalkar |
45 |
* @author Robert Field |
|
46 |
* @author Jamie Ho |
|
47 |
* |
|
48 |
*/ |
|
49 |
public class HtmlDoclet extends AbstractDoclet { |
|
14542 | 50 |
// An instance will be created by validOptions, and used by start. |
51 |
private static HtmlDoclet docletToStart = null; |
|
52 |
||
1475 | 53 |
public HtmlDoclet() { |
14542 | 54 |
configuration = new ConfigurationImpl(); |
1475 | 55 |
} |
10 | 56 |
|
57 |
/** |
|
58 |
* The global configuration information for this run. |
|
59 |
*/ |
|
14542 | 60 |
public final ConfigurationImpl configuration; |
10 | 61 |
|
62 |
/** |
|
63 |
* The "start" method as required by Javadoc. |
|
64 |
* |
|
65 |
* @param root the root of the documentation tree. |
|
66 |
* @see com.sun.javadoc.RootDoc |
|
67 |
* @return true if the doclet ran without encountering any errors. |
|
68 |
*/ |
|
69 |
public static boolean start(RootDoc root) { |
|
14542 | 70 |
// In typical use, options will have been set up by calling validOptions, |
71 |
// which will create an HtmlDoclet for use here. |
|
72 |
HtmlDoclet doclet; |
|
73 |
if (docletToStart != null) { |
|
74 |
doclet = docletToStart; |
|
75 |
docletToStart = null; |
|
76 |
} else { |
|
77 |
doclet = new HtmlDoclet(); |
|
1475 | 78 |
} |
26269
0d8efbb110b4
8054925: [javadoc] refactor the Doclet start method.
ksrini
parents:
25874
diff
changeset
|
79 |
return doclet.startDoclet(root); |
10 | 80 |
} |
81 |
||
82 |
/** |
|
83 |
* Create the configuration instance. |
|
84 |
* Override this method to use a different |
|
85 |
* configuration. |
|
86 |
*/ |
|
87 |
public Configuration configuration() { |
|
14542 | 88 |
return configuration; |
10 | 89 |
} |
90 |
||
91 |
/** |
|
92 |
* Start the generation of files. Call generate methods in the individual |
|
93 |
* writers, which will in turn genrate the documentation files. Call the |
|
94 |
* TreeWriter generation first to ensure the Class Hierarchy is built |
|
95 |
* first and then can be used in the later generation. |
|
96 |
* |
|
97 |
* For new format. |
|
98 |
* |
|
99 |
* @see com.sun.javadoc.RootDoc |
|
100 |
*/ |
|
101 |
protected void generateOtherFiles(RootDoc root, ClassTree classtree) |
|
102 |
throws Exception { |
|
103 |
super.generateOtherFiles(root, classtree); |
|
104 |
if (configuration.linksource) { |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14260
diff
changeset
|
105 |
SourceToHTMLConverter.convertRoot(configuration, |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14260
diff
changeset
|
106 |
root, DocPaths.SOURCE_OUTPUT); |
10 | 107 |
} |
108 |
||
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14260
diff
changeset
|
109 |
if (configuration.topFile.isEmpty()) { |
10 | 110 |
configuration.standardmessage. |
111 |
error("doclet.No_Non_Deprecated_Classes_To_Document"); |
|
112 |
return; |
|
113 |
} |
|
114 |
boolean nodeprecated = configuration.nodeprecated; |
|
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
115 |
performCopy(configuration.helpfile); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
116 |
performCopy(configuration.stylesheetfile); |
10 | 117 |
// do early to reduce memory footprint |
118 |
if (configuration.classuse) { |
|
119 |
ClassUseWriter.generate(configuration, classtree); |
|
120 |
} |
|
121 |
IndexBuilder indexbuilder = new IndexBuilder(configuration, nodeprecated); |
|
122 |
||
123 |
if (configuration.createtree) { |
|
124 |
TreeWriter.generate(configuration, classtree); |
|
125 |
} |
|
126 |
if (configuration.createindex) { |
|
33920 | 127 |
configuration.buildSearchTagIndex(); |
10 | 128 |
if (configuration.splitindex) { |
129 |
SplitIndexWriter.generate(configuration, indexbuilder); |
|
130 |
} else { |
|
131 |
SingleIndexWriter.generate(configuration, indexbuilder); |
|
132 |
} |
|
133 |
} |
|
134 |
||
135 |
if (!(configuration.nodeprecatedlist || nodeprecated)) { |
|
136 |
DeprecatedListWriter.generate(configuration); |
|
137 |
} |
|
138 |
||
139 |
AllClassesFrameWriter.generate(configuration, |
|
140 |
new IndexBuilder(configuration, nodeprecated, true)); |
|
141 |
||
142 |
FrameOutputWriter.generate(configuration); |
|
143 |
||
144 |
if (configuration.createoverview) { |
|
145 |
PackageIndexWriter.generate(configuration); |
|
146 |
} |
|
147 |
if (configuration.helpfile.length() == 0 && |
|
148 |
!configuration.nohelp) { |
|
149 |
HelpWriter.generate(configuration); |
|
150 |
} |
|
7641
8b552db25f99
7006270: Several javadoc regression tests are failing on windows
bpatel
parents:
7614
diff
changeset
|
151 |
// 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
|
152 |
// and replace newline with platform-specific newline. |
14549
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
153 |
DocFile f; |
10 | 154 |
if (configuration.stylesheetfile.length() == 0) { |
14549
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
155 |
f = DocFile.createFileForOutput(configuration, DocPaths.STYLESHEET); |
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
156 |
f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.STYLESHEET), false, true); |
10 | 157 |
} |
14549
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
158 |
f = DocFile.createFileForOutput(configuration, DocPaths.JAVASCRIPT); |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
159 |
f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.JAVASCRIPT), true, true); |
33920 | 160 |
if (configuration.createindex) { |
161 |
f = DocFile.createFileForOutput(configuration, DocPaths.SEARCH_JS); |
|
162 |
f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.SEARCH_JS), true, true); |
|
163 |
f = DocFile.createFileForOutput(configuration, DocPaths.RESOURCES.resolve(DocPaths.GLASS_IMG)); |
|
164 |
f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.GLASS_IMG), true, false); |
|
165 |
f = DocFile.createFileForOutput(configuration, DocPaths.RESOURCES.resolve(DocPaths.X_IMG)); |
|
166 |
f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.X_IMG), true, false); |
|
167 |
copyJqueryFiles(); |
|
168 |
} |
|
169 |
} |
|
170 |
||
171 |
protected void copyJqueryFiles() { |
|
172 |
List<String> files = Arrays.asList( |
|
173 |
"jquery-1.10.2.js", |
|
174 |
"jquery-ui.js", |
|
175 |
"jquery-ui.css", |
|
176 |
"jquery-ui.min.js", |
|
177 |
"jquery-ui.min.css", |
|
178 |
"jquery-ui.structure.min.css", |
|
179 |
"jquery-ui.structure.css", |
|
180 |
"external/jquery/jquery.js", |
|
181 |
"jszip/dist/jszip.js", |
|
182 |
"jszip/dist/jszip.min.js", |
|
183 |
"jszip-utils/dist/jszip-utils.js", |
|
184 |
"jszip-utils/dist/jszip-utils.min.js", |
|
185 |
"jszip-utils/dist/jszip-utils-ie.js", |
|
186 |
"jszip-utils/dist/jszip-utils-ie.min.js", |
|
187 |
"images/ui-bg_flat_0_aaaaaa_40x100.png", |
|
188 |
"images/ui-icons_454545_256x240.png", |
|
189 |
"images/ui-bg_glass_95_fef1ec_1x400.png", |
|
190 |
"images/ui-bg_glass_75_dadada_1x400.png", |
|
191 |
"images/ui-bg_highlight-soft_75_cccccc_1x100.png", |
|
192 |
"images/ui-icons_888888_256x240.png", |
|
193 |
"images/ui-icons_2e83ff_256x240.png", |
|
194 |
"images/ui-bg_glass_65_ffffff_1x400.png", |
|
195 |
"images/ui-icons_cd0a0a_256x240.png", |
|
196 |
"images/ui-bg_glass_55_fbf9ee_1x400.png", |
|
197 |
"images/ui-icons_222222_256x240.png", |
|
198 |
"images/ui-bg_glass_75_e6e6e6_1x400.png", |
|
199 |
"images/ui-bg_flat_75_ffffff_40x100.png"); |
|
200 |
DocFile f; |
|
201 |
for (String file : files) { |
|
202 |
DocPath filePath = DocPaths.JQUERY_FILES.resolve(file); |
|
203 |
f = DocFile.createFileForOutput(configuration, filePath); |
|
204 |
f.copyResource(DocPaths.RESOURCES.resolve(filePath), true, false); |
|
205 |
} |
|
10 | 206 |
} |
207 |
||
208 |
/** |
|
209 |
* {@inheritDoc} |
|
210 |
*/ |
|
211 |
protected void generateClassFiles(ClassDoc[] arr, ClassTree classtree) { |
|
212 |
Arrays.sort(arr); |
|
213 |
for(int i = 0; i < arr.length; i++) { |
|
214 |
if (!(configuration.isGeneratedDoc(arr[i]) && arr[i].isIncluded())) { |
|
215 |
continue; |
|
216 |
} |
|
217 |
ClassDoc prev = (i == 0)? |
|
218 |
null: |
|
219 |
arr[i-1]; |
|
220 |
ClassDoc curr = arr[i]; |
|
221 |
ClassDoc next = (i+1 == arr.length)? |
|
222 |
null: |
|
223 |
arr[i+1]; |
|
224 |
try { |
|
225 |
if (curr.isAnnotationType()) { |
|
226 |
AbstractBuilder annotationTypeBuilder = |
|
227 |
configuration.getBuilderFactory() |
|
228 |
.getAnnotationTypeBuilder((AnnotationTypeDoc) curr, |
|
229 |
prev, next); |
|
230 |
annotationTypeBuilder.build(); |
|
231 |
} else { |
|
232 |
AbstractBuilder classBuilder = |
|
233 |
configuration.getBuilderFactory() |
|
234 |
.getClassBuilder(curr, prev, next, classtree); |
|
235 |
classBuilder.build(); |
|
236 |
} |
|
20600
052970964bc1
6978886: javadoc shows stacktrace after print error resulting from disk full
kizune
parents:
19937
diff
changeset
|
237 |
} catch (IOException e) { |
052970964bc1
6978886: javadoc shows stacktrace after print error resulting from disk full
kizune
parents:
19937
diff
changeset
|
238 |
throw new DocletAbortException(e); |
052970964bc1
6978886: javadoc shows stacktrace after print error resulting from disk full
kizune
parents:
19937
diff
changeset
|
239 |
} catch (DocletAbortException de) { |
052970964bc1
6978886: javadoc shows stacktrace after print error resulting from disk full
kizune
parents:
19937
diff
changeset
|
240 |
throw de; |
10 | 241 |
} catch (Exception e) { |
242 |
e.printStackTrace(); |
|
19667
fdfce85627a9
8001669: javadoc internal DocletAbortException should set cause when appropriate
jjg
parents:
15723
diff
changeset
|
243 |
throw new DocletAbortException(e); |
10 | 244 |
} |
245 |
} |
|
246 |
} |
|
247 |
||
248 |
/** |
|
249 |
* {@inheritDoc} |
|
250 |
*/ |
|
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
251 |
protected void generateProfileFiles() throws Exception { |
19937
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19667
diff
changeset
|
252 |
if (configuration.showProfiles && configuration.profilePackages.size() > 0) { |
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
253 |
ProfileIndexFrameWriter.generate(configuration); |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
254 |
Profile prevProfile = null, nextProfile; |
19937
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19667
diff
changeset
|
255 |
String profileName; |
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
256 |
for (int i = 1; i < configuration.profiles.getProfileCount(); i++) { |
19937
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19667
diff
changeset
|
257 |
profileName = Profile.lookup(i).name; |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19667
diff
changeset
|
258 |
// Generate profile package pages only if there are any packages |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19667
diff
changeset
|
259 |
// in a profile to be documented. The profilePackages map will not |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19667
diff
changeset
|
260 |
// contain an entry for the profile if there are no packages to be documented. |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19667
diff
changeset
|
261 |
if (!configuration.shouldDocumentProfile(profileName)) |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19667
diff
changeset
|
262 |
continue; |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19667
diff
changeset
|
263 |
ProfilePackageIndexFrameWriter.generate(configuration, profileName); |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
264 |
List<PackageDoc> packages = configuration.profilePackages.get( |
19937
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19667
diff
changeset
|
265 |
profileName); |
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
266 |
PackageDoc prev = null, next; |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
267 |
for (int j = 0; j < packages.size(); j++) { |
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
268 |
// if -nodeprecated option is set and the package is marked as |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
269 |
// deprecated, do not generate the profilename-package-summary.html |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
270 |
// and profilename-package-frame.html pages for that package. |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
271 |
PackageDoc pkg = packages.get(j); |
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24221
diff
changeset
|
272 |
if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) { |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
273 |
ProfilePackageFrameWriter.generate(configuration, pkg, i); |
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
274 |
next = getNamedPackage(packages, j + 1); |
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
275 |
AbstractBuilder profilePackageSummaryBuilder = |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
276 |
configuration.getBuilderFactory().getProfilePackageSummaryBuilder( |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
277 |
pkg, prev, next, Profile.lookup(i)); |
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
278 |
profilePackageSummaryBuilder.build(); |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
279 |
prev = pkg; |
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
280 |
} |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
281 |
} |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
282 |
nextProfile = (i + 1 < configuration.profiles.getProfileCount()) ? |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
283 |
Profile.lookup(i + 1) : null; |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
284 |
AbstractBuilder profileSummaryBuilder = |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
285 |
configuration.getBuilderFactory().getProfileSummaryBuilder( |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
286 |
Profile.lookup(i), prevProfile, nextProfile); |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
287 |
profileSummaryBuilder.build(); |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
288 |
prevProfile = Profile.lookup(i); |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
289 |
} |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
290 |
} |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
291 |
} |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
292 |
|
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
293 |
PackageDoc getNamedPackage(List<PackageDoc> list, int idx) { |
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
294 |
if (idx < list.size()) { |
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
295 |
PackageDoc pkg = list.get(idx); |
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
296 |
if (!pkg.name().isEmpty()) { |
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
297 |
return pkg; |
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
298 |
} |
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
299 |
} |
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
300 |
return null; |
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
301 |
} |
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
302 |
|
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
303 |
/** |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
304 |
* {@inheritDoc} |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
305 |
*/ |
10 | 306 |
protected void generatePackageFiles(ClassTree classtree) throws Exception { |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
307 |
Set<PackageDoc> packages = configuration.packages; |
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
308 |
if (packages.size() > 1) { |
10 | 309 |
PackageIndexFrameWriter.generate(configuration); |
310 |
} |
|
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
311 |
List<PackageDoc> pList = new ArrayList<>(configuration.packages); |
10 | 312 |
PackageDoc prev = null, next; |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
313 |
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
|
314 |
// 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
|
315 |
// 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
|
316 |
// and package-tree.html pages for that package. |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
317 |
PackageDoc pkg = pList.get(i); |
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24221
diff
changeset
|
318 |
if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) { |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
319 |
PackageFrameWriter.generate(configuration, pkg); |
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
320 |
next = getNamedPackage(pList, i + 1); |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
321 |
//If the next package is unnamed package, skip 2 ahead if possible |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
322 |
if (next == null) |
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
323 |
next = getNamedPackage(pList, i + 2); |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
324 |
AbstractBuilder packageSummaryBuilder = |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
325 |
configuration.getBuilderFactory().getPackageSummaryBuilder( |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
326 |
pkg, prev, next); |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
327 |
packageSummaryBuilder.build(); |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
328 |
if (configuration.createtree) { |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
329 |
PackageTreeWriter.generate(configuration, |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
330 |
pkg, prev, next, |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
331 |
configuration.nodeprecated); |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
332 |
} |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
333 |
prev = pkg; |
10 | 334 |
} |
335 |
} |
|
336 |
} |
|
337 |
||
14542 | 338 |
public static final ConfigurationImpl sharedInstanceForOptions = |
339 |
new ConfigurationImpl(); |
|
340 |
||
10 | 341 |
/** |
342 |
* Check for doclet added options here. |
|
343 |
* |
|
344 |
* @return number of arguments to option. Zero return means |
|
345 |
* option not known. Negative value means error occurred. |
|
346 |
*/ |
|
347 |
public static int optionLength(String option) { |
|
348 |
// Construct temporary configuration for check |
|
14542 | 349 |
return sharedInstanceForOptions.optionLength(option); |
10 | 350 |
} |
351 |
||
352 |
/** |
|
353 |
* Check that options have the correct arguments here. |
|
354 |
* <P> |
|
355 |
* This method is not required and will default gracefully |
|
356 |
* (to true) if absent. |
|
357 |
* <P> |
|
358 |
* Printing option related error messages (using the provided |
|
359 |
* DocErrorReporter) is the responsibility of this method. |
|
360 |
* |
|
361 |
* @return true if the options are valid. |
|
362 |
*/ |
|
363 |
public static boolean validOptions(String options[][], |
|
364 |
DocErrorReporter reporter) { |
|
14542 | 365 |
docletToStart = new HtmlDoclet(); |
366 |
return docletToStart.configuration.validOptions(options, reporter); |
|
10 | 367 |
} |
368 |
||
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
369 |
private void performCopy(String filename) { |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
370 |
if (filename.isEmpty()) |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
371 |
return; |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
372 |
|
10 | 373 |
try { |
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
374 |
DocFile fromfile = DocFile.createFileForInput(configuration, filename); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
375 |
DocPath path = DocPath.create(fromfile.getName()); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
376 |
DocFile toFile = DocFile.createFileForOutput(configuration, path); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
377 |
if (toFile.isSameFile(fromfile)) |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
378 |
return; |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
379 |
|
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
380 |
configuration.message.notice((SourcePosition) null, |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
381 |
"doclet.Copying_File_0_To_File_1", |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
382 |
fromfile.toString(), path.getPath()); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
383 |
toFile.copyFile(fromfile); |
10 | 384 |
} catch (IOException exc) { |
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
385 |
configuration.message.error((SourcePosition) null, |
10 | 386 |
"doclet.perform_copy_exception_encountered", |
387 |
exc.toString()); |
|
19667
fdfce85627a9
8001669: javadoc internal DocletAbortException should set cause when appropriate
jjg
parents:
15723
diff
changeset
|
388 |
throw new DocletAbortException(exc); |
10 | 389 |
} |
390 |
} |
|
391 |
} |