author | jjg |
Thu, 15 Nov 2012 19:54:20 -0800 | |
changeset 14544 | d71d992cb905 |
parent 14542 | 7062120649c2 |
child 14545 | 2e7bab0639b8 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
2 |
* Copyright (c) 1998, 2012, 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 |
||
26 |
package com.sun.tools.doclets.formats.html; |
|
27 |
||
14258 | 28 |
import java.net.*; |
29 |
import java.util.*; |
|
10 | 30 |
|
14544 | 31 |
import javax.tools.JavaFileManager; |
32 |
||
10 | 33 |
import com.sun.javadoc.*; |
14258 | 34 |
import com.sun.tools.doclets.internal.toolkit.*; |
35 |
import com.sun.tools.doclets.internal.toolkit.util.*; |
|
14544 | 36 |
import com.sun.tools.javac.file.JavacFileManager; |
37 |
import com.sun.tools.javac.util.Context; |
|
10 | 38 |
|
39 |
/** |
|
40 |
* Configure the output based on the command line options. |
|
41 |
* <p> |
|
42 |
* Also determine the length of the command line option. For example, |
|
43 |
* for a option "-header" there will be a string argument associated, then the |
|
44 |
* the length of option "-header" is two. But for option "-nohelp" no argument |
|
45 |
* is needed so it's length is 1. |
|
46 |
* </p> |
|
47 |
* <p> |
|
48 |
* Also do the error checking on the options used. For example it is illegal to |
|
49 |
* use "-helpfile" option when already "-nohelp" option is used. |
|
50 |
* </p> |
|
51 |
* |
|
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
52 |
* <p><b>This is NOT part of any supported API. |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
53 |
* If you write code that depends on this, you do so at your own risk. |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
54 |
* This code and its internal interfaces are subject to change or |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
55 |
* deletion without notice.</b> |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
56 |
* |
10 | 57 |
* @author Robert Field. |
58 |
* @author Atul Dambalkar. |
|
59 |
* @author Jamie Ho |
|
9608 | 60 |
* @author Bhavesh Patel (Modified) |
10 | 61 |
*/ |
62 |
public class ConfigurationImpl extends Configuration { |
|
63 |
||
64 |
/** |
|
65 |
* The build date. Note: For now, we will use |
|
66 |
* a version number instead of a date. |
|
67 |
*/ |
|
68 |
public static final String BUILD_DATE = System.getProperty("java.version"); |
|
69 |
||
70 |
/** |
|
71 |
* Argument for command line option "-header". |
|
72 |
*/ |
|
73 |
public String header = ""; |
|
74 |
||
75 |
/** |
|
76 |
* Argument for command line option "-packagesheader". |
|
77 |
*/ |
|
78 |
public String packagesheader = ""; |
|
79 |
||
80 |
/** |
|
81 |
* Argument for command line option "-footer". |
|
82 |
*/ |
|
83 |
public String footer = ""; |
|
84 |
||
85 |
/** |
|
86 |
* Argument for command line option "-doctitle". |
|
87 |
*/ |
|
88 |
public String doctitle = ""; |
|
89 |
||
90 |
/** |
|
91 |
* Argument for command line option "-windowtitle". |
|
92 |
*/ |
|
93 |
public String windowtitle = ""; |
|
94 |
||
95 |
/** |
|
96 |
* Argument for command line option "-top". |
|
97 |
*/ |
|
98 |
public String top = ""; |
|
99 |
||
100 |
/** |
|
101 |
* Argument for command line option "-bottom". |
|
102 |
*/ |
|
103 |
public String bottom = ""; |
|
104 |
||
105 |
/** |
|
106 |
* Argument for command line option "-helpfile". |
|
107 |
*/ |
|
108 |
public String helpfile = ""; |
|
109 |
||
110 |
/** |
|
111 |
* Argument for command line option "-stylesheetfile". |
|
112 |
*/ |
|
113 |
public String stylesheetfile = ""; |
|
114 |
||
115 |
/** |
|
9608 | 116 |
* Argument for command line option "-Xdocrootparent". |
117 |
*/ |
|
118 |
public String docrootparent = ""; |
|
119 |
||
120 |
/** |
|
10 | 121 |
* True if command line option "-nohelp" is used. Default value is false. |
122 |
*/ |
|
123 |
public boolean nohelp = false; |
|
124 |
||
125 |
/** |
|
126 |
* True if command line option "-splitindex" is used. Default value is |
|
127 |
* false. |
|
128 |
*/ |
|
129 |
public boolean splitindex = false; |
|
130 |
||
131 |
/** |
|
132 |
* False if command line option "-noindex" is used. Default value is true. |
|
133 |
*/ |
|
134 |
public boolean createindex = true; |
|
135 |
||
136 |
/** |
|
137 |
* True if command line option "-use" is used. Default value is false. |
|
138 |
*/ |
|
139 |
public boolean classuse = false; |
|
140 |
||
141 |
/** |
|
142 |
* False if command line option "-notree" is used. Default value is true. |
|
143 |
*/ |
|
144 |
public boolean createtree = true; |
|
145 |
||
146 |
/** |
|
147 |
* True if command line option "-nodeprecated" is used. Default value is |
|
148 |
* false. |
|
149 |
*/ |
|
150 |
public boolean nodeprecatedlist = false; |
|
151 |
||
152 |
/** |
|
153 |
* True if command line option "-nonavbar" is used. Default value is false. |
|
154 |
*/ |
|
155 |
public boolean nonavbar = false; |
|
156 |
||
157 |
/** |
|
158 |
* True if command line option "-nooverview" is used. Default value is |
|
159 |
* false |
|
160 |
*/ |
|
161 |
private boolean nooverview = false; |
|
162 |
||
163 |
/** |
|
164 |
* True if command line option "-overview" is used. Default value is false. |
|
165 |
*/ |
|
166 |
public boolean overview = false; |
|
167 |
||
168 |
/** |
|
169 |
* This is true if option "-overview" is used or option "-overview" is not |
|
170 |
* used and number of packages is more than one. |
|
171 |
*/ |
|
172 |
public boolean createoverview = false; |
|
173 |
||
174 |
/** |
|
175 |
* Unique Resource Handler for this package. |
|
176 |
*/ |
|
177 |
public final MessageRetriever standardmessage; |
|
178 |
||
179 |
/** |
|
180 |
* First file to appear in the right-hand frame in the generated |
|
181 |
* documentation. |
|
182 |
*/ |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14259
diff
changeset
|
183 |
public DocPath topFile = DocPath.empty; |
10 | 184 |
|
185 |
/** |
|
186 |
* The classdoc for the class file getting generated. |
|
187 |
*/ |
|
14542 | 188 |
public ClassDoc currentcd = null; // Set this classdoc in the ClassWriter. |
10 | 189 |
|
190 |
/** |
|
14259 | 191 |
* Constructor. Initializes resource for the |
192 |
* {@link com.sun.tools.doclets.internal.toolkit.util.MessageRetriever MessageRetriever}. |
|
10 | 193 |
*/ |
14542 | 194 |
public ConfigurationImpl() { |
10 | 195 |
standardmessage = new MessageRetriever(this, |
196 |
"com.sun.tools.doclets.formats.html.resources.standard"); |
|
197 |
} |
|
198 |
||
1475 | 199 |
/** |
10 | 200 |
* Return the build date for the doclet. |
201 |
*/ |
|
14544 | 202 |
@Override |
10 | 203 |
public String getDocletSpecificBuildDate() { |
204 |
return BUILD_DATE; |
|
205 |
} |
|
206 |
||
207 |
/** |
|
208 |
* Depending upon the command line options provided by the user, set |
|
209 |
* configure the output generation environment. |
|
210 |
* |
|
211 |
* @param options The array of option names and values. |
|
212 |
*/ |
|
14544 | 213 |
@Override |
10 | 214 |
public void setSpecificDocletOptions(String[][] options) { |
215 |
for (int oi = 0; oi < options.length; ++oi) { |
|
216 |
String[] os = options[oi]; |
|
217 |
String opt = os[0].toLowerCase(); |
|
218 |
if (opt.equals("-footer")) { |
|
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
219 |
footer = os[1]; |
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
220 |
} else if (opt.equals("-header")) { |
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
221 |
header = os[1]; |
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
222 |
} else if (opt.equals("-packagesheader")) { |
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
223 |
packagesheader = os[1]; |
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
224 |
} else if (opt.equals("-doctitle")) { |
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
225 |
doctitle = os[1]; |
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
226 |
} else if (opt.equals("-windowtitle")) { |
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
227 |
windowtitle = os[1]; |
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
228 |
} else if (opt.equals("-top")) { |
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
229 |
top = os[1]; |
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
230 |
} else if (opt.equals("-bottom")) { |
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
231 |
bottom = os[1]; |
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
232 |
} else if (opt.equals("-helpfile")) { |
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
233 |
helpfile = os[1]; |
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
234 |
} else if (opt.equals("-stylesheetfile")) { |
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
235 |
stylesheetfile = os[1]; |
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
236 |
} else if (opt.equals("-charset")) { |
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
237 |
charset = os[1]; |
9608 | 238 |
} else if (opt.equals("-xdocrootparent")) { |
239 |
docrootparent = os[1]; |
|
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
240 |
} else if (opt.equals("-nohelp")) { |
10 | 241 |
nohelp = true; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
242 |
} else if (opt.equals("-splitindex")) { |
10 | 243 |
splitindex = true; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
244 |
} else if (opt.equals("-noindex")) { |
10 | 245 |
createindex = false; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
246 |
} else if (opt.equals("-use")) { |
10 | 247 |
classuse = true; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
248 |
} else if (opt.equals("-notree")) { |
10 | 249 |
createtree = false; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
250 |
} else if (opt.equals("-nodeprecatedlist")) { |
10 | 251 |
nodeprecatedlist = true; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
252 |
} else if (opt.equals("-nonavbar")) { |
10 | 253 |
nonavbar = true; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
254 |
} else if (opt.equals("-nooverview")) { |
10 | 255 |
nooverview = true; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9608
diff
changeset
|
256 |
} else if (opt.equals("-overview")) { |
10 | 257 |
overview = true; |
258 |
} |
|
259 |
} |
|
260 |
if (root.specifiedClasses().length > 0) { |
|
868 | 261 |
Map<String,PackageDoc> map = new HashMap<String,PackageDoc>(); |
10 | 262 |
PackageDoc pd; |
263 |
ClassDoc[] classes = root.classes(); |
|
264 |
for (int i = 0; i < classes.length; i++) { |
|
265 |
pd = classes[i].containingPackage(); |
|
266 |
if(! map.containsKey(pd.name())) { |
|
267 |
map.put(pd.name(), pd); |
|
268 |
} |
|
269 |
} |
|
270 |
} |
|
271 |
setCreateOverview(); |
|
272 |
setTopFile(root); |
|
273 |
} |
|
274 |
||
275 |
/** |
|
276 |
* Returns the "length" of a given option. If an option takes no |
|
277 |
* arguments, its length is one. If it takes one argument, it's |
|
278 |
* length is two, and so on. This method is called by JavaDoc to |
|
279 |
* parse the options it does not recognize. It then calls |
|
280 |
* {@link #validOptions(String[][], DocErrorReporter)} to |
|
281 |
* validate them. |
|
282 |
* <b>Note:</b><br> |
|
283 |
* The options arrive as case-sensitive strings. For options that |
|
284 |
* are not case-sensitive, use toLowerCase() on the option string |
|
285 |
* before comparing it. |
|
286 |
* </blockquote> |
|
287 |
* |
|
288 |
* @return number of arguments + 1 for a option. Zero return means |
|
289 |
* option not known. Negative value means error occurred. |
|
290 |
*/ |
|
291 |
public int optionLength(String option) { |
|
292 |
int result = -1; |
|
293 |
if ((result = super.optionLength(option)) > 0) { |
|
294 |
return result; |
|
295 |
} |
|
296 |
// otherwise look for the options we have added |
|
297 |
option = option.toLowerCase(); |
|
298 |
if (option.equals("-nodeprecatedlist") || |
|
299 |
option.equals("-noindex") || |
|
300 |
option.equals("-notree") || |
|
301 |
option.equals("-nohelp") || |
|
302 |
option.equals("-splitindex") || |
|
303 |
option.equals("-serialwarn") || |
|
304 |
option.equals("-use") || |
|
305 |
option.equals("-nonavbar") || |
|
306 |
option.equals("-nooverview")) { |
|
307 |
return 1; |
|
308 |
} else if (option.equals("-help")) { |
|
309 |
System.out.println(getText("doclet.usage")); |
|
310 |
return 1; |
|
311 |
} else if (option.equals("-footer") || |
|
312 |
option.equals("-header") || |
|
313 |
option.equals("-packagesheader") || |
|
314 |
option.equals("-doctitle") || |
|
315 |
option.equals("-windowtitle") || |
|
316 |
option.equals("-top") || |
|
317 |
option.equals("-bottom") || |
|
318 |
option.equals("-helpfile") || |
|
319 |
option.equals("-stylesheetfile") || |
|
320 |
option.equals("-charset") || |
|
9608 | 321 |
option.equals("-overview") || |
322 |
option.equals("-xdocrootparent")) { |
|
10 | 323 |
return 2; |
324 |
} else { |
|
325 |
return 0; |
|
326 |
} |
|
327 |
} |
|
328 |
||
329 |
/** |
|
330 |
* {@inheritDoc} |
|
331 |
*/ |
|
14544 | 332 |
@Override |
10 | 333 |
public boolean validOptions(String options[][], |
334 |
DocErrorReporter reporter) { |
|
335 |
boolean helpfile = false; |
|
336 |
boolean nohelp = false; |
|
337 |
boolean overview = false; |
|
338 |
boolean nooverview = false; |
|
339 |
boolean splitindex = false; |
|
340 |
boolean noindex = false; |
|
341 |
// check shared options |
|
342 |
if (!generalValidOptions(options, reporter)) { |
|
343 |
return false; |
|
344 |
} |
|
345 |
// otherwise look at our options |
|
346 |
for (int oi = 0; oi < options.length; ++oi) { |
|
347 |
String[] os = options[oi]; |
|
348 |
String opt = os[0].toLowerCase(); |
|
349 |
if (opt.equals("-helpfile")) { |
|
350 |
if (nohelp == true) { |
|
351 |
reporter.printError(getText("doclet.Option_conflict", |
|
352 |
"-helpfile", "-nohelp")); |
|
353 |
return false; |
|
354 |
} |
|
355 |
if (helpfile == true) { |
|
356 |
reporter.printError(getText("doclet.Option_reuse", |
|
357 |
"-helpfile")); |
|
358 |
return false; |
|
359 |
} |
|
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
360 |
DocFile help = DocFile.createFileForInput(this, os[1]); |
10 | 361 |
if (!help.exists()) { |
362 |
reporter.printError(getText("doclet.File_not_found", os[1])); |
|
363 |
return false; |
|
364 |
} |
|
365 |
helpfile = true; |
|
366 |
} else if (opt.equals("-nohelp")) { |
|
367 |
if (helpfile == true) { |
|
368 |
reporter.printError(getText("doclet.Option_conflict", |
|
369 |
"-nohelp", "-helpfile")); |
|
370 |
return false; |
|
371 |
} |
|
372 |
nohelp = true; |
|
9608 | 373 |
} else if (opt.equals("-xdocrootparent")) { |
374 |
try { |
|
375 |
new URL(os[1]); |
|
376 |
} catch (MalformedURLException e) { |
|
377 |
reporter.printError(getText("doclet.MalformedURL", os[1])); |
|
378 |
return false; |
|
379 |
} |
|
10 | 380 |
} else if (opt.equals("-overview")) { |
381 |
if (nooverview == true) { |
|
382 |
reporter.printError(getText("doclet.Option_conflict", |
|
383 |
"-overview", "-nooverview")); |
|
384 |
return false; |
|
385 |
} |
|
386 |
if (overview == true) { |
|
387 |
reporter.printError(getText("doclet.Option_reuse", |
|
388 |
"-overview")); |
|
389 |
return false; |
|
390 |
} |
|
391 |
overview = true; |
|
392 |
} else if (opt.equals("-nooverview")) { |
|
393 |
if (overview == true) { |
|
394 |
reporter.printError(getText("doclet.Option_conflict", |
|
395 |
"-nooverview", "-overview")); |
|
396 |
return false; |
|
397 |
} |
|
398 |
nooverview = true; |
|
399 |
} else if (opt.equals("-splitindex")) { |
|
400 |
if (noindex == true) { |
|
401 |
reporter.printError(getText("doclet.Option_conflict", |
|
402 |
"-splitindex", "-noindex")); |
|
403 |
return false; |
|
404 |
} |
|
405 |
splitindex = true; |
|
406 |
} else if (opt.equals("-noindex")) { |
|
407 |
if (splitindex == true) { |
|
408 |
reporter.printError(getText("doclet.Option_conflict", |
|
409 |
"-noindex", "-splitindex")); |
|
410 |
return false; |
|
411 |
} |
|
412 |
noindex = true; |
|
413 |
} |
|
414 |
} |
|
415 |
return true; |
|
416 |
} |
|
417 |
||
418 |
/** |
|
419 |
* {@inheritDoc} |
|
420 |
*/ |
|
14544 | 421 |
@Override |
10 | 422 |
public MessageRetriever getDocletSpecificMsg() { |
423 |
return standardmessage; |
|
424 |
} |
|
425 |
||
426 |
/** |
|
427 |
* Decide the page which will appear first in the right-hand frame. It will |
|
428 |
* be "overview-summary.html" if "-overview" option is used or no |
|
429 |
* "-overview" but the number of packages is more than one. It will be |
|
430 |
* "package-summary.html" of the respective package if there is only one |
|
431 |
* package to document. It will be a class page(first in the sorted order), |
|
432 |
* if only classes are provided on the command line. |
|
433 |
* |
|
434 |
* @param root Root of the program structure. |
|
435 |
*/ |
|
436 |
protected void setTopFile(RootDoc root) { |
|
437 |
if (!checkForDeprecation(root)) { |
|
438 |
return; |
|
439 |
} |
|
440 |
if (createoverview) { |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14259
diff
changeset
|
441 |
topFile = DocPaths.OVERVIEW_SUMMARY; |
10 | 442 |
} else { |
443 |
if (packages.length == 1 && packages[0].name().equals("")) { |
|
444 |
if (root.classes().length > 0) { |
|
445 |
ClassDoc[] classarr = root.classes(); |
|
446 |
Arrays.sort(classarr); |
|
447 |
ClassDoc cd = getValidClass(classarr); |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14259
diff
changeset
|
448 |
topFile = DocPath.forClass(cd); |
10 | 449 |
} |
450 |
} else { |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14259
diff
changeset
|
451 |
topFile = DocPath.forPackage(packages[0]).resolve(DocPaths.PACKAGE_SUMMARY); |
10 | 452 |
} |
453 |
} |
|
454 |
} |
|
455 |
||
456 |
protected ClassDoc getValidClass(ClassDoc[] classarr) { |
|
457 |
if (!nodeprecated) { |
|
458 |
return classarr[0]; |
|
459 |
} |
|
460 |
for (int i = 0; i < classarr.length; i++) { |
|
461 |
if (classarr[i].tags("deprecated").length == 0) { |
|
462 |
return classarr[i]; |
|
463 |
} |
|
464 |
} |
|
465 |
return null; |
|
466 |
} |
|
467 |
||
468 |
protected boolean checkForDeprecation(RootDoc root) { |
|
469 |
ClassDoc[] classarr = root.classes(); |
|
470 |
for (int i = 0; i < classarr.length; i++) { |
|
471 |
if (isGeneratedDoc(classarr[i])) { |
|
472 |
return true; |
|
473 |
} |
|
474 |
} |
|
475 |
return false; |
|
476 |
} |
|
477 |
||
478 |
/** |
|
479 |
* Generate "overview.html" page if option "-overview" is used or number of |
|
480 |
* packages is more than one. Sets {@link #createoverview} field to true. |
|
481 |
*/ |
|
482 |
protected void setCreateOverview() { |
|
483 |
if ((overview || packages.length > 1) && !nooverview) { |
|
484 |
createoverview = true; |
|
485 |
} |
|
486 |
} |
|
487 |
||
488 |
/** |
|
489 |
* {@inheritDoc} |
|
490 |
*/ |
|
14544 | 491 |
@Override |
10 | 492 |
public WriterFactory getWriterFactory() { |
1475 | 493 |
return new WriterFactoryImpl(this); |
10 | 494 |
} |
495 |
||
496 |
/** |
|
497 |
* {@inheritDoc} |
|
498 |
*/ |
|
14544 | 499 |
@Override |
868 | 500 |
public Comparator<ProgramElementDoc> getMemberComparator() { |
10 | 501 |
return null; |
502 |
} |
|
1863
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1475
diff
changeset
|
503 |
|
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1475
diff
changeset
|
504 |
/** |
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1475
diff
changeset
|
505 |
* {@inheritDoc} |
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1475
diff
changeset
|
506 |
*/ |
14544 | 507 |
@Override |
1863
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1475
diff
changeset
|
508 |
public Locale getLocale() { |
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1475
diff
changeset
|
509 |
if (root instanceof com.sun.tools.javadoc.RootDocImpl) |
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1475
diff
changeset
|
510 |
return ((com.sun.tools.javadoc.RootDocImpl)root).getLocale(); |
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1475
diff
changeset
|
511 |
else |
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1475
diff
changeset
|
512 |
return Locale.getDefault(); |
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1475
diff
changeset
|
513 |
} |
14544 | 514 |
|
515 |
/** |
|
516 |
* {@inheritDoc} |
|
517 |
*/ |
|
518 |
@Override |
|
519 |
public JavaFileManager getFileManager() { |
|
520 |
if (root instanceof com.sun.tools.javadoc.RootDocImpl) |
|
521 |
return ((com.sun.tools.javadoc.RootDocImpl)root).getFileManager(); |
|
522 |
else |
|
523 |
return new JavacFileManager(new Context(), false, null); |
|
524 |
} |
|
10 | 525 |
} |