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