author | duke |
Wed, 05 Jul 2017 23:40:27 +0200 | |
changeset 45507 | e6d70017f5b9 |
parent 44388 | langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConfigurationImpl.java@4d0903f1f311 |
parent 45420 | langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConfigurationImpl.java@036dbf8b3817 |
child 45608 | 9927a9f16738 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
44388 | 2 |
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. |
10 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5520 | 7 |
* published by the Free Software Foundation. Oracle designates this |
10 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
10 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5520 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
10 | 24 |
*/ |
25 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
26 |
package jdk.javadoc.internal.doclets.formats.html; |
10 | 27 |
|
14258 | 28 |
import java.net.*; |
29 |
import java.util.*; |
|
10 | 30 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
31 |
import javax.lang.model.element.Element; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
32 |
import javax.lang.model.element.PackageElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
33 |
import javax.lang.model.element.TypeElement; |
14544 | 34 |
import javax.tools.JavaFileManager; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
35 |
import javax.tools.JavaFileObject; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
36 |
import javax.tools.StandardJavaFileManager; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
37 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
38 |
import com.sun.source.util.DocTreePath; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
39 |
import com.sun.tools.doclint.DocLint; |
14544 | 40 |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
41 |
import jdk.javadoc.doclet.Doclet; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
42 |
import jdk.javadoc.doclet.DocletEnvironment; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
43 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTag; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
44 |
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlVersion; |
45417 | 45 |
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
46 |
import jdk.javadoc.internal.doclets.toolkit.Content; |
40303 | 47 |
import jdk.javadoc.internal.doclets.toolkit.Messages; |
48 |
import jdk.javadoc.internal.doclets.toolkit.Resources; |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
49 |
import jdk.javadoc.internal.doclets.toolkit.WriterFactory; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
50 |
import jdk.javadoc.internal.doclets.toolkit.util.DocFile; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
51 |
import jdk.javadoc.internal.doclets.toolkit.util.DocPath; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
52 |
import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
53 |
import jdk.javadoc.internal.doclets.toolkit.util.Utils; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
54 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
55 |
import static javax.tools.Diagnostic.Kind.*; |
10 | 56 |
|
57 |
/** |
|
58 |
* Configure the output based on the command line options. |
|
59 |
* <p> |
|
60 |
* Also determine the length of the command line option. For example, |
|
61 |
* for a option "-header" there will be a string argument associated, then the |
|
62 |
* the length of option "-header" is two. But for option "-nohelp" no argument |
|
63 |
* is needed so it's length is 1. |
|
64 |
* </p> |
|
65 |
* <p> |
|
66 |
* Also do the error checking on the options used. For example it is illegal to |
|
67 |
* use "-helpfile" option when already "-nohelp" option is used. |
|
68 |
* </p> |
|
69 |
* |
|
14368
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
70 |
* <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
|
71 |
* 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
|
72 |
* 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
|
73 |
* deletion without notice.</b> |
6f4c62de6985
8001664: refactor javadoc to use abstraction to handle files
jjg
parents:
14357
diff
changeset
|
74 |
* |
10 | 75 |
* @author Robert Field. |
76 |
* @author Atul Dambalkar. |
|
77 |
* @author Jamie Ho |
|
9608 | 78 |
* @author Bhavesh Patel (Modified) |
10 | 79 |
*/ |
45417 | 80 |
public class HtmlConfiguration extends BaseConfiguration { |
10 | 81 |
|
82 |
/** |
|
83 |
* The build date. Note: For now, we will use |
|
84 |
* a version number instead of a date. |
|
85 |
*/ |
|
86 |
public static final String BUILD_DATE = System.getProperty("java.version"); |
|
87 |
||
88 |
/** |
|
89 |
* Argument for command line option "-header". |
|
90 |
*/ |
|
91 |
public String header = ""; |
|
92 |
||
93 |
/** |
|
94 |
* Argument for command line option "-packagesheader". |
|
95 |
*/ |
|
96 |
public String packagesheader = ""; |
|
97 |
||
98 |
/** |
|
99 |
* Argument for command line option "-footer". |
|
100 |
*/ |
|
101 |
public String footer = ""; |
|
102 |
||
103 |
/** |
|
104 |
* Argument for command line option "-doctitle". |
|
105 |
*/ |
|
106 |
public String doctitle = ""; |
|
107 |
||
108 |
/** |
|
109 |
* Argument for command line option "-windowtitle". |
|
110 |
*/ |
|
111 |
public String windowtitle = ""; |
|
112 |
||
113 |
/** |
|
114 |
* Argument for command line option "-top". |
|
115 |
*/ |
|
116 |
public String top = ""; |
|
117 |
||
118 |
/** |
|
119 |
* Argument for command line option "-bottom". |
|
120 |
*/ |
|
121 |
public String bottom = ""; |
|
122 |
||
123 |
/** |
|
124 |
* Argument for command line option "-helpfile". |
|
125 |
*/ |
|
126 |
public String helpfile = ""; |
|
127 |
||
128 |
/** |
|
129 |
* Argument for command line option "-stylesheetfile". |
|
130 |
*/ |
|
131 |
public String stylesheetfile = ""; |
|
132 |
||
133 |
/** |
|
9608 | 134 |
* Argument for command line option "-Xdocrootparent". |
135 |
*/ |
|
136 |
public String docrootparent = ""; |
|
137 |
||
138 |
/** |
|
10 | 139 |
* True if command line option "-nohelp" is used. Default value is false. |
140 |
*/ |
|
141 |
public boolean nohelp = false; |
|
142 |
||
143 |
/** |
|
144 |
* True if command line option "-splitindex" is used. Default value is |
|
145 |
* false. |
|
146 |
*/ |
|
147 |
public boolean splitindex = false; |
|
148 |
||
149 |
/** |
|
150 |
* False if command line option "-noindex" is used. Default value is true. |
|
151 |
*/ |
|
152 |
public boolean createindex = true; |
|
153 |
||
154 |
/** |
|
155 |
* True if command line option "-use" is used. Default value is false. |
|
156 |
*/ |
|
157 |
public boolean classuse = false; |
|
158 |
||
159 |
/** |
|
160 |
* False if command line option "-notree" is used. Default value is true. |
|
161 |
*/ |
|
162 |
public boolean createtree = true; |
|
163 |
||
164 |
/** |
|
165 |
* True if command line option "-nodeprecated" is used. Default value is |
|
166 |
* false. |
|
167 |
*/ |
|
168 |
public boolean nodeprecatedlist = false; |
|
169 |
||
170 |
/** |
|
171 |
* True if command line option "-nonavbar" is used. Default value is false. |
|
172 |
*/ |
|
173 |
public boolean nonavbar = false; |
|
174 |
||
175 |
/** |
|
176 |
* True if command line option "-nooverview" is used. Default value is |
|
177 |
* false |
|
178 |
*/ |
|
179 |
private boolean nooverview = false; |
|
180 |
||
181 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
182 |
* The overview path specified with "-overview" flag. |
10 | 183 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
184 |
public String overviewpath = null; |
10 | 185 |
|
186 |
/** |
|
187 |
* This is true if option "-overview" is used or option "-overview" is not |
|
188 |
* used and number of packages is more than one. |
|
189 |
*/ |
|
190 |
public boolean createoverview = false; |
|
191 |
||
192 |
/** |
|
40500
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
193 |
* Specifies whether or not frames should be generated. |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
194 |
* Defaults to true; can be set by --frames; can be set to false by --no-frames; last one wins. |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
195 |
*/ |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
196 |
public boolean frames = true; |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
197 |
|
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
198 |
/** |
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
199 |
* This is the HTML version of the generated pages. HTML 4.01 is the default output version. |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
200 |
*/ |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
201 |
public HtmlVersion htmlVersion = HtmlVersion.HTML4; |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
202 |
|
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
203 |
/** |
15354 | 204 |
* Collected set of doclint options |
205 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
206 |
public Map<Doclet.Option, String> doclintOpts = new LinkedHashMap<>(); |
15354 | 207 |
|
40303 | 208 |
public final Resources resources; |
10 | 209 |
|
210 |
/** |
|
211 |
* First file to appear in the right-hand frame in the generated |
|
212 |
* documentation. |
|
213 |
*/ |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14259
diff
changeset
|
214 |
public DocPath topFile = DocPath.empty; |
10 | 215 |
|
216 |
/** |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
217 |
* The TypeElement for the class file getting generated. |
10 | 218 |
*/ |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
219 |
public TypeElement currentTypeElement = null; // Set this TypeElement in the ClassWriter. |
10 | 220 |
|
33920 | 221 |
protected List<SearchIndexItem> memberSearchIndex = new ArrayList<>(); |
222 |
||
40511 | 223 |
protected List<SearchIndexItem> moduleSearchIndex = new ArrayList<>(); |
224 |
||
33920 | 225 |
protected List<SearchIndexItem> packageSearchIndex = new ArrayList<>(); |
226 |
||
227 |
protected List<SearchIndexItem> tagSearchIndex = new ArrayList<>(); |
|
228 |
||
229 |
protected List<SearchIndexItem> typeSearchIndex = new ArrayList<>(); |
|
230 |
||
231 |
protected Map<Character,List<SearchIndexItem>> tagSearchIndexMap = new HashMap<>(); |
|
232 |
||
233 |
protected Set<Character> tagSearchIndexKeys; |
|
234 |
||
40303 | 235 |
protected Contents contents; |
236 |
||
237 |
protected Messages messages; |
|
238 |
||
10 | 239 |
/** |
14259 | 240 |
* Constructor. Initializes resource for the |
241 |
* {@link com.sun.tools.doclets.internal.toolkit.util.MessageRetriever MessageRetriever}. |
|
10 | 242 |
*/ |
45417 | 243 |
public HtmlConfiguration(Doclet doclet) { |
44388 | 244 |
super(doclet); |
40303 | 245 |
resources = new Resources(this, |
45417 | 246 |
BaseConfiguration.sharedResourceBundleName, |
40303 | 247 |
"jdk.javadoc.internal.doclets.formats.html.resources.standard"); |
248 |
||
249 |
messages = new Messages(this); |
|
250 |
contents = new Contents(this); |
|
10 | 251 |
} |
252 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
253 |
private final String versionRBName = "jdk.javadoc.internal.tool.resources.version"; |
21888
568c5da9f16b
6726154: javadoc generated with incorrect version in comment
kizune
parents:
21500
diff
changeset
|
254 |
private ResourceBundle versionRB; |
568c5da9f16b
6726154: javadoc generated with incorrect version in comment
kizune
parents:
21500
diff
changeset
|
255 |
|
1475 | 256 |
/** |
10 | 257 |
* Return the build date for the doclet. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
258 |
* @return the build date |
10 | 259 |
*/ |
14544 | 260 |
@Override |
10 | 261 |
public String getDocletSpecificBuildDate() { |
21888
568c5da9f16b
6726154: javadoc generated with incorrect version in comment
kizune
parents:
21500
diff
changeset
|
262 |
if (versionRB == null) { |
568c5da9f16b
6726154: javadoc generated with incorrect version in comment
kizune
parents:
21500
diff
changeset
|
263 |
try { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
264 |
versionRB = ResourceBundle.getBundle(versionRBName, getLocale()); |
21888
568c5da9f16b
6726154: javadoc generated with incorrect version in comment
kizune
parents:
21500
diff
changeset
|
265 |
} catch (MissingResourceException e) { |
568c5da9f16b
6726154: javadoc generated with incorrect version in comment
kizune
parents:
21500
diff
changeset
|
266 |
return BUILD_DATE; |
568c5da9f16b
6726154: javadoc generated with incorrect version in comment
kizune
parents:
21500
diff
changeset
|
267 |
} |
568c5da9f16b
6726154: javadoc generated with incorrect version in comment
kizune
parents:
21500
diff
changeset
|
268 |
} |
568c5da9f16b
6726154: javadoc generated with incorrect version in comment
kizune
parents:
21500
diff
changeset
|
269 |
|
568c5da9f16b
6726154: javadoc generated with incorrect version in comment
kizune
parents:
21500
diff
changeset
|
270 |
try { |
568c5da9f16b
6726154: javadoc generated with incorrect version in comment
kizune
parents:
21500
diff
changeset
|
271 |
return versionRB.getString("release"); |
568c5da9f16b
6726154: javadoc generated with incorrect version in comment
kizune
parents:
21500
diff
changeset
|
272 |
} catch (MissingResourceException e) { |
568c5da9f16b
6726154: javadoc generated with incorrect version in comment
kizune
parents:
21500
diff
changeset
|
273 |
return BUILD_DATE; |
568c5da9f16b
6726154: javadoc generated with incorrect version in comment
kizune
parents:
21500
diff
changeset
|
274 |
} |
10 | 275 |
} |
276 |
||
40303 | 277 |
@Override |
278 |
public Resources getResources() { |
|
279 |
return resources; |
|
280 |
} |
|
281 |
||
282 |
@Override |
|
283 |
public Messages getMessages() { |
|
284 |
return messages; |
|
285 |
} |
|
286 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
287 |
protected boolean validateOptions() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
288 |
// check shared options |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
289 |
if (!generalValidOptions()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
290 |
return false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
291 |
} |
42277 | 292 |
// check if helpfile exists |
293 |
if (!helpfile.isEmpty()) { |
|
294 |
DocFile help = DocFile.createFileForInput(this, helpfile); |
|
295 |
if (!help.exists()) { |
|
296 |
reporter.print(ERROR, getText("doclet.File_not_found", helpfile)); |
|
297 |
return false; |
|
298 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
299 |
} |
43261 | 300 |
|
301 |
// In a more object-oriented world, this would be done by methods on the Option objects. |
|
302 |
// Note that -windowtitle silently removes any and all HTML elements, and so does not need |
|
303 |
// to be handled here. |
|
304 |
utils.checkJavaScriptInOption("-header", header); |
|
305 |
utils.checkJavaScriptInOption("-footer", footer); |
|
306 |
utils.checkJavaScriptInOption("-top", top); |
|
307 |
utils.checkJavaScriptInOption("-bottom", bottom); |
|
308 |
utils.checkJavaScriptInOption("-doctitle", doctitle); |
|
309 |
utils.checkJavaScriptInOption("-packagesheader", packagesheader); |
|
310 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
311 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
312 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
313 |
|
43261 | 314 |
|
14544 | 315 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
316 |
public boolean finishOptionSettings() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
317 |
if (!validateOptions()) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
318 |
return false; |
10 | 319 |
} |
42277 | 320 |
if (!getSpecifiedTypeElements().isEmpty()) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
321 |
Map<String, PackageElement> map = new HashMap<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
322 |
PackageElement pkg; |
42277 | 323 |
for (TypeElement aClass : getIncludedTypeElements()) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
324 |
pkg = utils.containingPackage(aClass); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
325 |
if (!map.containsKey(utils.getPackageName(pkg))) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
326 |
map.put(utils.getPackageName(pkg), pkg); |
10 | 327 |
} |
328 |
} |
|
329 |
} |
|
330 |
setCreateOverview(); |
|
39364
bd6d4a7936b4
8160301: javadoc RootDoclmpl and DocEnv needs to be renamed
ksrini
parents:
39181
diff
changeset
|
331 |
setTopFile(docEnv); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
332 |
workArounds.initDocLint(doclintOpts.values(), tagletManager.getCustomTagNames(), |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
333 |
Utils.toLowerCase(htmlVersion.name())); |
10 | 334 |
return true; |
335 |
} |
|
336 |
||
337 |
/** |
|
29957
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
338 |
* Return true if the generated output is HTML5. |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
339 |
*/ |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
340 |
public boolean isOutputHtml5() { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
341 |
return htmlVersion == HtmlVersion.HTML5; |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
342 |
} |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
343 |
|
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
344 |
/** |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
345 |
* Return true if the tag is allowed for this specific version of HTML. |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
346 |
*/ |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
347 |
public boolean allowTag(HtmlTag htmlTag) { |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
348 |
return htmlTag.allowTag(this.htmlVersion); |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
349 |
} |
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
350 |
|
7740f9657f56
8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents:
25874
diff
changeset
|
351 |
/** |
10 | 352 |
* Decide the page which will appear first in the right-hand frame. It will |
353 |
* be "overview-summary.html" if "-overview" option is used or no |
|
354 |
* "-overview" but the number of packages is more than one. It will be |
|
355 |
* "package-summary.html" of the respective package if there is only one |
|
356 |
* package to document. It will be a class page(first in the sorted order), |
|
357 |
* if only classes are provided on the command line. |
|
358 |
* |
|
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40500
diff
changeset
|
359 |
* @param docEnv the doclet environment |
10 | 360 |
*/ |
40500
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
361 |
protected void setTopFile(DocletEnvironment docEnv) { |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
362 |
if (!checkForDeprecation(docEnv)) { |
10 | 363 |
return; |
364 |
} |
|
365 |
if (createoverview) { |
|
40500
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
366 |
topFile = DocPaths.overviewSummary(frames); |
10 | 367 |
} else { |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40500
diff
changeset
|
368 |
if (showModules) { |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40500
diff
changeset
|
369 |
topFile = DocPath.empty.resolve(DocPaths.moduleSummary(modules.first())); |
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40500
diff
changeset
|
370 |
} else if (packages.size() == 1 && packages.first().isUnnamed()) { |
42277 | 371 |
List<TypeElement> classes = new ArrayList<>(getIncludedTypeElements()); |
40508
74ef30d16fb9
8159305: Enhance the javadoc tool to support module related options
ksrini
parents:
40500
diff
changeset
|
372 |
if (!classes.isEmpty()) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
373 |
TypeElement te = getValidClass(classes); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
374 |
topFile = DocPath.forClass(utils, te); |
10 | 375 |
} |
24221
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
23968
diff
changeset
|
376 |
} else if (!packages.isEmpty()) { |
2376793dd33b
8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents:
23968
diff
changeset
|
377 |
topFile = DocPath.forPackage(packages.first()).resolve(DocPaths.PACKAGE_SUMMARY); |
10 | 378 |
} |
379 |
} |
|
380 |
} |
|
381 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
382 |
protected TypeElement getValidClass(List<TypeElement> classes) { |
10 | 383 |
if (!nodeprecated) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
384 |
return classes.get(0); |
10 | 385 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
386 |
for (TypeElement te : classes) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
387 |
if (!utils.isDeprecated(te)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
388 |
return te; |
10 | 389 |
} |
390 |
} |
|
391 |
return null; |
|
392 |
} |
|
393 |
||
39364
bd6d4a7936b4
8160301: javadoc RootDoclmpl and DocEnv needs to be renamed
ksrini
parents:
39181
diff
changeset
|
394 |
protected boolean checkForDeprecation(DocletEnvironment docEnv) { |
42277 | 395 |
for (TypeElement te : getIncludedTypeElements()) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
396 |
if (isGeneratedDoc(te)) { |
10 | 397 |
return true; |
398 |
} |
|
399 |
} |
|
400 |
return false; |
|
401 |
} |
|
402 |
||
403 |
/** |
|
404 |
* Generate "overview.html" page if option "-overview" is used or number of |
|
405 |
* packages is more than one. Sets {@link #createoverview} field to true. |
|
406 |
*/ |
|
407 |
protected void setCreateOverview() { |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
408 |
if ((overviewpath != null || packages.size() > 1) && !nooverview) { |
10 | 409 |
createoverview = true; |
410 |
} |
|
411 |
} |
|
412 |
||
413 |
/** |
|
414 |
* {@inheritDoc} |
|
415 |
*/ |
|
14544 | 416 |
@Override |
10 | 417 |
public WriterFactory getWriterFactory() { |
1475 | 418 |
return new WriterFactoryImpl(this); |
10 | 419 |
} |
420 |
||
421 |
/** |
|
422 |
* {@inheritDoc} |
|
423 |
*/ |
|
14544 | 424 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
425 |
public Locale getLocale() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
426 |
if (locale == null) |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
427 |
return Locale.getDefault(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
428 |
return locale; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
429 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
430 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
431 |
/** |
40303 | 432 |
* Return the path of the overview file or null if it does not exist. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
433 |
* |
40303 | 434 |
* @return the path of the overview file or null if it does not exist. |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
435 |
*/ |
40303 | 436 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
437 |
public JavaFileObject getOverviewPath() { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
438 |
if (overviewpath != null && getFileManager() instanceof StandardJavaFileManager) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
439 |
StandardJavaFileManager fm = (StandardJavaFileManager) getFileManager(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
440 |
return fm.getJavaFileObjects(overviewpath).iterator().next(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
441 |
} |
10 | 442 |
return null; |
443 |
} |
|
1863
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1475
diff
changeset
|
444 |
|
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1475
diff
changeset
|
445 |
/** |
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1475
diff
changeset
|
446 |
* {@inheritDoc} |
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1475
diff
changeset
|
447 |
*/ |
14544 | 448 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
449 |
public JavaFileManager getFileManager() { |
39364
bd6d4a7936b4
8160301: javadoc RootDoclmpl and DocEnv needs to be renamed
ksrini
parents:
39181
diff
changeset
|
450 |
return docEnv.getJavaFileManager(); |
1863
e5de9abc0eb1
6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents:
1475
diff
changeset
|
451 |
} |
14544 | 452 |
|
453 |
@Override |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
454 |
public boolean showMessage(DocTreePath path, String key) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
455 |
return (path == null || workArounds.haveDocLint()); |
14544 | 456 |
} |
14545
2e7bab0639b8
6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents:
14544
diff
changeset
|
457 |
|
15354 | 458 |
@Override |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
459 |
public boolean showMessage(Element e, String key) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
460 |
return (e == null || workArounds.haveDocLint()); |
15354 | 461 |
} |
17563
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
15354
diff
changeset
|
462 |
|
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
15354
diff
changeset
|
463 |
@Override |
40303 | 464 |
public String getText(String key) { |
465 |
return resources.getText(key); |
|
466 |
} |
|
467 |
||
468 |
@Override |
|
469 |
public String getText(String key, String... args) { |
|
470 |
return resources.getText(key, (Object[]) args); |
|
471 |
} |
|
472 |
||
473 |
/** |
|
474 |
* {@inheritdoc} |
|
475 |
*/ |
|
476 |
@Override |
|
477 |
public Content getContent(String key) { |
|
478 |
return contents.getContent(key); |
|
479 |
} |
|
480 |
||
481 |
/** |
|
482 |
* Get the configuration string as a content. |
|
483 |
* |
|
484 |
* @param key the key to look for in the configuration file |
|
485 |
* @param o string or content argument added to configuration text |
|
486 |
* @return a content tree for the text |
|
487 |
*/ |
|
488 |
@Override |
|
489 |
public Content getContent(String key, Object o) { |
|
490 |
return contents.getContent(key, o); |
|
17563
e8ddeb9bd17c
8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents:
15354
diff
changeset
|
491 |
} |
33920 | 492 |
|
40303 | 493 |
/** |
494 |
* Get the configuration string as a content. |
|
495 |
* |
|
496 |
* @param key the key to look for in the configuration file |
|
497 |
* @param o1 resource argument |
|
498 |
* @param o2 resource argument |
|
499 |
* @return a content tree for the text |
|
500 |
*/ |
|
501 |
@Override |
|
502 |
public Content getContent(String key, Object o1, Object o2) { |
|
503 |
return contents.getContent(key, o1, o2); |
|
504 |
} |
|
505 |
||
506 |
/** |
|
507 |
* Get the configuration string as a content. |
|
508 |
* |
|
509 |
* @param key the key to look for in the configuration file |
|
510 |
* @param o0 string or content argument added to configuration text |
|
511 |
* @param o1 string or content argument added to configuration text |
|
512 |
* @param o2 string or content argument added to configuration text |
|
513 |
* @return a content tree for the text |
|
514 |
*/ |
|
515 |
@Override |
|
516 |
public Content getContent(String key, Object o0, Object o1, Object o2) { |
|
517 |
return contents.getContent(key, o0, o1, o2); |
|
518 |
} |
|
519 |
||
33920 | 520 |
protected void buildSearchTagIndex() { |
521 |
for (SearchIndexItem sii : tagSearchIndex) { |
|
522 |
String tagLabel = sii.getLabel(); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
523 |
Character unicode = (tagLabel.length() == 0) |
33920 | 524 |
? '*' |
525 |
: Character.toUpperCase(tagLabel.charAt(0)); |
|
526 |
List<SearchIndexItem> list = tagSearchIndexMap.get(unicode); |
|
527 |
if (list == null) { |
|
528 |
list = new ArrayList<>(); |
|
529 |
tagSearchIndexMap.put(unicode, list); |
|
530 |
} |
|
531 |
list.add(sii); |
|
532 |
} |
|
533 |
tagSearchIndexKeys = tagSearchIndexMap.keySet(); |
|
534 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
535 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
536 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
537 |
public Set<Doclet.Option> getSupportedOptions() { |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
538 |
Resources resources = getResources(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
539 |
Doclet.Option[] options = { |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
540 |
new Option(resources, "-bottom", 1) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
541 |
@Override |
42277 | 542 |
public boolean process(String opt, List<String> args) { |
543 |
bottom = args.get(0); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
544 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
545 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
546 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
547 |
new Option(resources, "-charset", 1) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
548 |
@Override |
42277 | 549 |
public boolean process(String opt, List<String> args) { |
550 |
charset = args.get(0); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
551 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
552 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
553 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
554 |
new Option(resources, "-doctitle", 1) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
555 |
@Override |
42277 | 556 |
public boolean process(String opt, List<String> args) { |
557 |
doctitle = args.get(0); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
558 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
559 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
560 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
561 |
new Option(resources, "-footer", 1) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
562 |
@Override |
42277 | 563 |
public boolean process(String opt, List<String> args) { |
564 |
footer = args.get(0); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
565 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
566 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
567 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
568 |
new Option(resources, "-header", 1) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
569 |
@Override |
42277 | 570 |
public boolean process(String opt, List<String> args) { |
571 |
header = args.get(0); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
572 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
573 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
574 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
575 |
new Option(resources, "-helpfile", 1) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
576 |
@Override |
42277 | 577 |
public boolean process(String opt, List<String> args) { |
578 |
if (nohelp == true) { |
|
579 |
reporter.print(ERROR, getText("doclet.Option_conflict", |
|
580 |
"-helpfile", "-nohelp")); |
|
581 |
return false; |
|
582 |
} |
|
583 |
if (!helpfile.isEmpty()) { |
|
584 |
reporter.print(ERROR, getText("doclet.Option_reuse", |
|
585 |
"-helpfile")); |
|
586 |
return false; |
|
587 |
} |
|
588 |
helpfile = args.get(0); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
589 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
590 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
591 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
592 |
new Option(resources, "-html4") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
593 |
@Override |
42277 | 594 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
595 |
htmlVersion = HtmlVersion.HTML4; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
596 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
597 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
598 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
599 |
new Option(resources, "-html5") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
600 |
@Override |
42277 | 601 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
602 |
htmlVersion = HtmlVersion.HTML5; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
603 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
604 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
605 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
606 |
new Option(resources, "-nohelp") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
607 |
@Override |
42277 | 608 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
609 |
nohelp = true; |
42277 | 610 |
if (!helpfile.isEmpty()) { |
611 |
reporter.print(ERROR, getText("doclet.Option_conflict", |
|
612 |
"-nohelp", "-helpfile")); |
|
613 |
return false; |
|
614 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
615 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
616 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
617 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
618 |
new Option(resources, "-nodeprecatedlist") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
619 |
@Override |
42277 | 620 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
621 |
nodeprecatedlist = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
622 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
623 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
624 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
625 |
new Option(resources, "-noindex") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
626 |
@Override |
42277 | 627 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
628 |
createindex = false; |
42277 | 629 |
if (splitindex == true) { |
630 |
reporter.print(ERROR, getText("doclet.Option_conflict", |
|
631 |
"-noindex", "-splitindex")); |
|
632 |
return false; |
|
633 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
634 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
635 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
636 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
637 |
new Option(resources, "-nonavbar") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
638 |
@Override |
42277 | 639 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
640 |
nonavbar = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
641 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
642 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
643 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
644 |
new Hidden(resources, "-nooverview") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
645 |
@Override |
42277 | 646 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
647 |
nooverview = true; |
42277 | 648 |
if (overviewpath != null) { |
649 |
reporter.print(ERROR, getText("doclet.Option_conflict", |
|
650 |
"-nooverview", "-overview")); |
|
651 |
return false; |
|
652 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
653 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
654 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
655 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
656 |
new Option(resources, "-notree") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
657 |
@Override |
42277 | 658 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
659 |
createtree = false; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
660 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
661 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
662 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
663 |
new Option(resources, "-overview", 1) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
664 |
@Override |
42277 | 665 |
public boolean process(String opt, List<String> args) { |
666 |
overviewpath = args.get(0); |
|
667 |
if (nooverview == true) { |
|
668 |
reporter.print(ERROR, getText("doclet.Option_conflict", |
|
669 |
"-overview", "-nooverview")); |
|
670 |
return false; |
|
671 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
672 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
673 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
674 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
675 |
new Option(resources, "--frames") { |
40500
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
676 |
@Override |
42277 | 677 |
public boolean process(String opt, List<String> args) { |
40500
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
678 |
frames = true; |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
679 |
return true; |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
680 |
} |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
681 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
682 |
new Option(resources, "--no-frames") { |
40500
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
683 |
@Override |
42277 | 684 |
public boolean process(String opt, List<String> args) { |
40500
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
685 |
frames = false; |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
686 |
return true; |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
687 |
} |
f293dbb81a53
8162353: javadoc should provide a way to disable use of frames
jjg
parents:
40303
diff
changeset
|
688 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
689 |
new Hidden(resources, "-packagesheader", 1) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
690 |
@Override |
42277 | 691 |
public boolean process(String opt, List<String> args) { |
692 |
packagesheader = args.get(0); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
693 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
694 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
695 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
696 |
new Option(resources, "-splitindex") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
697 |
@Override |
42277 | 698 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
699 |
splitindex = true; |
42277 | 700 |
if (createindex == false) { |
701 |
reporter.print(ERROR, getText("doclet.Option_conflict", |
|
702 |
"-splitindex", "-noindex")); |
|
703 |
return false; |
|
704 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
705 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
706 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
707 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
708 |
new Option(resources, "-stylesheetfile", 1) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
709 |
@Override |
42277 | 710 |
public boolean process(String opt, List<String> args) { |
711 |
stylesheetfile = args.get(0); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
712 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
713 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
714 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
715 |
new Option(resources, "-top", 1) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
716 |
@Override |
42277 | 717 |
public boolean process(String opt, List<String> args) { |
718 |
top = args.get(0); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
719 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
720 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
721 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
722 |
new Option(resources, "-use") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
723 |
@Override |
42277 | 724 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
725 |
classuse = true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
726 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
727 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
728 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
729 |
new Option(resources, "-windowtitle", 1) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
730 |
@Override |
42277 | 731 |
public boolean process(String opt, List<String> args) { |
732 |
windowtitle = args.get(0).replaceAll("\\<.*?>", ""); |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
733 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
734 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
735 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
736 |
new XOption(resources, "-Xdoclint") { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
737 |
@Override |
42277 | 738 |
public boolean process(String opt, List<String> args) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
739 |
doclintOpts.put(this, DocLint.XMSGS_OPTION); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
740 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
741 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
742 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
743 |
new XOption(resources, "-Xdocrootparent", 1) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
744 |
@Override |
42277 | 745 |
public boolean process(String opt, List<String> args) { |
746 |
docrootparent = args.get(0); |
|
747 |
try { |
|
748 |
URL ignored = new URL(docrootparent); |
|
749 |
} catch (MalformedURLException e) { |
|
750 |
reporter.print(ERROR, getText("doclet.MalformedURL", docrootparent)); |
|
751 |
return false; |
|
752 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
753 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
754 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
755 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
756 |
new XOption(resources, "doclet.usage.xdoclint-extended", "-Xdoclint:", 0) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
757 |
@Override |
42277 | 758 |
public boolean process(String opt, List<String> args) { |
759 |
String dopt = opt.replace("-Xdoclint:", DocLint.XMSGS_CUSTOM_PREFIX); |
|
760 |
doclintOpts.put(this, dopt); |
|
761 |
if (dopt.contains("/")) { |
|
762 |
reporter.print(ERROR, getText("doclet.Option_doclint_no_qualifiers")); |
|
763 |
return false; |
|
764 |
} |
|
765 |
if (!DocLint.isValidOption(dopt)) { |
|
766 |
reporter.print(ERROR, getText("doclet.Option_doclint_invalid_arg")); |
|
767 |
return false; |
|
768 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
769 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
770 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
771 |
}, |
41252
058d83c9b1c7
8166144: New javadoc options don't conform to JEP 293 (GNU style options)
jjg
parents:
40587
diff
changeset
|
772 |
new XOption(resources, "doclet.usage.xdoclint-package", "-Xdoclint/package:", 0) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
773 |
@Override |
42277 | 774 |
public boolean process(String opt, List<String> args) { |
775 |
String dopt = opt.replace("-Xdoclint/package:", DocLint.XCHECK_PACKAGE); |
|
776 |
doclintOpts.put(this, dopt); |
|
777 |
if (!DocLint.isValidOption(dopt)) { |
|
778 |
reporter.print(ERROR, getText("doclet.Option_doclint_package_invalid_arg")); |
|
779 |
return false; |
|
780 |
} |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
781 |
return true; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
782 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
783 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
784 |
}; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
785 |
Set<Doclet.Option> oset = new TreeSet<>(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
786 |
oset.addAll(Arrays.asList(options)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
787 |
oset.addAll(super.getSupportedOptions()); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
788 |
return oset; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
33920
diff
changeset
|
789 |
} |
10 | 790 |
} |