langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java
author jjg
Fri, 27 May 2016 13:06:58 -0700
changeset 38617 d93a7f64e231
parent 37938 42baa89d2156
child 43261 d377e97291d8
permissions -rw-r--r--
8157606: deprecate com.sun.javadoc API Reviewed-by: ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33920
diff changeset
     2
 * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 2212
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
package com.sun.tools.doclets.formats.html;
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 13842
diff changeset
    28
import java.net.*;
8d2148961366 8000663: clean up langtools imports
jjg
parents: 13842
diff changeset
    29
import java.util.*;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
    31
import javax.tools.JavaFileManager;
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33920
diff changeset
    32
import javax.tools.JavaFileManager.Location;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33920
diff changeset
    33
import javax.tools.StandardLocation;
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
    34
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
import com.sun.javadoc.*;
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
    36
import com.sun.tools.doclets.formats.html.markup.*;
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 13842
diff changeset
    37
import com.sun.tools.doclets.internal.toolkit.*;
8d2148961366 8000663: clean up langtools imports
jjg
parents: 13842
diff changeset
    38
import com.sun.tools.doclets.internal.toolkit.util.*;
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
    39
import com.sun.tools.doclint.DocLint;
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
    40
import com.sun.tools.javac.file.JavacFileManager;
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
    41
import com.sun.tools.javac.util.Context;
22153
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 21888
diff changeset
    42
import com.sun.tools.javac.util.StringUtils;
37938
42baa89d2156 8075703: jdk.javadoc module exports com.sun.tools.javadoc package which contains a lot of internal API.
jjg
parents: 36526
diff changeset
    43
import com.sun.tools.javadoc.main.RootDocImpl;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
 * Configure the output based on the command line options.
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
 * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
 * Also determine the length of the command line option. For example,
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
 * for a option "-header" there will be a string argument associated, then the
06bc494ca11e Initial load
duke
parents:
diff changeset
    50
 * the length of option "-header" is two. But for option "-nohelp" no argument
06bc494ca11e Initial load
duke
parents:
diff changeset
    51
 * is needed so it's length is 1.
06bc494ca11e Initial load
duke
parents:
diff changeset
    52
 * </p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    53
 * <p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    54
 * Also do the error checking on the options used. For example it is illegal to
06bc494ca11e Initial load
duke
parents:
diff changeset
    55
 * use "-helpfile" option when already "-nohelp" option is used.
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
 * </p>
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
 *
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
    58
 *  <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
    59
 *  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
    60
 *  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
    61
 *  deletion without notice.</b>
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
    62
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
 * @author Robert Field.
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
 * @author Atul Dambalkar.
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
 * @author Jamie Ho
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
    66
 * @author Bhavesh Patel (Modified)
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
 */
38617
d93a7f64e231 8157606: deprecate com.sun.javadoc API
jjg
parents: 37938
diff changeset
    68
@Deprecated
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
public class ConfigurationImpl extends Configuration {
06bc494ca11e Initial load
duke
parents:
diff changeset
    70
06bc494ca11e Initial load
duke
parents:
diff changeset
    71
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    72
     * The build date.  Note: For now, we will use
06bc494ca11e Initial load
duke
parents:
diff changeset
    73
     * a version number instead of a date.
06bc494ca11e Initial load
duke
parents:
diff changeset
    74
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    75
    public static final String BUILD_DATE = System.getProperty("java.version");
06bc494ca11e Initial load
duke
parents:
diff changeset
    76
06bc494ca11e Initial load
duke
parents:
diff changeset
    77
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    78
     * Argument for command line option "-header".
06bc494ca11e Initial load
duke
parents:
diff changeset
    79
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
    public String header = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
     * Argument for command line option "-packagesheader".
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
    public String packagesheader = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    88
     * Argument for command line option "-footer".
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
    public String footer = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
     * Argument for command line option "-doctitle".
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
    public String doctitle = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
     * Argument for command line option "-windowtitle".
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
    public String windowtitle = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
     * Argument for command line option "-top".
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   105
    public String top = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   106
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
     * Argument for command line option "-bottom".
06bc494ca11e Initial load
duke
parents:
diff changeset
   109
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
    public String bottom = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
     * Argument for command line option "-helpfile".
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   115
    public String helpfile = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   116
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
     * Argument for command line option "-stylesheetfile".
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
    public String stylesheetfile = "";
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
    /**
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   123
     * Argument for command line option "-Xdocrootparent".
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   124
     */
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   125
    public String docrootparent = "";
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   126
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   127
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
     * True if command line option "-nohelp" is used. Default value is false.
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
    public boolean nohelp = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
     * True if command line option "-splitindex" is used. Default value is
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
     * false.
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
    public boolean splitindex = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
     * False if command line option "-noindex" is used. Default value is true.
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
    public boolean createindex = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
     * True if command line option "-use" is used. Default value is false.
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
    public boolean classuse = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
     * False if command line option "-notree" is used. Default value is true.
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   151
    public boolean createtree = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   152
06bc494ca11e Initial load
duke
parents:
diff changeset
   153
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
     * True if command line option "-nodeprecated" is used. Default value is
06bc494ca11e Initial load
duke
parents:
diff changeset
   155
     * false.
06bc494ca11e Initial load
duke
parents:
diff changeset
   156
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
    public boolean nodeprecatedlist = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   158
06bc494ca11e Initial load
duke
parents:
diff changeset
   159
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   160
     * True if command line option "-nonavbar" is used. Default value is false.
06bc494ca11e Initial load
duke
parents:
diff changeset
   161
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   162
    public boolean nonavbar = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   163
06bc494ca11e Initial load
duke
parents:
diff changeset
   164
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   165
     * True if command line option "-nooverview" is used. Default value is
06bc494ca11e Initial load
duke
parents:
diff changeset
   166
     * false
06bc494ca11e Initial load
duke
parents:
diff changeset
   167
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   168
    private boolean nooverview = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   169
06bc494ca11e Initial load
duke
parents:
diff changeset
   170
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   171
     * True if command line option "-overview" is used. Default value is false.
06bc494ca11e Initial load
duke
parents:
diff changeset
   172
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   173
    public boolean overview = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   174
06bc494ca11e Initial load
duke
parents:
diff changeset
   175
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   176
     * This is true if option "-overview" is used or option "-overview" is not
06bc494ca11e Initial load
duke
parents:
diff changeset
   177
     * used and number of packages is more than one.
06bc494ca11e Initial load
duke
parents:
diff changeset
   178
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   179
    public boolean createoverview = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   180
06bc494ca11e Initial load
duke
parents:
diff changeset
   181
    /**
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   182
     * 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
   183
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   184
    public HtmlVersion htmlVersion = HtmlVersion.HTML4;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   185
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   186
    /**
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   187
     * Collected set of doclint options
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   188
     */
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   189
    public Set<String> doclintOpts = new LinkedHashSet<>();
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   190
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   191
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   192
     * Unique Resource Handler for this package.
06bc494ca11e Initial load
duke
parents:
diff changeset
   193
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   194
    public final MessageRetriever standardmessage;
06bc494ca11e Initial load
duke
parents:
diff changeset
   195
06bc494ca11e Initial load
duke
parents:
diff changeset
   196
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   197
     * First file to appear in the right-hand frame in the generated
06bc494ca11e Initial load
duke
parents:
diff changeset
   198
     * documentation.
06bc494ca11e Initial load
duke
parents:
diff changeset
   199
     */
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14259
diff changeset
   200
    public DocPath topFile = DocPath.empty;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   201
06bc494ca11e Initial load
duke
parents:
diff changeset
   202
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   203
     * The classdoc for the class file getting generated.
06bc494ca11e Initial load
duke
parents:
diff changeset
   204
     */
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   205
    public ClassDoc currentcd = null;  // Set this classdoc in the ClassWriter.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   207
    protected List<SearchIndexItem> memberSearchIndex = new ArrayList<>();
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   208
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   209
    protected List<SearchIndexItem> packageSearchIndex = new ArrayList<>();
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   210
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   211
    protected List<SearchIndexItem> tagSearchIndex = new ArrayList<>();
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   212
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   213
    protected List<SearchIndexItem> typeSearchIndex = new ArrayList<>();
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   214
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   215
    protected Map<Character,List<SearchIndexItem>> tagSearchIndexMap = new HashMap<>();
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   216
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   217
    protected Set<Character> tagSearchIndexKeys;
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   218
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
    /**
14259
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 14258
diff changeset
   220
     * Constructor. Initializes resource for the
fb94a1df0d53 8000208: fix langtools javadoc comment issues
jjg
parents: 14258
diff changeset
   221
     * {@link com.sun.tools.doclets.internal.toolkit.util.MessageRetriever MessageRetriever}.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
     */
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   223
    public ConfigurationImpl() {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
        standardmessage = new MessageRetriever(this,
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
            "com.sun.tools.doclets.formats.html.resources.standard");
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
21888
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   228
    private final String versionRBName = "com.sun.tools.javadoc.resources.version";
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   229
    private ResourceBundle versionRB;
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   230
1475
19c0851667ca 6748541: javadoc should be reusable
jjg
parents: 1264
diff changeset
   231
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
     * Return the build date for the doclet.
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
     */
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   234
    @Override
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
    public String getDocletSpecificBuildDate() {
21888
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   236
        if (versionRB == null) {
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   237
            try {
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   238
                versionRB = ResourceBundle.getBundle(versionRBName);
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   239
            } catch (MissingResourceException e) {
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   240
                return BUILD_DATE;
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   241
            }
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   242
        }
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   243
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   244
        try {
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   245
            return versionRB.getString("release");
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   246
        } catch (MissingResourceException e) {
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   247
            return BUILD_DATE;
568c5da9f16b 6726154: javadoc generated with incorrect version in comment
kizune
parents: 21500
diff changeset
   248
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
06bc494ca11e Initial load
duke
parents:
diff changeset
   251
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   252
     * Depending upon the command line options provided by the user, set
06bc494ca11e Initial load
duke
parents:
diff changeset
   253
     * configure the output generation environment.
06bc494ca11e Initial load
duke
parents:
diff changeset
   254
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   255
     * @param options The array of option names and values.
06bc494ca11e Initial load
duke
parents:
diff changeset
   256
     */
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   257
    @Override
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   258
    public void setSpecificDocletOptions(String[][] options) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   259
        for (int oi = 0; oi < options.length; ++oi) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   260
            String[] os = options[oi];
22153
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 21888
diff changeset
   261
            String opt = StringUtils.toLowerCase(os[0]);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   262
            if (opt.equals("-footer")) {
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   263
                footer = os[1];
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   264
            } else if (opt.equals("-header")) {
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   265
                header = os[1];
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   266
            } else if (opt.equals("-packagesheader")) {
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   267
                packagesheader = os[1];
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   268
            } else if (opt.equals("-doctitle")) {
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   269
                doctitle = os[1];
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   270
            } else if (opt.equals("-windowtitle")) {
23968
d67158b385dd 8026736: Enhance Javadoc pages
bpatel
parents: 22163
diff changeset
   271
                windowtitle = os[1].replaceAll("\\<.*?>", "");
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   272
            } else if (opt.equals("-top")) {
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   273
                top = os[1];
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   274
            } else if (opt.equals("-bottom")) {
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   275
                bottom = os[1];
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   276
            } else if (opt.equals("-helpfile")) {
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   277
                helpfile = os[1];
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   278
            } else if (opt.equals("-stylesheetfile")) {
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   279
                stylesheetfile = os[1];
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   280
            } else if (opt.equals("-charset")) {
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   281
                charset = os[1];
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   282
            } else if (opt.equals("-xdocrootparent")) {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   283
                docrootparent = os[1];
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   284
            } else if (opt.equals("-nohelp")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   285
                nohelp = true;
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   286
            } else if (opt.equals("-splitindex")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   287
                splitindex = true;
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   288
            } else if (opt.equals("-noindex")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   289
                createindex = false;
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   290
            } else if (opt.equals("-use")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   291
                classuse = true;
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   292
            } else if (opt.equals("-notree")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   293
                createtree = false;
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   294
            } else if (opt.equals("-nodeprecatedlist")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   295
                nodeprecatedlist = true;
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   296
            } else if (opt.equals("-nonavbar")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   297
                nonavbar = true;
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   298
            } else if (opt.equals("-nooverview")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   299
                nooverview = true;
13842
6908f6badce4 7180906: Javadoc tool does not apply parameter -nosince
bpatel
parents: 9608
diff changeset
   300
            } else if (opt.equals("-overview")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   301
                overview = true;
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   302
            } else if (opt.equals("-html4")) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   303
                htmlVersion = HtmlVersion.HTML4;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   304
            } else if (opt.equals("-html5")) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   305
                htmlVersion = HtmlVersion.HTML5;
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   306
            } else if (opt.equals("-xdoclint")) {
31752
a4ea4c9bce2f 8129909: Add -Xdoclint/package: to javadoc
jlahoda
parents: 31751
diff changeset
   307
                doclintOpts.add(DocLint.XMSGS_OPTION);
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   308
            } else if (opt.startsWith("-xdoclint:")) {
31752
a4ea4c9bce2f 8129909: Add -Xdoclint/package: to javadoc
jlahoda
parents: 31751
diff changeset
   309
                doclintOpts.add(DocLint.XMSGS_CUSTOM_PREFIX + opt.substring(opt.indexOf(":") + 1));
a4ea4c9bce2f 8129909: Add -Xdoclint/package: to javadoc
jlahoda
parents: 31751
diff changeset
   310
            } else if (opt.startsWith("-xdoclint/package:")) {
a4ea4c9bce2f 8129909: Add -Xdoclint/package: to javadoc
jlahoda
parents: 31751
diff changeset
   311
                doclintOpts.add(DocLint.XCHECK_PACKAGE + opt.substring(opt.indexOf(":") + 1));
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   313
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   314
        if (root.specifiedClasses().length > 0) {
22163
3651128c74eb 8030244: Update langtools to use Diamond
briangoetz
parents: 22159
diff changeset
   315
            Map<String,PackageDoc> map = new HashMap<>();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   316
            PackageDoc pd;
06bc494ca11e Initial load
duke
parents:
diff changeset
   317
            ClassDoc[] classes = root.classes();
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   318
            for (ClassDoc aClass : classes) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   319
                pd = aClass.containingPackage();
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   320
                if (!map.containsKey(pd.name())) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   321
                    map.put(pd.name(), pd);
06bc494ca11e Initial load
duke
parents:
diff changeset
   322
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   323
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   324
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   325
        setCreateOverview();
06bc494ca11e Initial load
duke
parents:
diff changeset
   326
        setTopFile(root);
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   327
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   328
        if (root instanceof RootDocImpl) {
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   329
            ((RootDocImpl) root).initDocLint(doclintOpts, tagletManager.getCustomTagNames(),
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   330
                    StringUtils.toLowerCase(htmlVersion.name()));
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   331
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   332
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   333
06bc494ca11e Initial load
duke
parents:
diff changeset
   334
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
     * Returns the "length" of a given option. If an option takes no
06bc494ca11e Initial load
duke
parents:
diff changeset
   336
     * arguments, its length is one. If it takes one argument, it's
06bc494ca11e Initial load
duke
parents:
diff changeset
   337
     * length is two, and so on. This method is called by JavaDoc to
06bc494ca11e Initial load
duke
parents:
diff changeset
   338
     * parse the options it does not recognize. It then calls
06bc494ca11e Initial load
duke
parents:
diff changeset
   339
     * {@link #validOptions(String[][], DocErrorReporter)} to
06bc494ca11e Initial load
duke
parents:
diff changeset
   340
     * validate them.
06bc494ca11e Initial load
duke
parents:
diff changeset
   341
     * <b>Note:</b><br>
06bc494ca11e Initial load
duke
parents:
diff changeset
   342
     * The options arrive as case-sensitive strings. For options that
06bc494ca11e Initial load
duke
parents:
diff changeset
   343
     * are not case-sensitive, use toLowerCase() on the option string
06bc494ca11e Initial load
duke
parents:
diff changeset
   344
     * before comparing it.
06bc494ca11e Initial load
duke
parents:
diff changeset
   345
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   346
     * @return number of arguments + 1 for a option. Zero return means
06bc494ca11e Initial load
duke
parents:
diff changeset
   347
     * option not known.  Negative value means error occurred.
06bc494ca11e Initial load
duke
parents:
diff changeset
   348
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   349
    public int optionLength(String option) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   350
        int result = -1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   351
        if ((result = super.optionLength(option)) > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   352
            return result;
06bc494ca11e Initial load
duke
parents:
diff changeset
   353
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   354
        // otherwise look for the options we have added
22153
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 21888
diff changeset
   355
        option = StringUtils.toLowerCase(option);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   356
        if (option.equals("-nodeprecatedlist") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   357
            option.equals("-noindex") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   358
            option.equals("-notree") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   359
            option.equals("-nohelp") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   360
            option.equals("-splitindex") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   361
            option.equals("-serialwarn") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   362
            option.equals("-use") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   363
            option.equals("-nonavbar") ||
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   364
            option.equals("-nooverview") ||
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   365
            option.equals("-html4") ||
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   366
            option.equals("-html5") ||
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   367
            option.equals("-xdoclint") ||
31752
a4ea4c9bce2f 8129909: Add -Xdoclint/package: to javadoc
jlahoda
parents: 31751
diff changeset
   368
            option.startsWith("-xdoclint:") ||
a4ea4c9bce2f 8129909: Add -Xdoclint/package: to javadoc
jlahoda
parents: 31751
diff changeset
   369
            option.startsWith("-xdoclint/package:")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   370
            return 1;
06bc494ca11e Initial load
duke
parents:
diff changeset
   371
        } else if (option.equals("-help")) {
18005
598e2e068668 8007687: javadoc -X does not include -Xdoclint
jjg
parents: 17570
diff changeset
   372
            // Uugh: first, this should not be hidden inside optionLength,
598e2e068668 8007687: javadoc -X does not include -Xdoclint
jjg
parents: 17570
diff changeset
   373
            // and second, we should not be writing directly to stdout.
598e2e068668 8007687: javadoc -X does not include -Xdoclint
jjg
parents: 17570
diff changeset
   374
            // But we have no access to a DocErrorReporter, which would
598e2e068668 8007687: javadoc -X does not include -Xdoclint
jjg
parents: 17570
diff changeset
   375
            // allow use of reporter.printNotice
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   376
            System.out.println(getText("doclet.usage"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   377
            return 1;
18005
598e2e068668 8007687: javadoc -X does not include -Xdoclint
jjg
parents: 17570
diff changeset
   378
        } else if (option.equals("-x")) {
598e2e068668 8007687: javadoc -X does not include -Xdoclint
jjg
parents: 17570
diff changeset
   379
            // Uugh: first, this should not be hidden inside optionLength,
598e2e068668 8007687: javadoc -X does not include -Xdoclint
jjg
parents: 17570
diff changeset
   380
            // and second, we should not be writing directly to stdout.
598e2e068668 8007687: javadoc -X does not include -Xdoclint
jjg
parents: 17570
diff changeset
   381
            // But we have no access to a DocErrorReporter, which would
598e2e068668 8007687: javadoc -X does not include -Xdoclint
jjg
parents: 17570
diff changeset
   382
            // allow use of reporter.printNotice
598e2e068668 8007687: javadoc -X does not include -Xdoclint
jjg
parents: 17570
diff changeset
   383
            System.out.println(getText("doclet.X.usage"));
598e2e068668 8007687: javadoc -X does not include -Xdoclint
jjg
parents: 17570
diff changeset
   384
            return 1;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   385
        } else if (option.equals("-footer") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   386
                   option.equals("-header") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   387
                   option.equals("-packagesheader") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   388
                   option.equals("-doctitle") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   389
                   option.equals("-windowtitle") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   390
                   option.equals("-top") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   391
                   option.equals("-bottom") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   392
                   option.equals("-helpfile") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   393
                   option.equals("-stylesheetfile") ||
06bc494ca11e Initial load
duke
parents:
diff changeset
   394
                   option.equals("-charset") ||
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   395
                   option.equals("-overview") ||
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   396
                   option.equals("-xdocrootparent")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   397
            return 2;
06bc494ca11e Initial load
duke
parents:
diff changeset
   398
        } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   399
            return 0;
06bc494ca11e Initial load
duke
parents:
diff changeset
   400
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   401
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   402
06bc494ca11e Initial load
duke
parents:
diff changeset
   403
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   404
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   405
     */
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   406
    @Override
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   407
    public boolean validOptions(String options[][],
06bc494ca11e Initial load
duke
parents:
diff changeset
   408
            DocErrorReporter reporter) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   409
        boolean helpfile = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   410
        boolean nohelp = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   411
        boolean overview = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   412
        boolean nooverview = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   413
        boolean splitindex = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   414
        boolean noindex = false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   415
        // check shared options
06bc494ca11e Initial load
duke
parents:
diff changeset
   416
        if (!generalValidOptions(options, reporter)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   417
            return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   418
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   419
        // otherwise look at our options
06bc494ca11e Initial load
duke
parents:
diff changeset
   420
        for (int oi = 0; oi < options.length; ++oi) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   421
            String[] os = options[oi];
22153
f9f06fcca59d 8029800: Flags.java uses String.toLowerCase without specifying Locale
jlahoda
parents: 21888
diff changeset
   422
            String opt = StringUtils.toLowerCase(os[0]);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   423
            if (opt.equals("-helpfile")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   424
                if (nohelp == true) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   425
                    reporter.printError(getText("doclet.Option_conflict",
06bc494ca11e Initial load
duke
parents:
diff changeset
   426
                        "-helpfile", "-nohelp"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   427
                    return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   428
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   429
                if (helpfile == true) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   430
                    reporter.printError(getText("doclet.Option_reuse",
06bc494ca11e Initial load
duke
parents:
diff changeset
   431
                        "-helpfile"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   432
                    return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   433
                }
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
   434
                DocFile help = DocFile.createFileForInput(this, os[1]);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   435
                if (!help.exists()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   436
                    reporter.printError(getText("doclet.File_not_found", os[1]));
06bc494ca11e Initial load
duke
parents:
diff changeset
   437
                    return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   438
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   439
                helpfile = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   440
            } else  if (opt.equals("-nohelp")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   441
                if (helpfile == true) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   442
                    reporter.printError(getText("doclet.Option_conflict",
06bc494ca11e Initial load
duke
parents:
diff changeset
   443
                        "-nohelp", "-helpfile"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   444
                    return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   445
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   446
                nohelp = true;
9608
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   447
            } else if (opt.equals("-xdocrootparent")) {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   448
                try {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   449
                    new URL(os[1]);
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   450
                } catch (MalformedURLException e) {
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   451
                    reporter.printError(getText("doclet.MalformedURL", os[1]));
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   452
                    return false;
385a828ba236 6553182: Need to modify javadoc doclet for GPL
bpatel
parents: 5520
diff changeset
   453
                }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   454
            } else if (opt.equals("-overview")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   455
                if (nooverview == true) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   456
                    reporter.printError(getText("doclet.Option_conflict",
06bc494ca11e Initial load
duke
parents:
diff changeset
   457
                        "-overview", "-nooverview"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   458
                    return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   459
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   460
                if (overview == true) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   461
                    reporter.printError(getText("doclet.Option_reuse",
06bc494ca11e Initial load
duke
parents:
diff changeset
   462
                        "-overview"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   463
                    return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   464
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   465
                overview = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   466
            } else  if (opt.equals("-nooverview")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   467
                if (overview == true) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   468
                    reporter.printError(getText("doclet.Option_conflict",
06bc494ca11e Initial load
duke
parents:
diff changeset
   469
                        "-nooverview", "-overview"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   470
                    return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   471
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   472
                nooverview = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   473
            } else if (opt.equals("-splitindex")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   474
                if (noindex == true) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   475
                    reporter.printError(getText("doclet.Option_conflict",
06bc494ca11e Initial load
duke
parents:
diff changeset
   476
                        "-splitindex", "-noindex"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   477
                    return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   478
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   479
                splitindex = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   480
            } else if (opt.equals("-noindex")) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   481
                if (splitindex == true) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   482
                    reporter.printError(getText("doclet.Option_conflict",
06bc494ca11e Initial load
duke
parents:
diff changeset
   483
                        "-noindex", "-splitindex"));
06bc494ca11e Initial load
duke
parents:
diff changeset
   484
                    return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   485
                }
06bc494ca11e Initial load
duke
parents:
diff changeset
   486
                noindex = true;
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   487
            } else if (opt.startsWith("-xdoclint:")) {
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   488
                if (opt.contains("/")) {
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   489
                    reporter.printError(getText("doclet.Option_doclint_no_qualifiers"));
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   490
                    return false;
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   491
                }
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   492
                if (!DocLint.isValidOption(
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   493
                        opt.replace("-xdoclint:", DocLint.XMSGS_CUSTOM_PREFIX))) {
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   494
                    reporter.printError(getText("doclet.Option_doclint_invalid_arg"));
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   495
                    return false;
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   496
                }
31752
a4ea4c9bce2f 8129909: Add -Xdoclint/package: to javadoc
jlahoda
parents: 31751
diff changeset
   497
            } else if (opt.startsWith("-xdoclint/package:")) {
a4ea4c9bce2f 8129909: Add -Xdoclint/package: to javadoc
jlahoda
parents: 31751
diff changeset
   498
                if (!DocLint.isValidOption(
a4ea4c9bce2f 8129909: Add -Xdoclint/package: to javadoc
jlahoda
parents: 31751
diff changeset
   499
                        opt.replace("-xdoclint/package:", DocLint.XCHECK_PACKAGE))) {
a4ea4c9bce2f 8129909: Add -Xdoclint/package: to javadoc
jlahoda
parents: 31751
diff changeset
   500
                    reporter.printError(getText("doclet.Option_doclint_package_invalid_arg"));
a4ea4c9bce2f 8129909: Add -Xdoclint/package: to javadoc
jlahoda
parents: 31751
diff changeset
   501
                    return false;
a4ea4c9bce2f 8129909: Add -Xdoclint/package: to javadoc
jlahoda
parents: 31751
diff changeset
   502
                }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   503
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   504
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   505
        return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   506
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   507
06bc494ca11e Initial load
duke
parents:
diff changeset
   508
    /**
29957
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   509
     * Return true if the generated output is HTML5.
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   510
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   511
    public boolean isOutputHtml5() {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   512
        return htmlVersion == HtmlVersion.HTML5;
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   513
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   514
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   515
    /**
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   516
     * 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
   517
     */
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   518
    public boolean allowTag(HtmlTag htmlTag) {
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   519
        return htmlTag.allowTag(this.htmlVersion);
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   520
    }
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   521
7740f9657f56 8072945: Javadoc should generate valid and compliant HTML5 output
bpatel
parents: 25874
diff changeset
   522
    /**
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   523
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   524
     */
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   525
    @Override
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   526
    public MessageRetriever getDocletSpecificMsg() {
06bc494ca11e Initial load
duke
parents:
diff changeset
   527
        return standardmessage;
06bc494ca11e Initial load
duke
parents:
diff changeset
   528
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   529
06bc494ca11e Initial load
duke
parents:
diff changeset
   530
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   531
     * Decide the page which will appear first in the right-hand frame. It will
06bc494ca11e Initial load
duke
parents:
diff changeset
   532
     * be "overview-summary.html" if "-overview" option is used or no
06bc494ca11e Initial load
duke
parents:
diff changeset
   533
     * "-overview" but the number of packages is more than one. It will be
06bc494ca11e Initial load
duke
parents:
diff changeset
   534
     * "package-summary.html" of the respective package if there is only one
06bc494ca11e Initial load
duke
parents:
diff changeset
   535
     * package to document. It will be a class page(first in the sorted order),
06bc494ca11e Initial load
duke
parents:
diff changeset
   536
     * if only classes are provided on the command line.
06bc494ca11e Initial load
duke
parents:
diff changeset
   537
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   538
     * @param root Root of the program structure.
06bc494ca11e Initial load
duke
parents:
diff changeset
   539
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   540
    protected void setTopFile(RootDoc root) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   541
        if (!checkForDeprecation(root)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   542
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   543
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   544
        if (createoverview) {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14259
diff changeset
   545
            topFile = DocPaths.OVERVIEW_SUMMARY;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   546
        } else {
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 23968
diff changeset
   547
            if (packages.size() == 1 && packages.first().name().equals("")) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   548
                if (root.classes().length > 0) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   549
                    ClassDoc[] classarr = root.classes();
06bc494ca11e Initial load
duke
parents:
diff changeset
   550
                    Arrays.sort(classarr);
06bc494ca11e Initial load
duke
parents:
diff changeset
   551
                    ClassDoc cd = getValidClass(classarr);
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14259
diff changeset
   552
                    topFile = DocPath.forClass(cd);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   553
                }
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 23968
diff changeset
   554
            } else if (!packages.isEmpty()) {
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 23968
diff changeset
   555
                topFile = DocPath.forPackage(packages.first()).resolve(DocPaths.PACKAGE_SUMMARY);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   556
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   557
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   558
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   559
06bc494ca11e Initial load
duke
parents:
diff changeset
   560
    protected ClassDoc getValidClass(ClassDoc[] classarr) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   561
        if (!nodeprecated) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   562
            return classarr[0];
06bc494ca11e Initial load
duke
parents:
diff changeset
   563
        }
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   564
        for (ClassDoc cd : classarr) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   565
            if (cd.tags("deprecated").length == 0) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   566
                return cd;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   567
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   568
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   569
        return null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   570
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   571
06bc494ca11e Initial load
duke
parents:
diff changeset
   572
    protected boolean checkForDeprecation(RootDoc root) {
22159
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   573
        for (ClassDoc cd : root.classes()) {
682da512ec17 8030253: Update langtools to use strings-in-switch
briangoetz
parents: 22153
diff changeset
   574
            if (isGeneratedDoc(cd)) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   575
                return true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   576
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   577
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   578
        return false;
06bc494ca11e Initial load
duke
parents:
diff changeset
   579
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   580
06bc494ca11e Initial load
duke
parents:
diff changeset
   581
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   582
     * Generate "overview.html" page if option "-overview" is used or number of
06bc494ca11e Initial load
duke
parents:
diff changeset
   583
     * packages is more than one. Sets {@link #createoverview} field to true.
06bc494ca11e Initial load
duke
parents:
diff changeset
   584
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   585
    protected void setCreateOverview() {
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 23968
diff changeset
   586
        if ((overview || packages.size() > 1) && !nooverview) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   587
            createoverview = true;
06bc494ca11e Initial load
duke
parents:
diff changeset
   588
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   589
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   590
06bc494ca11e Initial load
duke
parents:
diff changeset
   591
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   592
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   593
     */
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   594
    @Override
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   595
    public WriterFactory getWriterFactory() {
1475
19c0851667ca 6748541: javadoc should be reusable
jjg
parents: 1264
diff changeset
   596
        return new WriterFactoryImpl(this);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   597
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   598
06bc494ca11e Initial load
duke
parents:
diff changeset
   599
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   600
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   601
     */
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   602
    @Override
868
d0f233085cbb 6657907: javadoc has unchecked warnings
jjg
parents: 10
diff changeset
   603
    public Comparator<ProgramElementDoc> getMemberComparator() {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   604
        return null;
06bc494ca11e Initial load
duke
parents:
diff changeset
   605
    }
1863
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1475
diff changeset
   606
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1475
diff changeset
   607
    /**
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1475
diff changeset
   608
     * {@inheritDoc}
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1475
diff changeset
   609
     */
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   610
    @Override
1863
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1475
diff changeset
   611
    public Locale getLocale() {
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   612
        if (root instanceof RootDocImpl)
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   613
            return ((RootDocImpl)root).getLocale();
1863
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1475
diff changeset
   614
        else
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1475
diff changeset
   615
            return Locale.getDefault();
e5de9abc0eb1 6786682: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - HTML tag should have lang attribute
bpatel
parents: 1475
diff changeset
   616
    }
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   617
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   618
    /**
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   619
     * {@inheritDoc}
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   620
     */
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   621
    @Override
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   622
    public JavaFileManager getFileManager() {
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   623
        if (fileManager == null) {
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   624
            if (root instanceof RootDocImpl)
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   625
                fileManager = ((RootDocImpl) root).getFileManager();
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   626
            else
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   627
                fileManager = new JavacFileManager(new Context(), false, null);
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   628
        }
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   629
        return fileManager;
14544
d71d992cb905 8002079: update DocFile to use a JavaFileManager
jjg
parents: 14542
diff changeset
   630
    }
14545
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   631
2e7bab0639b8 6493690: javadoc should have a javax.tools.Tool service provider installed in tools.jar
jjg
parents: 14544
diff changeset
   632
    private JavaFileManager fileManager;
15354
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   633
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   634
    @Override
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   635
    public boolean showMessage(SourcePosition pos, String key) {
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   636
        if (root instanceof RootDocImpl) {
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   637
            return pos == null || ((RootDocImpl) root).showTagMessages();
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   638
        }
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   639
        return true;
52a04c670c05 8004834: Add doclint support into javadoc
jjg
parents: 14545
diff changeset
   640
    }
17563
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 15354
diff changeset
   641
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 15354
diff changeset
   642
    @Override
17570
78512b2899db 8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents: 17563
diff changeset
   643
    public Content newContent() {
17563
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 15354
diff changeset
   644
        return new ContentBuilder();
e8ddeb9bd17c 8011668: Allow HTMLWriter.getResource to take Content args
jjg
parents: 15354
diff changeset
   645
    }
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   646
36526
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33920
diff changeset
   647
    @Override
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33920
diff changeset
   648
    public Location getLocationForPackage(PackageDoc pd) {
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33920
diff changeset
   649
        JavaFileManager fm = getFileManager();
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33920
diff changeset
   650
        return StandardLocation.SOURCE_PATH;
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33920
diff changeset
   651
    }
3b41f1c69604 8142968: Module System implementation
alanb
parents: 33920
diff changeset
   652
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   653
    protected void buildSearchTagIndex() {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   654
        for (SearchIndexItem sii : tagSearchIndex) {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   655
            String tagLabel = sii.getLabel();
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   656
            char ch = (tagLabel.length() == 0)
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   657
                    ? '*'
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   658
                    : Character.toUpperCase(tagLabel.charAt(0));
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   659
            Character unicode = ch;
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   660
            List<SearchIndexItem> list = tagSearchIndexMap.get(unicode);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   661
            if (list == null) {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   662
                list = new ArrayList<>();
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   663
                tagSearchIndexMap.put(unicode, list);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   664
            }
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   665
            list.add(sii);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   666
        }
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   667
        tagSearchIndexKeys = tagSearchIndexMap.keySet();
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 31752
diff changeset
   668
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   669
}