author | chegar |
Sun, 17 Aug 2014 15:52:32 +0100 | |
changeset 25874 | 83c19f00452c |
parent 25454 | langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java@376a52c9540c |
child 35419 | 6adb831721fe |
permissions | -rw-r--r-- |
10 | 1 |
/* |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22165
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 |
||
26 |
package com.sun.tools.doclets.internal.toolkit; |
|
27 |
||
14258 | 28 |
import java.io.*; |
29 |
import java.util.*; |
|
17563
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
30 |
import java.util.regex.Matcher; |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
31 |
import java.util.regex.Pattern; |
22153
f9f06fcca59d
8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents:
19937
diff
changeset
|
32 |
import javax.tools.JavaFileManager; |
14258 | 33 |
|
34 |
import com.sun.javadoc.*; |
|
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
35 |
import com.sun.tools.javac.sym.Profiles; |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
36 |
import com.sun.tools.javac.jvm.Profile; |
14258 | 37 |
import com.sun.tools.doclets.internal.toolkit.builders.BuilderFactory; |
10 | 38 |
import com.sun.tools.doclets.internal.toolkit.taglets.*; |
39 |
import com.sun.tools.doclets.internal.toolkit.util.*; |
|
22153
f9f06fcca59d
8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents:
19937
diff
changeset
|
40 |
import com.sun.tools.javac.util.StringUtils; |
10 | 41 |
|
42 |
/** |
|
43 |
* Configure the output based on the options. Doclets should sub-class |
|
44 |
* Configuration, to configure and add their own options. This class contains |
|
45 |
* all user options which are supported by the 1.1 doclet and the standard |
|
46 |
* doclet. |
|
47 |
* |
|
14260
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
48 |
* <p><b>This is NOT part of any supported API. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14258
diff
changeset
|
49 |
* 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
|
50 |
* 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
|
51 |
* deletion without notice.</b> |
10 | 52 |
* |
53 |
* @author Robert Field. |
|
54 |
* @author Atul Dambalkar. |
|
55 |
* @author Jamie Ho |
|
56 |
*/ |
|
57 |
public abstract class Configuration { |
|
58 |
||
59 |
/** |
|
16324 | 60 |
* Exception used to report a problem during setOptions. |
61 |
*/ |
|
16560 | 62 |
public static class Fault extends Exception { |
16324 | 63 |
private static final long serialVersionUID = 0; |
64 |
||
65 |
Fault(String msg) { |
|
66 |
super(msg); |
|
67 |
} |
|
68 |
||
69 |
Fault(String msg, Exception cause) { |
|
70 |
super(msg, cause); |
|
71 |
} |
|
72 |
} |
|
73 |
||
74 |
/** |
|
10 | 75 |
* The factory for builders. |
76 |
*/ |
|
77 |
protected BuilderFactory builderFactory; |
|
78 |
||
79 |
/** |
|
80 |
* The taglet manager. |
|
81 |
*/ |
|
82 |
public TagletManager tagletManager; |
|
83 |
||
84 |
/** |
|
85 |
* The path to the builder XML input file. |
|
86 |
*/ |
|
87 |
public String builderXMLPath; |
|
88 |
||
89 |
/** |
|
90 |
* The default path to the builder XML. |
|
91 |
*/ |
|
92 |
private static final String DEFAULT_BUILDER_XML = "resources/doclet.xml"; |
|
93 |
||
94 |
/** |
|
95 |
* The path to Taglets |
|
96 |
*/ |
|
97 |
public String tagletpath = ""; |
|
98 |
||
99 |
/** |
|
100 |
* This is true if option "-serialwarn" is used. Defualt value is false to |
|
14545
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
14544
diff
changeset
|
101 |
* suppress excessive warnings about serial tag. |
10 | 102 |
*/ |
103 |
public boolean serialwarn = false; |
|
104 |
||
105 |
/** |
|
106 |
* The specified amount of space between tab stops. |
|
107 |
*/ |
|
14542 | 108 |
public int sourcetab; |
109 |
||
110 |
public String tabSpaces; |
|
10 | 111 |
|
112 |
/** |
|
113 |
* True if we should generate browsable sources. |
|
114 |
*/ |
|
115 |
public boolean linksource = false; |
|
116 |
||
117 |
/** |
|
118 |
* True if command line option "-nosince" is used. Default value is |
|
119 |
* false. |
|
120 |
*/ |
|
121 |
public boolean nosince = false; |
|
122 |
||
123 |
/** |
|
124 |
* True if we should recursively copy the doc-file subdirectories |
|
125 |
*/ |
|
126 |
public boolean copydocfilesubdirs = false; |
|
127 |
||
128 |
/** |
|
129 |
* The META charset tag used for cross-platform viewing. |
|
130 |
*/ |
|
131 |
public String charset = ""; |
|
132 |
||
133 |
/** |
|
134 |
* True if user wants to add member names as meta keywords. |
|
135 |
* Set to false because meta keywords are ignored in general |
|
136 |
* by most Internet search engines. |
|
137 |
*/ |
|
138 |
public boolean keywords = false; |
|
139 |
||
140 |
/** |
|
1475 | 141 |
* The meta tag keywords instance. |
10 | 142 |
*/ |
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24221
diff
changeset
|
143 |
public final MetaKeywords metakeywords; |
10 | 144 |
|
145 |
/** |
|
146 |
* The list of doc-file subdirectories to exclude |
|
147 |
*/ |
|
868 | 148 |
protected Set<String> excludedDocFileDirs; |
10 | 149 |
|
150 |
/** |
|
151 |
* The list of qualifiers to exclude |
|
152 |
*/ |
|
868 | 153 |
protected Set<String> excludedQualifiers; |
10 | 154 |
|
155 |
/** |
|
156 |
* The Root of the generated Program Structure from the Doclet API. |
|
157 |
*/ |
|
158 |
public RootDoc root; |
|
159 |
||
160 |
/** |
|
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24221
diff
changeset
|
161 |
* An utility class for commonly used helpers |
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24221
diff
changeset
|
162 |
*/ |
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24221
diff
changeset
|
163 |
public Utils utils; |
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24221
diff
changeset
|
164 |
/** |
10 | 165 |
* Destination directory name, in which doclet will generate the entire |
166 |
* documentation. Default is current directory. |
|
167 |
*/ |
|
168 |
public String destDirName = ""; |
|
169 |
||
170 |
/** |
|
171 |
* Destination directory name, in which doclet will copy the doc-files to. |
|
172 |
*/ |
|
173 |
public String docFileDestDirName = ""; |
|
174 |
||
175 |
/** |
|
176 |
* Encoding for this document. Default is default encoding for this |
|
177 |
* platform. |
|
178 |
*/ |
|
179 |
public String docencoding = null; |
|
180 |
||
181 |
/** |
|
182 |
* True if user wants to suppress descriptions and tags. |
|
183 |
*/ |
|
184 |
public boolean nocomment = false; |
|
185 |
||
186 |
/** |
|
187 |
* Encoding for this document. Default is default encoding for this |
|
188 |
* platform. |
|
189 |
*/ |
|
190 |
public String encoding = null; |
|
191 |
||
192 |
/** |
|
193 |
* Generate author specific information for all the classes if @author |
|
194 |
* tag is used in the doc comment and if -author option is used. |
|
195 |
* <code>showauthor</code> is set to true if -author option is used. |
|
196 |
* Default is don't show author information. |
|
197 |
*/ |
|
198 |
public boolean showauthor = false; |
|
199 |
||
200 |
/** |
|
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
201 |
* Generate documentation for JavaFX getters and setters automatically |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
202 |
* by copying it from the appropriate property definition. |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
203 |
*/ |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
204 |
public boolean javafx = false; |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
205 |
|
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
206 |
/** |
10 | 207 |
* Generate version specific information for the all the classes |
208 |
* if @version tag is used in the doc comment and if -version option is |
|
209 |
* used. <code>showversion</code> is set to true if -version option is |
|
210 |
* used.Default is don't show version information. |
|
211 |
*/ |
|
212 |
public boolean showversion = false; |
|
213 |
||
214 |
/** |
|
215 |
* Sourcepath from where to read the source files. Default is classpath. |
|
216 |
* |
|
217 |
*/ |
|
218 |
public String sourcepath = ""; |
|
219 |
||
220 |
/** |
|
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
221 |
* Argument for command line option "-Xprofilespath". |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
222 |
*/ |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
223 |
public String profilespath = ""; |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
224 |
|
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
225 |
/** |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
226 |
* Generate profiles documentation if profilespath is set and valid profiles |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
227 |
* are present. |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
228 |
*/ |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
229 |
public boolean showProfiles = false; |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
230 |
|
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
231 |
/** |
10 | 232 |
* Don't generate deprecated API information at all, if -nodeprecated |
233 |
* option is used. <code>nodepracted</code> is set to true if |
|
234 |
* -nodeprecated option is used. Default is generate deprected API |
|
235 |
* information. |
|
236 |
*/ |
|
237 |
public boolean nodeprecated = false; |
|
238 |
||
239 |
/** |
|
240 |
* The catalog of classes specified on the command-line |
|
241 |
*/ |
|
242 |
public ClassDocCatalog classDocCatalog; |
|
243 |
||
244 |
/** |
|
245 |
* Message Retriever for the doclet, to retrieve message from the resource |
|
246 |
* file for this Configuration, which is common for 1.1 and standard |
|
247 |
* doclets. |
|
248 |
* |
|
249 |
* TODO: Make this private!!! |
|
250 |
*/ |
|
251 |
public MessageRetriever message = null; |
|
252 |
||
253 |
/** |
|
254 |
* True if user wants to suppress time stamp in output. |
|
255 |
* Default is false. |
|
256 |
*/ |
|
257 |
public boolean notimestamp= false; |
|
258 |
||
259 |
/** |
|
1475 | 260 |
* The package grouping instance. |
10 | 261 |
*/ |
1475 | 262 |
public final Group group = new Group(this); |
10 | 263 |
|
264 |
/** |
|
1475 | 265 |
* The tracker of external package links. |
10 | 266 |
*/ |
267 |
public final Extern extern = new Extern(this); |
|
268 |
||
269 |
/** |
|
270 |
* Return the build date for the doclet. |
|
271 |
*/ |
|
272 |
public abstract String getDocletSpecificBuildDate(); |
|
273 |
||
274 |
/** |
|
275 |
* This method should be defined in all those doclets(configurations), |
|
276 |
* which want to derive themselves from this Configuration. This method |
|
277 |
* can be used to set its own command line options. |
|
278 |
* |
|
279 |
* @param options The array of option names and values. |
|
280 |
* @throws DocletAbortException |
|
281 |
*/ |
|
16324 | 282 |
public abstract void setSpecificDocletOptions(String[][] options) throws Fault; |
10 | 283 |
|
284 |
/** |
|
285 |
* Return the doclet specific {@link MessageRetriever} |
|
286 |
* @return the doclet specific MessageRetriever. |
|
287 |
*/ |
|
288 |
public abstract MessageRetriever getDocletSpecificMsg(); |
|
289 |
||
290 |
/** |
|
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
291 |
* A profiles object used to access profiles across various pages. |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
292 |
*/ |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
293 |
public Profiles profiles; |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
294 |
|
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
295 |
/** |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22165
diff
changeset
|
296 |
* A map of the profiles to packages. |
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
297 |
*/ |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22165
diff
changeset
|
298 |
public Map<String, List<PackageDoc>> profilePackages; |
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
299 |
|
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
300 |
/** |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22165
diff
changeset
|
301 |
* A sorted set of packages specified on the command-line merged with a |
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22165
diff
changeset
|
302 |
* collection of packages that contain the classes specified on the |
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22165
diff
changeset
|
303 |
* command-line. |
10 | 304 |
*/ |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22165
diff
changeset
|
305 |
public SortedSet<PackageDoc> packages; |
10 | 306 |
|
307 |
/** |
|
308 |
* Constructor. Constructs the message retriever with resource file. |
|
309 |
*/ |
|
310 |
public Configuration() { |
|
311 |
message = |
|
312 |
new MessageRetriever(this, |
|
313 |
"com.sun.tools.doclets.internal.toolkit.resources.doclets"); |
|
22163 | 314 |
excludedDocFileDirs = new HashSet<>(); |
315 |
excludedQualifiers = new HashSet<>(); |
|
14542 | 316 |
setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH); |
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24221
diff
changeset
|
317 |
utils = new Utils(); |
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24221
diff
changeset
|
318 |
metakeywords = new MetaKeywords(this); |
10 | 319 |
} |
320 |
||
321 |
/** |
|
322 |
* Return the builder factory for this doclet. |
|
323 |
* |
|
324 |
* @return the builder factory for this doclet. |
|
325 |
*/ |
|
326 |
public BuilderFactory getBuilderFactory() { |
|
327 |
if (builderFactory == null) { |
|
328 |
builderFactory = new BuilderFactory(this); |
|
329 |
} |
|
330 |
return builderFactory; |
|
331 |
} |
|
332 |
||
333 |
/** |
|
334 |
* This method should be defined in all those doclets |
|
335 |
* which want to inherit from this Configuration. This method |
|
336 |
* should return the number of arguments to the command line |
|
337 |
* option (including the option name). For example, |
|
338 |
* -notimestamp is a single-argument option, so this method would |
|
339 |
* return 1. |
|
340 |
* |
|
341 |
* @param option Command line option under consideration. |
|
342 |
* @return number of arguments to option (including the |
|
343 |
* option name). Zero return means option not known. |
|
344 |
* Negative value means error occurred. |
|
345 |
*/ |
|
346 |
public int optionLength(String option) { |
|
22153
f9f06fcca59d
8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents:
19937
diff
changeset
|
347 |
option = StringUtils.toLowerCase(option); |
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
348 |
switch (option) { |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
349 |
case "-author": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
350 |
case "-docfilessubdirs": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
351 |
case "-javafx": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
352 |
case "-keywords": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
353 |
case "-linksource": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
354 |
case "-nocomment": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
355 |
case "-nodeprecated": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
356 |
case "-nosince": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
357 |
case "-notimestamp": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
358 |
case "-quiet": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
359 |
case "-xnodate": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
360 |
case "-version": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
361 |
return 1; |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
362 |
case "-d": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
363 |
case "-docencoding": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
364 |
case "-encoding": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
365 |
case "-excludedocfilessubdir": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
366 |
case "-link": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
367 |
case "-sourcetab": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
368 |
case "-noqualifier": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
369 |
case "-output": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
370 |
case "-sourcepath": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
371 |
case "-tag": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
372 |
case "-taglet": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
373 |
case "-tagletpath": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
374 |
case "-xprofilespath": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
375 |
return 2; |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
376 |
case "-group": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
377 |
case "-linkoffline": |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
378 |
return 3; |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
379 |
default: |
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
380 |
return -1; // indicate we don't know about it |
10 | 381 |
} |
382 |
} |
|
383 |
||
384 |
/** |
|
385 |
* Perform error checking on the given options. |
|
386 |
* |
|
387 |
* @param options the given options to check. |
|
388 |
* @param reporter the reporter used to report errors. |
|
389 |
*/ |
|
390 |
public abstract boolean validOptions(String options[][], |
|
391 |
DocErrorReporter reporter); |
|
392 |
||
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
393 |
private void initProfiles() throws IOException { |
19911 | 394 |
if (profilespath.isEmpty()) |
395 |
return; |
|
396 |
||
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
397 |
profiles = Profiles.read(new File(profilespath)); |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
398 |
|
19911 | 399 |
// Group the packages to be documented by the lowest profile (if any) |
400 |
// in which each appears |
|
22163 | 401 |
Map<Profile, List<PackageDoc>> interimResults = new EnumMap<>(Profile.class); |
19911 | 402 |
for (Profile p: Profile.values()) |
22165
ec53c8946fc2
8030807: langtools should still build using jdk 7
vromero
parents:
22163
diff
changeset
|
403 |
interimResults.put(p, new ArrayList<PackageDoc>()); |
19911 | 404 |
|
405 |
for (PackageDoc pkg: packages) { |
|
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24221
diff
changeset
|
406 |
if (nodeprecated && utils.isDeprecated(pkg)) { |
19937
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
407 |
continue; |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
408 |
} |
19911 | 409 |
// the getProfile method takes a type name, not a package name, |
410 |
// but isn't particularly fussy about the simple name -- so just use * |
|
411 |
int i = profiles.getProfile(pkg.name().replace(".", "/") + "/*"); |
|
412 |
Profile p = Profile.lookup(i); |
|
413 |
if (p != null) { |
|
414 |
List<PackageDoc> pkgs = interimResults.get(p); |
|
415 |
pkgs.add(pkg); |
|
416 |
} |
|
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
417 |
} |
19911 | 418 |
|
419 |
// Build the profilePackages structure used by the doclet |
|
22163 | 420 |
profilePackages = new HashMap<>(); |
19911 | 421 |
List<PackageDoc> prev = Collections.<PackageDoc>emptyList(); |
19937
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
422 |
int size; |
19911 | 423 |
for (Map.Entry<Profile,List<PackageDoc>> e: interimResults.entrySet()) { |
424 |
Profile p = e.getKey(); |
|
425 |
List<PackageDoc> pkgs = e.getValue(); |
|
426 |
pkgs.addAll(prev); // each profile contains all lower profiles |
|
427 |
Collections.sort(pkgs); |
|
19937
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
428 |
size = pkgs.size(); |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
429 |
// For a profile, if there are no packages to be documented, do not add |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
430 |
// it to profilePackages map. |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
431 |
if (size > 0) |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22165
diff
changeset
|
432 |
profilePackages.put(p.name, pkgs); |
19911 | 433 |
prev = pkgs; |
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
434 |
} |
19911 | 435 |
|
436 |
// Generate profiles documentation if any profile contains any |
|
437 |
// of the packages to be documented. |
|
438 |
showProfiles = !prev.isEmpty(); |
|
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
439 |
} |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
440 |
|
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22165
diff
changeset
|
441 |
private void initPackages() { |
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22165
diff
changeset
|
442 |
packages = new TreeSet<>(Arrays.asList(root.specifiedPackages())); |
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
443 |
for (ClassDoc aClass : root.specifiedClasses()) { |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22165
diff
changeset
|
444 |
packages.add(aClass.containingPackage()); |
10 | 445 |
} |
446 |
} |
|
447 |
||
448 |
/** |
|
449 |
* Set the command line options supported by this configuration. |
|
450 |
* |
|
451 |
* @param options the two dimensional array of options. |
|
452 |
*/ |
|
16324 | 453 |
public void setOptions(String[][] options) throws Fault { |
22163 | 454 |
LinkedHashSet<String[]> customTagStrs = new LinkedHashSet<>(); |
16324 | 455 |
|
456 |
// Some options, specifically -link and -linkoffline, require that |
|
457 |
// the output directory has already been created: so do that first. |
|
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
458 |
for (String[] os : options) { |
22153
f9f06fcca59d
8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents:
19937
diff
changeset
|
459 |
String opt = StringUtils.toLowerCase(os[0]); |
10 | 460 |
if (opt.equals("-d")) { |
461 |
destDirName = addTrailingFileSep(os[1]); |
|
462 |
docFileDestDirName = destDirName; |
|
16324 | 463 |
ensureOutputDirExists(); |
464 |
break; |
|
465 |
} |
|
466 |
} |
|
467 |
||
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
468 |
for (String[] os : options) { |
22153
f9f06fcca59d
8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents:
19937
diff
changeset
|
469 |
String opt = StringUtils.toLowerCase(os[0]); |
16324 | 470 |
if (opt.equals("-docfilessubdirs")) { |
10 | 471 |
copydocfilesubdirs = true; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
472 |
} else if (opt.equals("-docencoding")) { |
10 | 473 |
docencoding = os[1]; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
474 |
} else if (opt.equals("-encoding")) { |
10 | 475 |
encoding = os[1]; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
476 |
} else if (opt.equals("-author")) { |
10 | 477 |
showauthor = true; |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
478 |
} else if (opt.equals("-javafx")) { |
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
479 |
javafx = true; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
480 |
} else if (opt.equals("-nosince")) { |
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
481 |
nosince = true; |
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
482 |
} else if (opt.equals("-version")) { |
10 | 483 |
showversion = true; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
484 |
} else if (opt.equals("-nodeprecated")) { |
10 | 485 |
nodeprecated = true; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
486 |
} else if (opt.equals("-sourcepath")) { |
10 | 487 |
sourcepath = os[1]; |
18898
0eab5f5e3d1d
8009924: some langtools tools do not accept -cp as an alias for -classpath
vromero
parents:
17570
diff
changeset
|
488 |
} else if ((opt.equals("-classpath") || opt.equals("-cp")) && |
10 | 489 |
sourcepath.length() == 0) { |
490 |
sourcepath = os[1]; |
|
491 |
} else if (opt.equals("-excludedocfilessubdir")) { |
|
492 |
addToSet(excludedDocFileDirs, os[1]); |
|
493 |
} else if (opt.equals("-noqualifier")) { |
|
494 |
addToSet(excludedQualifiers, os[1]); |
|
495 |
} else if (opt.equals("-linksource")) { |
|
496 |
linksource = true; |
|
497 |
} else if (opt.equals("-sourcetab")) { |
|
498 |
linksource = true; |
|
499 |
try { |
|
14542 | 500 |
setTabWidth(Integer.parseInt(os[1])); |
10 | 501 |
} catch (NumberFormatException e) { |
502 |
//Set to -1 so that warning will be printed |
|
503 |
//to indicate what is valid argument. |
|
504 |
sourcetab = -1; |
|
505 |
} |
|
506 |
if (sourcetab <= 0) { |
|
507 |
message.warning("doclet.sourcetab_warning"); |
|
14542 | 508 |
setTabWidth(DocletConstants.DEFAULT_TAB_STOP_LENGTH); |
10 | 509 |
} |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
510 |
} else if (opt.equals("-notimestamp")) { |
10 | 511 |
notimestamp = true; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
512 |
} else if (opt.equals("-nocomment")) { |
10 | 513 |
nocomment = true; |
514 |
} else if (opt.equals("-tag") || opt.equals("-taglet")) { |
|
515 |
customTagStrs.add(os); |
|
516 |
} else if (opt.equals("-tagletpath")) { |
|
517 |
tagletpath = os[1]; |
|
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
518 |
} else if (opt.equals("-xprofilespath")) { |
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
519 |
profilespath = os[1]; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
520 |
} else if (opt.equals("-keywords")) { |
10 | 521 |
keywords = true; |
13842
6908f6badce4
7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents:
9606
diff
changeset
|
522 |
} else if (opt.equals("-serialwarn")) { |
10 | 523 |
serialwarn = true; |
524 |
} else if (opt.equals("-group")) { |
|
525 |
group.checkPackageGroups(os[1], os[2]); |
|
526 |
} else if (opt.equals("-link")) { |
|
527 |
String url = os[1]; |
|
14361
2814fa6977ac
8001219: Clean up use of URLs in javadoc Extern class
jjg
parents:
14263
diff
changeset
|
528 |
extern.link(url, url, root, false); |
10 | 529 |
} else if (opt.equals("-linkoffline")) { |
530 |
String url = os[1]; |
|
531 |
String pkglisturl = os[2]; |
|
14361
2814fa6977ac
8001219: Clean up use of URLs in javadoc Extern class
jjg
parents:
14263
diff
changeset
|
532 |
extern.link(url, pkglisturl, root, true); |
10 | 533 |
} |
534 |
} |
|
535 |
if (sourcepath.length() == 0) { |
|
536 |
sourcepath = System.getProperty("env.class.path") == null ? "" : |
|
537 |
System.getProperty("env.class.path"); |
|
538 |
} |
|
539 |
if (docencoding == null) { |
|
540 |
docencoding = encoding; |
|
541 |
} |
|
542 |
||
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
5520
diff
changeset
|
543 |
classDocCatalog = new ClassDocCatalog(root.specifiedClasses(), this); |
10 | 544 |
initTagletManager(customTagStrs); |
545 |
} |
|
546 |
||
547 |
/** |
|
548 |
* Set the command line options supported by this configuration. |
|
549 |
* |
|
550 |
* @throws DocletAbortException |
|
551 |
*/ |
|
16324 | 552 |
public void setOptions() throws Fault { |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
22165
diff
changeset
|
553 |
initPackages(); |
10 | 554 |
setOptions(root.options()); |
19911 | 555 |
try { |
556 |
initProfiles(); |
|
557 |
} catch (Exception e) { |
|
558 |
throw new DocletAbortException(e); |
|
15723
58a73dac9ee4
8006124: javadoc/doclet should be updated to support profiles
bpatel
parents:
14545
diff
changeset
|
559 |
} |
10 | 560 |
setSpecificDocletOptions(root.options()); |
561 |
} |
|
562 |
||
16324 | 563 |
private void ensureOutputDirExists() throws Fault { |
564 |
DocFile destDir = DocFile.createFileForDirectory(this, destDirName); |
|
565 |
if (!destDir.exists()) { |
|
566 |
//Create the output directory (in case it doesn't exist yet) |
|
567 |
root.printNotice(getText("doclet.dest_dir_create", destDirName)); |
|
568 |
destDir.mkdirs(); |
|
569 |
} else if (!destDir.isDirectory()) { |
|
570 |
throw new Fault(getText( |
|
571 |
"doclet.destination_directory_not_directory_0", |
|
572 |
destDir.getPath())); |
|
573 |
} else if (!destDir.canWrite()) { |
|
574 |
throw new Fault(getText( |
|
575 |
"doclet.destination_directory_not_writable_0", |
|
576 |
destDir.getPath())); |
|
577 |
} |
|
578 |
} |
|
579 |
||
10 | 580 |
|
581 |
/** |
|
582 |
* Initialize the taglet manager. The strings to initialize the simple custom tags should |
|
583 |
* be in the following format: "[tag name]:[location str]:[heading]". |
|
14545
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
14544
diff
changeset
|
584 |
* @param customTagStrs the set two dimensional arrays of strings. These arrays contain |
10 | 585 |
* either -tag or -taglet arguments. |
586 |
*/ |
|
1789
7ac8c0815000
6765045: Remove rawtypes warnings from langtools
mcimadamore
parents:
1475
diff
changeset
|
587 |
private void initTagletManager(Set<String[]> customTagStrs) { |
10 | 588 |
tagletManager = tagletManager == null ? |
16319
e586bfeb39c5
7112427: The doclet needs to be able to generate JavaFX documentation.
jjg
parents:
15725
diff
changeset
|
589 |
new TagletManager(nosince, showversion, showauthor, javafx, message) : |
10 | 590 |
tagletManager; |
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
591 |
for (String[] args : customTagStrs) { |
10 | 592 |
if (args[0].equals("-taglet")) { |
14545
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
14544
diff
changeset
|
593 |
tagletManager.addCustomTag(args[1], getFileManager(), tagletpath); |
10 | 594 |
continue; |
595 |
} |
|
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
596 |
String[] tokens = tokenize(args[1], |
22159
682da512ec17
8030253: Update langtools to use strings-in-switch
briangoetz
parents:
22153
diff
changeset
|
597 |
TagletManager.SIMPLE_TAGLET_OPT_SEPARATOR, 3); |
10 | 598 |
if (tokens.length == 1) { |
599 |
String tagName = args[1]; |
|
600 |
if (tagletManager.isKnownCustomTag(tagName)) { |
|
601 |
//reorder a standard tag |
|
602 |
tagletManager.addNewSimpleCustomTag(tagName, null, ""); |
|
603 |
} else { |
|
604 |
//Create a simple tag with the heading that has the same name as the tag. |
|
14263 | 605 |
StringBuilder heading = new StringBuilder(tagName + ":"); |
10 | 606 |
heading.setCharAt(0, Character.toUpperCase(tagName.charAt(0))); |
607 |
tagletManager.addNewSimpleCustomTag(tagName, heading.toString(), "a"); |
|
608 |
} |
|
609 |
} else if (tokens.length == 2) { |
|
610 |
//Add simple taglet without heading, probably to excluding it in the output. |
|
611 |
tagletManager.addNewSimpleCustomTag(tokens[0], tokens[1], ""); |
|
612 |
} else if (tokens.length >= 3) { |
|
613 |
tagletManager.addNewSimpleCustomTag(tokens[0], tokens[2], tokens[1]); |
|
614 |
} else { |
|
615 |
message.error("doclet.Error_invalid_custom_tag_argument", args[1]); |
|
616 |
} |
|
617 |
} |
|
618 |
} |
|
619 |
||
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
620 |
/** |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
621 |
* Given a string, return an array of tokens. The separator can be escaped |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
622 |
* with the '\' character. The '\' character may also be escaped by the |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
623 |
* '\' character. |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
624 |
* |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
625 |
* @param s the string to tokenize. |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
626 |
* @param separator the separator char. |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
627 |
* @param maxTokens the maximum number of tokens returned. If the |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
628 |
* max is reached, the remaining part of s is appended |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
629 |
* to the end of the last token. |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
630 |
* |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
631 |
* @return an array of tokens. |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
632 |
*/ |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
633 |
private String[] tokenize(String s, char separator, int maxTokens) { |
22163 | 634 |
List<String> tokens = new ArrayList<>(); |
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
635 |
StringBuilder token = new StringBuilder (); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
636 |
boolean prevIsEscapeChar = false; |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
637 |
for (int i = 0; i < s.length(); i += Character.charCount(i)) { |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
638 |
int currentChar = s.codePointAt(i); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
639 |
if (prevIsEscapeChar) { |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
640 |
// Case 1: escaped character |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
641 |
token.appendCodePoint(currentChar); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
642 |
prevIsEscapeChar = false; |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
643 |
} else if (currentChar == separator && tokens.size() < maxTokens-1) { |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
644 |
// Case 2: separator |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
645 |
tokens.add(token.toString()); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
646 |
token = new StringBuilder(); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
647 |
} else if (currentChar == '\\') { |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
648 |
// Case 3: escape character |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
649 |
prevIsEscapeChar = true; |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
650 |
} else { |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
651 |
// Case 4: regular character |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
652 |
token.appendCodePoint(currentChar); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
653 |
} |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
654 |
} |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
655 |
if (token.length() > 0) { |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
656 |
tokens.add(token.toString()); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
657 |
} |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
658 |
return tokens.toArray(new String[] {}); |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
659 |
} |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
660 |
|
868 | 661 |
private void addToSet(Set<String> s, String str){ |
10 | 662 |
StringTokenizer st = new StringTokenizer(str, ":"); |
663 |
String current; |
|
664 |
while(st.hasMoreTokens()){ |
|
665 |
current = st.nextToken(); |
|
666 |
s.add(current); |
|
667 |
} |
|
668 |
} |
|
669 |
||
670 |
/** |
|
14061
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
13842
diff
changeset
|
671 |
* Add a trailing file separator, if not found. Remove superfluous |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
13842
diff
changeset
|
672 |
* file separators if any. Preserve the front double file separator for |
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
13842
diff
changeset
|
673 |
* UNC paths. |
10 | 674 |
* |
675 |
* @param path Path under consideration. |
|
676 |
* @return String Properly constructed path string. |
|
677 |
*/ |
|
14061
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
13842
diff
changeset
|
678 |
public static String addTrailingFileSep(String path) { |
10 | 679 |
String fs = System.getProperty("file.separator"); |
680 |
String dblfs = fs + fs; |
|
681 |
int indexDblfs; |
|
14061
9ac68cf0048b
4696488: javadoc doesn't handle UNC paths for destination directory
bpatel
parents:
13842
diff
changeset
|
682 |
while ((indexDblfs = path.indexOf(dblfs, 1)) >= 0) { |
10 | 683 |
path = path.substring(0, indexDblfs) + |
684 |
path.substring(indexDblfs + fs.length()); |
|
685 |
} |
|
686 |
if (!path.endsWith(fs)) |
|
687 |
path += fs; |
|
688 |
return path; |
|
689 |
} |
|
690 |
||
691 |
/** |
|
692 |
* This checks for the validity of the options used by the user. |
|
693 |
* This works exactly like |
|
694 |
* {@link com.sun.javadoc.Doclet#validOptions(String[][], |
|
695 |
* DocErrorReporter)}. This will validate the options which are shared |
|
696 |
* by our doclets. For example, this method will flag an error using |
|
697 |
* the DocErrorReporter if user has used "-nohelp" and "-helpfile" option |
|
698 |
* together. |
|
699 |
* |
|
700 |
* @param options options used on the command line. |
|
701 |
* @param reporter used to report errors. |
|
702 |
* @return true if all the options are valid. |
|
703 |
*/ |
|
704 |
public boolean generalValidOptions(String options[][], |
|
705 |
DocErrorReporter reporter) { |
|
706 |
boolean docencodingfound = false; |
|
707 |
String encoding = ""; |
|
708 |
for (int oi = 0; oi < options.length; oi++) { |
|
709 |
String[] os = options[oi]; |
|
22153
f9f06fcca59d
8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents:
19937
diff
changeset
|
710 |
String opt = StringUtils.toLowerCase(os[0]); |
16324 | 711 |
if (opt.equals("-docencoding")) { |
10 | 712 |
docencodingfound = true; |
713 |
if (!checkOutputFileEncoding(os[1], reporter)) { |
|
714 |
return false; |
|
715 |
} |
|
716 |
} else if (opt.equals("-encoding")) { |
|
717 |
encoding = os[1]; |
|
718 |
} |
|
719 |
} |
|
720 |
if (!docencodingfound && encoding.length() > 0) { |
|
721 |
if (!checkOutputFileEncoding(encoding, reporter)) { |
|
722 |
return false; |
|
723 |
} |
|
724 |
} |
|
725 |
return true; |
|
726 |
} |
|
727 |
||
728 |
/** |
|
19937
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
729 |
* Check the validity of the given profile. Return false if there are no |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
730 |
* valid packages to be documented for the profile. |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
731 |
* |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
732 |
* @param profileName the profile that needs to be validated. |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
733 |
* @return true if the profile has valid packages to be documented. |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
734 |
*/ |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
735 |
public boolean shouldDocumentProfile(String profileName) { |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
736 |
return profilePackages.containsKey(profileName); |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
737 |
} |
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
738 |
|
7dacecdfbad4
8015496: Information that package is deprecated is missing in profiles view
bpatel
parents:
19911
diff
changeset
|
739 |
/** |
10 | 740 |
* Check the validity of the given Source or Output File encoding on this |
741 |
* platform. |
|
742 |
* |
|
743 |
* @param docencoding output file encoding. |
|
744 |
* @param reporter used to report errors. |
|
745 |
*/ |
|
746 |
private boolean checkOutputFileEncoding(String docencoding, |
|
747 |
DocErrorReporter reporter) { |
|
748 |
OutputStream ost= new ByteArrayOutputStream(); |
|
749 |
OutputStreamWriter osw = null; |
|
750 |
try { |
|
751 |
osw = new OutputStreamWriter(ost, docencoding); |
|
752 |
} catch (UnsupportedEncodingException exc) { |
|
753 |
reporter.printError(getText("doclet.Encoding_not_supported", |
|
754 |
docencoding)); |
|
755 |
return false; |
|
756 |
} finally { |
|
757 |
try { |
|
758 |
if (osw != null) { |
|
759 |
osw.close(); |
|
760 |
} |
|
761 |
} catch (IOException exc) { |
|
762 |
} |
|
763 |
} |
|
764 |
return true; |
|
765 |
} |
|
766 |
||
767 |
/** |
|
768 |
* Return true if the given doc-file subdirectory should be excluded and |
|
769 |
* false otherwise. |
|
770 |
* @param docfilesubdir the doc-files subdirectory to check. |
|
771 |
*/ |
|
772 |
public boolean shouldExcludeDocFileDir(String docfilesubdir){ |
|
773 |
if (excludedDocFileDirs.contains(docfilesubdir)) { |
|
774 |
return true; |
|
775 |
} else { |
|
776 |
return false; |
|
777 |
} |
|
778 |
} |
|
779 |
||
780 |
/** |
|
781 |
* Return true if the given qualifier should be excluded and false otherwise. |
|
782 |
* @param qualifier the qualifier to check. |
|
783 |
*/ |
|
784 |
public boolean shouldExcludeQualifier(String qualifier){ |
|
785 |
if (excludedQualifiers.contains("all") || |
|
786 |
excludedQualifiers.contains(qualifier) || |
|
787 |
excludedQualifiers.contains(qualifier + ".*")) { |
|
788 |
return true; |
|
789 |
} else { |
|
790 |
int index = -1; |
|
791 |
while ((index = qualifier.indexOf(".", index + 1)) != -1) { |
|
792 |
if (excludedQualifiers.contains(qualifier.substring(0, index + 1) + "*")) { |
|
793 |
return true; |
|
794 |
} |
|
795 |
} |
|
796 |
return false; |
|
797 |
} |
|
798 |
} |
|
799 |
||
800 |
/** |
|
801 |
* Return the qualified name of the <code>ClassDoc</code> if it's qualifier is not excluded. Otherwise, |
|
802 |
* return the unqualified <code>ClassDoc</code> name. |
|
803 |
* @param cd the <code>ClassDoc</code> to check. |
|
804 |
*/ |
|
805 |
public String getClassName(ClassDoc cd) { |
|
806 |
PackageDoc pd = cd.containingPackage(); |
|
807 |
if (pd != null && shouldExcludeQualifier(cd.containingPackage().name())) { |
|
808 |
return cd.name(); |
|
809 |
} else { |
|
810 |
return cd.qualifiedName(); |
|
811 |
} |
|
812 |
} |
|
813 |
||
814 |
public String getText(String key) { |
|
815 |
try { |
|
816 |
//Check the doclet specific properties file. |
|
817 |
return getDocletSpecificMsg().getText(key); |
|
818 |
} catch (Exception e) { |
|
819 |
//Check the shared properties file. |
|
820 |
return message.getText(key); |
|
821 |
} |
|
822 |
} |
|
823 |
||
824 |
public String getText(String key, String a1) { |
|
825 |
try { |
|
826 |
//Check the doclet specific properties file. |
|
827 |
return getDocletSpecificMsg().getText(key, a1); |
|
828 |
} catch (Exception e) { |
|
829 |
//Check the shared properties file. |
|
830 |
return message.getText(key, a1); |
|
831 |
} |
|
832 |
} |
|
833 |
||
834 |
public String getText(String key, String a1, String a2) { |
|
835 |
try { |
|
836 |
//Check the doclet specific properties file. |
|
837 |
return getDocletSpecificMsg().getText(key, a1, a2); |
|
838 |
} catch (Exception e) { |
|
839 |
//Check the shared properties file. |
|
840 |
return message.getText(key, a1, a2); |
|
841 |
} |
|
842 |
} |
|
843 |
||
844 |
public String getText(String key, String a1, String a2, String a3) { |
|
845 |
try { |
|
846 |
//Check the doclet specific properties file. |
|
847 |
return getDocletSpecificMsg().getText(key, a1, a2, a3); |
|
848 |
} catch (Exception e) { |
|
849 |
//Check the shared properties file. |
|
850 |
return message.getText(key, a1, a2, a3); |
|
851 |
} |
|
852 |
} |
|
853 |
||
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17563
diff
changeset
|
854 |
public abstract Content newContent(); |
17563
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
855 |
|
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
856 |
/** |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
857 |
* Get the configuration string as a content. |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
858 |
* |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
859 |
* @param key the key to look for in the configuration file |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
860 |
* @return a content tree for the text |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
861 |
*/ |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
862 |
public Content getResource(String key) { |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17563
diff
changeset
|
863 |
Content c = newContent(); |
17563
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
864 |
c.addContent(getText(key)); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
865 |
return c; |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
866 |
} |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
867 |
|
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
868 |
/** |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
869 |
* Get the configuration string as a content. |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
870 |
* |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
871 |
* @param key the key to look for in the configuration file |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
872 |
* @param o string or content argument added to configuration text |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
873 |
* @return a content tree for the text |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
874 |
*/ |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
875 |
public Content getResource(String key, Object o) { |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
876 |
return getResource(key, o, null, null); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
877 |
} |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
878 |
|
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
879 |
/** |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
880 |
* Get the configuration string as a content. |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
881 |
* |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
882 |
* @param key the key to look for in the configuration file |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
883 |
* @param o string or content argument added to configuration text |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
884 |
* @return a content tree for the text |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
885 |
*/ |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
886 |
public Content getResource(String key, Object o1, Object o2) { |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
887 |
return getResource(key, o1, o2, null); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
888 |
} |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
889 |
|
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
890 |
/** |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
891 |
* Get the configuration string as a content. |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
892 |
* |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
893 |
* @param key the key to look for in the configuration file |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
894 |
* @param o1 string or content argument added to configuration text |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
895 |
* @param o2 string or content argument added to configuration text |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
896 |
* @return a content tree for the text |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
897 |
*/ |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
898 |
public Content getResource(String key, Object o0, Object o1, Object o2) { |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17563
diff
changeset
|
899 |
Content c = newContent(); |
17563
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
900 |
Pattern p = Pattern.compile("\\{([012])\\}"); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
901 |
String text = getText(key); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
902 |
Matcher m = p.matcher(text); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
903 |
int start = 0; |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
904 |
while (m.find(start)) { |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
905 |
c.addContent(text.substring(start, m.start())); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
906 |
|
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
907 |
Object o = null; |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
908 |
switch (m.group(1).charAt(0)) { |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
909 |
case '0': o = o0; break; |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
910 |
case '1': o = o1; break; |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
911 |
case '2': o = o2; break; |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
912 |
} |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
913 |
|
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
914 |
if (o == null) { |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
915 |
c.addContent("{" + m.group(1) + "}"); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
916 |
} else if (o instanceof String) { |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
917 |
c.addContent((String) o); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
918 |
} else if (o instanceof Content) { |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
919 |
c.addContent((Content) o); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
920 |
} |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
921 |
|
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
922 |
start = m.end(); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
923 |
} |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
924 |
|
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
925 |
c.addContent(text.substring(start)); |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
926 |
return c; |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
927 |
} |
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
928 |
|
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
16560
diff
changeset
|
929 |
|
10 | 930 |
/** |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
5520
diff
changeset
|
931 |
* Return true if the ClassDoc element is getting documented, depending upon |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
5520
diff
changeset
|
932 |
* -nodeprecated option and the deprecation information. Return true if |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
5520
diff
changeset
|
933 |
* -nodeprecated is not used. Return false if -nodeprecated is used and if |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
5520
diff
changeset
|
934 |
* either ClassDoc element is deprecated or the containing package is deprecated. |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
5520
diff
changeset
|
935 |
* |
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
5520
diff
changeset
|
936 |
* @param cd the ClassDoc for which the page generation is checked |
10 | 937 |
*/ |
9606
e5a619cb5dd3
6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents:
5520
diff
changeset
|
938 |
public boolean isGeneratedDoc(ClassDoc cd) { |
10 | 939 |
if (!nodeprecated) { |
940 |
return true; |
|
941 |
} |
|
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
24221
diff
changeset
|
942 |
return !(utils.isDeprecated(cd) || utils.isDeprecated(cd.containingPackage())); |
10 | 943 |
} |
944 |
||
945 |
/** |
|
946 |
* Return the doclet specific instance of a writer factory. |
|
947 |
* @return the {@link WriterFactory} for the doclet. |
|
948 |
*/ |
|
949 |
public abstract WriterFactory getWriterFactory(); |
|
950 |
||
951 |
/** |
|
952 |
* Return the input stream to the builder XML. |
|
953 |
* |
|
954 |
* @return the input steam to the builder XML. |
|
955 |
* @throws FileNotFoundException when the given XML file cannot be found. |
|
956 |
*/ |
|
14544 | 957 |
public InputStream getBuilderXML() throws IOException { |
10 | 958 |
return builderXMLPath == null ? |
959 |
Configuration.class.getResourceAsStream(DEFAULT_BUILDER_XML) : |
|
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14361
diff
changeset
|
960 |
DocFile.createFileForInput(this, builderXMLPath).openInputStream(); |
10 | 961 |
} |
962 |
||
963 |
/** |
|
1863
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1789
diff
changeset
|
964 |
* Return the Locale for this document. |
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1789
diff
changeset
|
965 |
*/ |
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1789
diff
changeset
|
966 |
public abstract Locale getLocale(); |
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1789
diff
changeset
|
967 |
|
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1789
diff
changeset
|
968 |
/** |
14544 | 969 |
* Return the current file manager. |
970 |
*/ |
|
971 |
public abstract JavaFileManager getFileManager(); |
|
972 |
||
973 |
/** |
|
10 | 974 |
* Return the comparator that will be used to sort member documentation. |
975 |
* To no do any sorting, return null. |
|
976 |
* |
|
977 |
* @return the {@link java.util.Comparator} used to sort members. |
|
978 |
*/ |
|
868 | 979 |
public abstract Comparator<ProgramElementDoc> getMemberComparator(); |
14542 | 980 |
|
981 |
private void setTabWidth(int n) { |
|
982 |
sourcetab = n; |
|
983 |
tabSpaces = String.format("%" + n + "s", ""); |
|
984 |
} |
|
15354 | 985 |
|
986 |
public abstract boolean showMessage(SourcePosition pos, String key); |
|
10 | 987 |
} |