author | alanb |
Thu, 17 Mar 2016 19:04:28 +0000 | |
changeset 36526 | 3b41f1c69604 |
parent 35426 | 374342e56a56 |
child 37009 | 476d8d615222 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
2 |
* Copyright (c) 1997, 2016, 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.io.*; |
29 |
import java.util.*; |
|
30 |
||
36526 | 31 |
import javax.lang.model.element.ModuleElement; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
32 |
import javax.lang.model.element.PackageElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
33 |
import javax.lang.model.element.TypeElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
34 |
|
36526 | 35 |
import com.sun.javadoc.PackageDoc; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
36 |
import jdk.javadoc.doclet.Doclet.Option; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
37 |
import jdk.javadoc.doclet.DocletEnvironment; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
38 |
import jdk.javadoc.doclet.Reporter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
39 |
import jdk.javadoc.internal.doclets.toolkit.AbstractDoclet; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
40 |
import jdk.javadoc.internal.doclets.toolkit.Configuration; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
41 |
import jdk.javadoc.internal.doclets.toolkit.builders.AbstractBuilder; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
42 |
import jdk.javadoc.internal.doclets.toolkit.util.ClassTree; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
43 |
import jdk.javadoc.internal.doclets.toolkit.util.DocFile; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
44 |
import jdk.javadoc.internal.doclets.toolkit.util.DocPath; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
45 |
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
46 |
import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
47 |
import jdk.javadoc.internal.doclets.toolkit.util.IndexBuilder; |
10 | 48 |
|
49 |
/** |
|
50 |
* The class with "start" method, calls individual Writers. |
|
51 |
* |
|
14260
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
52 |
* <p><b>This is NOT part of any supported API. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
53 |
* 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
|
54 |
* 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
|
55 |
* deletion without notice.</b> |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
56 |
* |
10 | 57 |
* @author Atul M Dambalkar |
58 |
* @author Robert Field |
|
59 |
* @author Jamie Ho |
|
60 |
* |
|
61 |
*/ |
|
62 |
public class HtmlDoclet extends AbstractDoclet { |
|
14542 | 63 |
|
1475 | 64 |
public HtmlDoclet() { |
14542 | 65 |
configuration = new ConfigurationImpl(); |
1475 | 66 |
} |
10 | 67 |
|
68 |
/** |
|
69 |
* The global configuration information for this run. |
|
70 |
*/ |
|
14542 | 71 |
public final ConfigurationImpl configuration; |
10 | 72 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
73 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
74 |
private static final DocPath DOCLET_RESOURCES = DocPath |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
75 |
.create("/jdk/javadoc/internal/doclets/formats/html/resources"); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
76 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
77 |
public void init(Locale locale, Reporter reporter) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
78 |
configuration.reporter = reporter; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
79 |
configuration.locale = locale; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
80 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
81 |
|
10 | 82 |
/** |
83 |
* The "start" method as required by Javadoc. |
|
84 |
* |
|
85 |
* @param root the root of the documentation tree. |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
86 |
* @see jdk.doclet.DocletEnvironment |
10 | 87 |
* @return true if the doclet ran without encountering any errors. |
88 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
89 |
public boolean run(DocletEnvironment root) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
90 |
return startDoclet(root); |
10 | 91 |
} |
92 |
||
93 |
/** |
|
94 |
* Create the configuration instance. |
|
95 |
* Override this method to use a different |
|
96 |
* configuration. |
|
97 |
*/ |
|
98 |
public Configuration configuration() { |
|
14542 | 99 |
return configuration; |
10 | 100 |
} |
101 |
||
102 |
/** |
|
103 |
* Start the generation of files. Call generate methods in the individual |
|
104 |
* writers, which will in turn genrate the documentation files. Call the |
|
105 |
* TreeWriter generation first to ensure the Class Hierarchy is built |
|
106 |
* first and then can be used in the later generation. |
|
107 |
* |
|
108 |
* For new format. |
|
109 |
* |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
110 |
* @see jdk.doclet.RootDoc |
10 | 111 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
112 |
protected void generateOtherFiles(DocletEnvironment root, ClassTree classtree) |
10 | 113 |
throws Exception { |
114 |
super.generateOtherFiles(root, classtree); |
|
115 |
if (configuration.linksource) { |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14260
diff
changeset
|
116 |
SourceToHTMLConverter.convertRoot(configuration, |
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14260
diff
changeset
|
117 |
root, DocPaths.SOURCE_OUTPUT); |
10 | 118 |
} |
119 |
||
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14260
diff
changeset
|
120 |
if (configuration.topFile.isEmpty()) { |
10 | 121 |
configuration.standardmessage. |
122 |
error("doclet.No_Non_Deprecated_Classes_To_Document"); |
|
123 |
return; |
|
124 |
} |
|
125 |
boolean nodeprecated = configuration.nodeprecated; |
|
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
126 |
performCopy(configuration.helpfile); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
127 |
performCopy(configuration.stylesheetfile); |
10 | 128 |
// do early to reduce memory footprint |
129 |
if (configuration.classuse) { |
|
130 |
ClassUseWriter.generate(configuration, classtree); |
|
131 |
} |
|
132 |
IndexBuilder indexbuilder = new IndexBuilder(configuration, nodeprecated); |
|
133 |
||
134 |
if (configuration.createtree) { |
|
135 |
TreeWriter.generate(configuration, classtree); |
|
136 |
} |
|
137 |
if (configuration.createindex) { |
|
33920 | 138 |
configuration.buildSearchTagIndex(); |
10 | 139 |
if (configuration.splitindex) { |
140 |
SplitIndexWriter.generate(configuration, indexbuilder); |
|
141 |
} else { |
|
142 |
SingleIndexWriter.generate(configuration, indexbuilder); |
|
143 |
} |
|
144 |
} |
|
145 |
||
146 |
if (!(configuration.nodeprecatedlist || nodeprecated)) { |
|
147 |
DeprecatedListWriter.generate(configuration); |
|
148 |
} |
|
149 |
||
150 |
AllClassesFrameWriter.generate(configuration, |
|
151 |
new IndexBuilder(configuration, nodeprecated, true)); |
|
152 |
||
153 |
FrameOutputWriter.generate(configuration); |
|
154 |
||
155 |
if (configuration.createoverview) { |
|
156 |
PackageIndexWriter.generate(configuration); |
|
157 |
} |
|
158 |
if (configuration.helpfile.length() == 0 && |
|
159 |
!configuration.nohelp) { |
|
160 |
HelpWriter.generate(configuration); |
|
161 |
} |
|
7641
8b552db25f99
7006270: Several javadoc regression tests are failing on windows
bpatel
parents:
7614
diff
changeset
|
162 |
// 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
|
163 |
// and replace newline with platform-specific newline. |
14549
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
164 |
DocFile f; |
10 | 165 |
if (configuration.stylesheetfile.length() == 0) { |
14549
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
166 |
f = DocFile.createFileForOutput(configuration, DocPaths.STYLESHEET); |
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
167 |
f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.STYLESHEET), false, true); |
10 | 168 |
} |
14549
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
169 |
f = DocFile.createFileForOutput(configuration, DocPaths.JAVASCRIPT); |
0599d73bf1da
8002304: Group methods by types in methods summary section
bpatel
parents:
14542
diff
changeset
|
170 |
f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.JAVASCRIPT), true, true); |
33920 | 171 |
if (configuration.createindex) { |
172 |
f = DocFile.createFileForOutput(configuration, DocPaths.SEARCH_JS); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
173 |
f.copyResource(DOCLET_RESOURCES.resolve(DocPaths.SEARCH_JS), true, true); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
174 |
|
33920 | 175 |
f = DocFile.createFileForOutput(configuration, DocPaths.RESOURCES.resolve(DocPaths.GLASS_IMG)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
176 |
f.copyResource(DOCLET_RESOURCES.resolve(DocPaths.GLASS_IMG), true, false); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
177 |
|
33920 | 178 |
f = DocFile.createFileForOutput(configuration, DocPaths.RESOURCES.resolve(DocPaths.X_IMG)); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
179 |
f.copyResource(DOCLET_RESOURCES.resolve(DocPaths.X_IMG), true, false); |
33920 | 180 |
copyJqueryFiles(); |
181 |
} |
|
182 |
} |
|
183 |
||
184 |
protected void copyJqueryFiles() { |
|
185 |
List<String> files = Arrays.asList( |
|
186 |
"jquery-1.10.2.js", |
|
187 |
"jquery-ui.js", |
|
188 |
"jquery-ui.css", |
|
189 |
"jquery-ui.min.js", |
|
190 |
"jquery-ui.min.css", |
|
191 |
"jquery-ui.structure.min.css", |
|
192 |
"jquery-ui.structure.css", |
|
193 |
"external/jquery/jquery.js", |
|
194 |
"jszip/dist/jszip.js", |
|
195 |
"jszip/dist/jszip.min.js", |
|
196 |
"jszip-utils/dist/jszip-utils.js", |
|
197 |
"jszip-utils/dist/jszip-utils.min.js", |
|
198 |
"jszip-utils/dist/jszip-utils-ie.js", |
|
199 |
"jszip-utils/dist/jszip-utils-ie.min.js", |
|
200 |
"images/ui-bg_flat_0_aaaaaa_40x100.png", |
|
201 |
"images/ui-icons_454545_256x240.png", |
|
202 |
"images/ui-bg_glass_95_fef1ec_1x400.png", |
|
203 |
"images/ui-bg_glass_75_dadada_1x400.png", |
|
204 |
"images/ui-bg_highlight-soft_75_cccccc_1x100.png", |
|
205 |
"images/ui-icons_888888_256x240.png", |
|
206 |
"images/ui-icons_2e83ff_256x240.png", |
|
207 |
"images/ui-bg_glass_65_ffffff_1x400.png", |
|
208 |
"images/ui-icons_cd0a0a_256x240.png", |
|
209 |
"images/ui-bg_glass_55_fbf9ee_1x400.png", |
|
210 |
"images/ui-icons_222222_256x240.png", |
|
211 |
"images/ui-bg_glass_75_e6e6e6_1x400.png", |
|
212 |
"images/ui-bg_flat_75_ffffff_40x100.png"); |
|
213 |
DocFile f; |
|
214 |
for (String file : files) { |
|
215 |
DocPath filePath = DocPaths.JQUERY_FILES.resolve(file); |
|
216 |
f = DocFile.createFileForOutput(configuration, filePath); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
217 |
f.copyResource(DOCLET_RESOURCES.resolve(filePath), true, false); |
33920 | 218 |
} |
10 | 219 |
} |
220 |
||
221 |
/** |
|
222 |
* {@inheritDoc} |
|
223 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
224 |
protected void generateClassFiles(SortedSet<TypeElement> arr, ClassTree classtree) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
225 |
List<TypeElement> list = new ArrayList<>(arr); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
226 |
ListIterator<TypeElement> iterator = list.listIterator(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
227 |
TypeElement klass = null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
228 |
while (iterator.hasNext()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
229 |
TypeElement prev = iterator.hasPrevious() ? klass : null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
230 |
klass = iterator.next(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
231 |
TypeElement next = iterator.nextIndex() == list.size() |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
232 |
? null : list.get(iterator.nextIndex()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
233 |
if (!(configuration.isGeneratedDoc(klass) && utils.isIncluded(klass))) { |
10 | 234 |
continue; |
235 |
} |
|
236 |
try { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
237 |
if (utils.isAnnotationType(klass)) { |
10 | 238 |
AbstractBuilder annotationTypeBuilder = |
239 |
configuration.getBuilderFactory() |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
240 |
.getAnnotationTypeBuilder(klass, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
241 |
prev == null ? null : prev.asType(), |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
242 |
next == null ? null : next.asType()); |
10 | 243 |
annotationTypeBuilder.build(); |
244 |
} else { |
|
245 |
AbstractBuilder classBuilder = |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
246 |
configuration.getBuilderFactory().getClassBuilder(klass, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
247 |
prev, next, classtree); |
10 | 248 |
classBuilder.build(); |
249 |
} |
|
20600
052970964bc1
6978886: javadoc shows stacktrace after print error resulting from disk full
kizune
parents:
19937
diff
changeset
|
250 |
} catch (IOException e) { |
052970964bc1
6978886: javadoc shows stacktrace after print error resulting from disk full
kizune
parents:
19937
diff
changeset
|
251 |
throw new DocletAbortException(e); |
052970964bc1
6978886: javadoc shows stacktrace after print error resulting from disk full
kizune
parents:
19937
diff
changeset
|
252 |
} catch (DocletAbortException de) { |
36526 | 253 |
de.printStackTrace(); |
20600
052970964bc1
6978886: javadoc shows stacktrace after print error resulting from disk full
kizune
parents:
19937
diff
changeset
|
254 |
throw de; |
10 | 255 |
} catch (Exception e) { |
256 |
e.printStackTrace(); |
|
19667
fdfce85627a9
8001669: javadoc internal DocletAbortException should set cause when appropriate
jjg
parents:
15723
diff
changeset
|
257 |
throw new DocletAbortException(e); |
10 | 258 |
} |
259 |
} |
|
260 |
} |
|
261 |
||
36526 | 262 |
/** |
263 |
* {@inheritDoc} |
|
264 |
*/ |
|
265 |
protected void generateModuleFiles() throws Exception { |
|
266 |
if (configuration.showModules) { |
|
267 |
ModuleIndexFrameWriter.generate(configuration); |
|
268 |
ModuleElement prevModule = null, nextModule; |
|
269 |
List<ModuleElement> mdles = new ArrayList<>(configuration.modulePackages.keySet()); |
|
270 |
int i = 0; |
|
271 |
for (ModuleElement mdle : mdles) { |
|
272 |
ModulePackageIndexFrameWriter.generate(configuration, mdle); |
|
273 |
nextModule = (i + 1 < mdles.size()) ? mdles.get(i + 1) : null; |
|
274 |
AbstractBuilder moduleSummaryBuilder = |
|
275 |
configuration.getBuilderFactory().getModuleSummaryBuilder( |
|
276 |
mdle, prevModule, nextModule); |
|
277 |
moduleSummaryBuilder.build(); |
|
278 |
prevModule = mdle; |
|
279 |
i++; |
|
280 |
} |
|
281 |
} |
|
282 |
} |
|
283 |
||
284 |
PackageElement getNamedPackage(List<PackageElement> list, int idx) { |
|
285 |
if (idx < list.size()) { |
|
286 |
PackageElement pkg = list.get(idx); |
|
287 |
if (pkg != null && !pkg.isUnnamed()) { |
|
288 |
return pkg; |
|
289 |
} |
|
290 |
} |
|
291 |
return null; |
|
292 |
} |
|
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
293 |
|
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
294 |
/** |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
295 |
* {@inheritDoc} |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14549
diff
changeset
|
296 |
*/ |
10 | 297 |
protected void generatePackageFiles(ClassTree classtree) throws Exception { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
298 |
Set<PackageElement> packages = configuration.packages; |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
299 |
if (packages.size() > 1) { |
10 | 300 |
PackageIndexFrameWriter.generate(configuration); |
301 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
302 |
List<PackageElement> pList = new ArrayList<>(packages); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
303 |
PackageElement prev = null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
304 |
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
|
305 |
// 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
|
306 |
// 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
|
307 |
// and package-tree.html pages for that package. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
308 |
PackageElement pkg = pList.get(i); |
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24221
diff
changeset
|
309 |
if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) { |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
310 |
PackageFrameWriter.generate(configuration, pkg); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
311 |
int nexti = i + 1; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
312 |
PackageElement next = null; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
313 |
if (nexti < pList.size()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
314 |
next = pList.get(nexti); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
315 |
// 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
|
316 |
if (next.isUnnamed() && ++nexti < pList.size()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
317 |
next = pList.get(nexti); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
318 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
319 |
} |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
320 |
AbstractBuilder packageSummaryBuilder = |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
321 |
configuration.getBuilderFactory().getPackageSummaryBuilder( |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
322 |
pkg, prev, next); |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
323 |
packageSummaryBuilder.build(); |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
324 |
if (configuration.createtree) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
325 |
PackageTreeWriter.generate(configuration, pkg, prev, next, |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
326 |
configuration.nodeprecated); |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
7681
diff
changeset
|
327 |
} |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22447
diff
changeset
|
328 |
prev = pkg; |
10 | 329 |
} |
330 |
} |
|
331 |
} |
|
332 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
333 |
public Set<Option> getSupportedOptions() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
334 |
return configuration.getSupportedOptions(); |
10 | 335 |
} |
336 |
||
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
337 |
private void performCopy(String filename) { |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
338 |
if (filename.isEmpty()) |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
339 |
return; |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
340 |
|
10 | 341 |
try { |
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
342 |
DocFile fromfile = DocFile.createFileForInput(configuration, filename); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
343 |
DocPath path = DocPath.create(fromfile.getName()); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
344 |
DocFile toFile = DocFile.createFileForOutput(configuration, path); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
345 |
if (toFile.isSameFile(fromfile)) |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
346 |
return; |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
347 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
348 |
configuration.message.notice("doclet.Copying_File_0_To_File_1", |
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
349 |
fromfile.toString(), path.getPath()); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
350 |
toFile.copyFile(fromfile); |
10 | 351 |
} catch (IOException exc) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
34752
diff
changeset
|
352 |
configuration.message.error("doclet.perform_copy_exception_encountered", |
10 | 353 |
exc.toString()); |
19667
fdfce85627a9
8001669: javadoc internal DocletAbortException should set cause when appropriate
jjg
parents:
15723
diff
changeset
|
354 |
throw new DocletAbortException(exc); |
10 | 355 |
} |
356 |
} |
|
357 |
} |