langtools/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDoclet.java
author bpatel
Fri, 20 Nov 2015 20:55:07 +0000
changeset 33920 bd731341c405
parent 26269 0d8efbb110b4
child 34752 9c262a013456
permissions -rw-r--r--
8141492: Implement search feature in javadoc Reviewed-by: jjg, ksrini
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
     2
 * Copyright (c) 1997, 2014, 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: 1652
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: 1652
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: 1652
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1652
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1652
diff changeset
    23
 * questions.
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
package com.sun.tools.doclets.formats.html;
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
14258
8d2148961366 8000663: clean up langtools imports
jjg
parents: 9894
diff changeset
    27
import java.io.*;
8d2148961366 8000663: clean up langtools imports
jjg
parents: 9894
diff changeset
    28
import java.util.*;
8d2148961366 8000663: clean up langtools imports
jjg
parents: 9894
diff changeset
    29
8d2148961366 8000663: clean up langtools imports
jjg
parents: 9894
diff changeset
    30
import com.sun.javadoc.*;
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
    31
import com.sun.tools.javac.jvm.Profile;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
import com.sun.tools.doclets.internal.toolkit.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
import com.sun.tools.doclets.internal.toolkit.builders.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
import com.sun.tools.doclets.internal.toolkit.util.*;
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
/**
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
 * The class with "start" method, calls individual Writers.
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
 *
14260
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    39
 *  <p><b>This is NOT part of any supported API.
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    40
 *  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
    41
 *  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
    42
 *  deletion without notice.</b>
727a84636f12 8000665: fix "internal API" comments on javadoc files
jjg
parents: 14258
diff changeset
    43
 *
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    44
 * @author Atul M Dambalkar
06bc494ca11e Initial load
duke
parents:
diff changeset
    45
 * @author Robert Field
06bc494ca11e Initial load
duke
parents:
diff changeset
    46
 * @author Jamie Ho
06bc494ca11e Initial load
duke
parents:
diff changeset
    47
 *
06bc494ca11e Initial load
duke
parents:
diff changeset
    48
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
    49
public class HtmlDoclet extends AbstractDoclet {
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
    50
    // An instance will be created by validOptions, and used by start.
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
    51
    private static HtmlDoclet docletToStart = null;
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
    52
1475
19c0851667ca 6748541: javadoc should be reusable
jjg
parents: 10
diff changeset
    53
    public HtmlDoclet() {
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
    54
        configuration = new ConfigurationImpl();
1475
19c0851667ca 6748541: javadoc should be reusable
jjg
parents: 10
diff changeset
    55
    }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    56
06bc494ca11e Initial load
duke
parents:
diff changeset
    57
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    58
     * The global configuration information for this run.
06bc494ca11e Initial load
duke
parents:
diff changeset
    59
     */
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
    60
    public final ConfigurationImpl configuration;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    61
06bc494ca11e Initial load
duke
parents:
diff changeset
    62
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    63
     * The "start" method as required by Javadoc.
06bc494ca11e Initial load
duke
parents:
diff changeset
    64
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    65
     * @param root the root of the documentation tree.
06bc494ca11e Initial load
duke
parents:
diff changeset
    66
     * @see com.sun.javadoc.RootDoc
06bc494ca11e Initial load
duke
parents:
diff changeset
    67
     * @return true if the doclet ran without encountering any errors.
06bc494ca11e Initial load
duke
parents:
diff changeset
    68
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    69
    public static boolean start(RootDoc root) {
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
    70
        // In typical use, options will have been set up by calling validOptions,
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
    71
        // which will create an HtmlDoclet for use here.
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
    72
        HtmlDoclet doclet;
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
    73
        if (docletToStart != null) {
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
    74
            doclet = docletToStart;
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
    75
            docletToStart = null;
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
    76
        } else {
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
    77
            doclet = new HtmlDoclet();
1475
19c0851667ca 6748541: javadoc should be reusable
jjg
parents: 10
diff changeset
    78
        }
26269
0d8efbb110b4 8054925: [javadoc] refactor the Doclet start method.
ksrini
parents: 25874
diff changeset
    79
        return doclet.startDoclet(root);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    80
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    81
06bc494ca11e Initial load
duke
parents:
diff changeset
    82
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    83
     * Create the configuration instance.
06bc494ca11e Initial load
duke
parents:
diff changeset
    84
     * Override this method to use a different
06bc494ca11e Initial load
duke
parents:
diff changeset
    85
     * configuration.
06bc494ca11e Initial load
duke
parents:
diff changeset
    86
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
    87
    public Configuration configuration() {
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
    88
        return configuration;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
    89
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    90
06bc494ca11e Initial load
duke
parents:
diff changeset
    91
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
    92
     * Start the generation of files. Call generate methods in the individual
06bc494ca11e Initial load
duke
parents:
diff changeset
    93
     * writers, which will in turn genrate the documentation files. Call the
06bc494ca11e Initial load
duke
parents:
diff changeset
    94
     * TreeWriter generation first to ensure the Class Hierarchy is built
06bc494ca11e Initial load
duke
parents:
diff changeset
    95
     * first and then can be used in the later generation.
06bc494ca11e Initial load
duke
parents:
diff changeset
    96
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    97
     * For new format.
06bc494ca11e Initial load
duke
parents:
diff changeset
    98
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
    99
     * @see com.sun.javadoc.RootDoc
06bc494ca11e Initial load
duke
parents:
diff changeset
   100
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   101
    protected void generateOtherFiles(RootDoc root, ClassTree classtree)
06bc494ca11e Initial load
duke
parents:
diff changeset
   102
            throws Exception {
06bc494ca11e Initial load
duke
parents:
diff changeset
   103
        super.generateOtherFiles(root, classtree);
06bc494ca11e Initial load
duke
parents:
diff changeset
   104
        if (configuration.linksource) {
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14260
diff changeset
   105
            SourceToHTMLConverter.convertRoot(configuration,
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14260
diff changeset
   106
                root, DocPaths.SOURCE_OUTPUT);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   107
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   108
14357
faf9cde2817b 8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents: 14260
diff changeset
   109
        if (configuration.topFile.isEmpty()) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   110
            configuration.standardmessage.
06bc494ca11e Initial load
duke
parents:
diff changeset
   111
                error("doclet.No_Non_Deprecated_Classes_To_Document");
06bc494ca11e Initial load
duke
parents:
diff changeset
   112
            return;
06bc494ca11e Initial load
duke
parents:
diff changeset
   113
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   114
        boolean nodeprecated = configuration.nodeprecated;
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
   115
        performCopy(configuration.helpfile);
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
   116
        performCopy(configuration.stylesheetfile);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   117
        // do early to reduce memory footprint
06bc494ca11e Initial load
duke
parents:
diff changeset
   118
        if (configuration.classuse) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   119
            ClassUseWriter.generate(configuration, classtree);
06bc494ca11e Initial load
duke
parents:
diff changeset
   120
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   121
        IndexBuilder indexbuilder = new IndexBuilder(configuration, nodeprecated);
06bc494ca11e Initial load
duke
parents:
diff changeset
   122
06bc494ca11e Initial load
duke
parents:
diff changeset
   123
        if (configuration.createtree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   124
            TreeWriter.generate(configuration, classtree);
06bc494ca11e Initial load
duke
parents:
diff changeset
   125
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   126
        if (configuration.createindex) {
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   127
            configuration.buildSearchTagIndex();
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   128
            if (configuration.splitindex) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   129
                SplitIndexWriter.generate(configuration, indexbuilder);
06bc494ca11e Initial load
duke
parents:
diff changeset
   130
            } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   131
                SingleIndexWriter.generate(configuration, indexbuilder);
06bc494ca11e Initial load
duke
parents:
diff changeset
   132
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   133
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   134
06bc494ca11e Initial load
duke
parents:
diff changeset
   135
        if (!(configuration.nodeprecatedlist || nodeprecated)) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   136
            DeprecatedListWriter.generate(configuration);
06bc494ca11e Initial load
duke
parents:
diff changeset
   137
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   138
06bc494ca11e Initial load
duke
parents:
diff changeset
   139
        AllClassesFrameWriter.generate(configuration,
06bc494ca11e Initial load
duke
parents:
diff changeset
   140
            new IndexBuilder(configuration, nodeprecated, true));
06bc494ca11e Initial load
duke
parents:
diff changeset
   141
06bc494ca11e Initial load
duke
parents:
diff changeset
   142
        FrameOutputWriter.generate(configuration);
06bc494ca11e Initial load
duke
parents:
diff changeset
   143
06bc494ca11e Initial load
duke
parents:
diff changeset
   144
        if (configuration.createoverview) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   145
            PackageIndexWriter.generate(configuration);
06bc494ca11e Initial load
duke
parents:
diff changeset
   146
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   147
        if (configuration.helpfile.length() == 0 &&
06bc494ca11e Initial load
duke
parents:
diff changeset
   148
            !configuration.nohelp) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   149
            HelpWriter.generate(configuration);
06bc494ca11e Initial load
duke
parents:
diff changeset
   150
        }
7641
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   151
        // If a stylesheet file is not specified, copy the default stylesheet
8b552db25f99 7006270: Several javadoc regression tests are failing on windows
bpatel
parents: 7614
diff changeset
   152
        // and replace newline with platform-specific newline.
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14542
diff changeset
   153
        DocFile f;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   154
        if (configuration.stylesheetfile.length() == 0) {
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14542
diff changeset
   155
            f = DocFile.createFileForOutput(configuration, DocPaths.STYLESHEET);
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
   156
            f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.STYLESHEET), false, true);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   157
        }
14549
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14542
diff changeset
   158
        f = DocFile.createFileForOutput(configuration, DocPaths.JAVASCRIPT);
0599d73bf1da 8002304: Group methods by types in methods summary section
bpatel
parents: 14542
diff changeset
   159
        f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.JAVASCRIPT), true, true);
33920
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   160
        if (configuration.createindex) {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   161
            f = DocFile.createFileForOutput(configuration, DocPaths.SEARCH_JS);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   162
            f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.SEARCH_JS), true, true);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   163
            f = DocFile.createFileForOutput(configuration, DocPaths.RESOURCES.resolve(DocPaths.GLASS_IMG));
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   164
            f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.GLASS_IMG), true, false);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   165
            f = DocFile.createFileForOutput(configuration, DocPaths.RESOURCES.resolve(DocPaths.X_IMG));
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   166
            f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.X_IMG), true, false);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   167
            copyJqueryFiles();
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   168
        }
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   169
    }
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   170
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   171
    protected void copyJqueryFiles() {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   172
        List<String> files = Arrays.asList(
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   173
                "jquery-1.10.2.js",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   174
                "jquery-ui.js",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   175
                "jquery-ui.css",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   176
                "jquery-ui.min.js",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   177
                "jquery-ui.min.css",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   178
                "jquery-ui.structure.min.css",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   179
                "jquery-ui.structure.css",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   180
                "external/jquery/jquery.js",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   181
                "jszip/dist/jszip.js",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   182
                "jszip/dist/jszip.min.js",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   183
                "jszip-utils/dist/jszip-utils.js",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   184
                "jszip-utils/dist/jszip-utils.min.js",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   185
                "jszip-utils/dist/jszip-utils-ie.js",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   186
                "jszip-utils/dist/jszip-utils-ie.min.js",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   187
                "images/ui-bg_flat_0_aaaaaa_40x100.png",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   188
                "images/ui-icons_454545_256x240.png",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   189
                "images/ui-bg_glass_95_fef1ec_1x400.png",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   190
                "images/ui-bg_glass_75_dadada_1x400.png",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   191
                "images/ui-bg_highlight-soft_75_cccccc_1x100.png",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   192
                "images/ui-icons_888888_256x240.png",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   193
                "images/ui-icons_2e83ff_256x240.png",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   194
                "images/ui-bg_glass_65_ffffff_1x400.png",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   195
                "images/ui-icons_cd0a0a_256x240.png",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   196
                "images/ui-bg_glass_55_fbf9ee_1x400.png",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   197
                "images/ui-icons_222222_256x240.png",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   198
                "images/ui-bg_glass_75_e6e6e6_1x400.png",
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   199
                "images/ui-bg_flat_75_ffffff_40x100.png");
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   200
        DocFile f;
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   201
        for (String file : files) {
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   202
            DocPath filePath = DocPaths.JQUERY_FILES.resolve(file);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   203
            f = DocFile.createFileForOutput(configuration, filePath);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   204
            f.copyResource(DocPaths.RESOURCES.resolve(filePath), true, false);
bd731341c405 8141492: Implement search feature in javadoc
bpatel
parents: 26269
diff changeset
   205
        }
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   206
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   207
06bc494ca11e Initial load
duke
parents:
diff changeset
   208
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   209
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   210
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   211
    protected void generateClassFiles(ClassDoc[] arr, ClassTree classtree) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   212
        Arrays.sort(arr);
06bc494ca11e Initial load
duke
parents:
diff changeset
   213
        for(int i = 0; i < arr.length; i++) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   214
            if (!(configuration.isGeneratedDoc(arr[i]) && arr[i].isIncluded())) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   215
                continue;
06bc494ca11e Initial load
duke
parents:
diff changeset
   216
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   217
            ClassDoc prev = (i == 0)?
06bc494ca11e Initial load
duke
parents:
diff changeset
   218
                null:
06bc494ca11e Initial load
duke
parents:
diff changeset
   219
                arr[i-1];
06bc494ca11e Initial load
duke
parents:
diff changeset
   220
            ClassDoc curr = arr[i];
06bc494ca11e Initial load
duke
parents:
diff changeset
   221
            ClassDoc next = (i+1 == arr.length)?
06bc494ca11e Initial load
duke
parents:
diff changeset
   222
                null:
06bc494ca11e Initial load
duke
parents:
diff changeset
   223
                arr[i+1];
06bc494ca11e Initial load
duke
parents:
diff changeset
   224
            try {
06bc494ca11e Initial load
duke
parents:
diff changeset
   225
                if (curr.isAnnotationType()) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   226
                    AbstractBuilder annotationTypeBuilder =
06bc494ca11e Initial load
duke
parents:
diff changeset
   227
                        configuration.getBuilderFactory()
06bc494ca11e Initial load
duke
parents:
diff changeset
   228
                            .getAnnotationTypeBuilder((AnnotationTypeDoc) curr,
06bc494ca11e Initial load
duke
parents:
diff changeset
   229
                                prev, next);
06bc494ca11e Initial load
duke
parents:
diff changeset
   230
                    annotationTypeBuilder.build();
06bc494ca11e Initial load
duke
parents:
diff changeset
   231
                } else {
06bc494ca11e Initial load
duke
parents:
diff changeset
   232
                    AbstractBuilder classBuilder =
06bc494ca11e Initial load
duke
parents:
diff changeset
   233
                        configuration.getBuilderFactory()
06bc494ca11e Initial load
duke
parents:
diff changeset
   234
                            .getClassBuilder(curr, prev, next, classtree);
06bc494ca11e Initial load
duke
parents:
diff changeset
   235
                    classBuilder.build();
06bc494ca11e Initial load
duke
parents:
diff changeset
   236
                }
20600
052970964bc1 6978886: javadoc shows stacktrace after print error resulting from disk full
kizune
parents: 19937
diff changeset
   237
            } catch (IOException e) {
052970964bc1 6978886: javadoc shows stacktrace after print error resulting from disk full
kizune
parents: 19937
diff changeset
   238
                throw new DocletAbortException(e);
052970964bc1 6978886: javadoc shows stacktrace after print error resulting from disk full
kizune
parents: 19937
diff changeset
   239
            } catch (DocletAbortException de) {
052970964bc1 6978886: javadoc shows stacktrace after print error resulting from disk full
kizune
parents: 19937
diff changeset
   240
                throw de;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   241
            } catch (Exception e) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   242
                e.printStackTrace();
19667
fdfce85627a9 8001669: javadoc internal DocletAbortException should set cause when appropriate
jjg
parents: 15723
diff changeset
   243
                throw new DocletAbortException(e);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   244
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   245
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   246
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   247
06bc494ca11e Initial load
duke
parents:
diff changeset
   248
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   249
     * {@inheritDoc}
06bc494ca11e Initial load
duke
parents:
diff changeset
   250
     */
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   251
    protected void generateProfileFiles() throws Exception {
19937
7dacecdfbad4 8015496: Information that package is deprecated is missing in profiles view
bpatel
parents: 19667
diff changeset
   252
        if (configuration.showProfiles && configuration.profilePackages.size() > 0) {
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   253
            ProfileIndexFrameWriter.generate(configuration);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   254
            Profile prevProfile = null, nextProfile;
19937
7dacecdfbad4 8015496: Information that package is deprecated is missing in profiles view
bpatel
parents: 19667
diff changeset
   255
            String profileName;
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   256
            for (int i = 1; i < configuration.profiles.getProfileCount(); i++) {
19937
7dacecdfbad4 8015496: Information that package is deprecated is missing in profiles view
bpatel
parents: 19667
diff changeset
   257
                profileName = Profile.lookup(i).name;
7dacecdfbad4 8015496: Information that package is deprecated is missing in profiles view
bpatel
parents: 19667
diff changeset
   258
                // Generate profile package pages only if there are any packages
7dacecdfbad4 8015496: Information that package is deprecated is missing in profiles view
bpatel
parents: 19667
diff changeset
   259
                // in a profile to be documented. The profilePackages map will not
7dacecdfbad4 8015496: Information that package is deprecated is missing in profiles view
bpatel
parents: 19667
diff changeset
   260
                // contain an entry for the profile if there are no packages to be documented.
7dacecdfbad4 8015496: Information that package is deprecated is missing in profiles view
bpatel
parents: 19667
diff changeset
   261
                if (!configuration.shouldDocumentProfile(profileName))
7dacecdfbad4 8015496: Information that package is deprecated is missing in profiles view
bpatel
parents: 19667
diff changeset
   262
                    continue;
7dacecdfbad4 8015496: Information that package is deprecated is missing in profiles view
bpatel
parents: 19667
diff changeset
   263
                ProfilePackageIndexFrameWriter.generate(configuration, profileName);
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   264
                List<PackageDoc> packages = configuration.profilePackages.get(
19937
7dacecdfbad4 8015496: Information that package is deprecated is missing in profiles view
bpatel
parents: 19667
diff changeset
   265
                        profileName);
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   266
                PackageDoc prev = null, next;
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   267
                for (int j = 0; j < packages.size(); j++) {
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   268
                    // if -nodeprecated option is set and the package is marked as
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   269
                    // deprecated, do not generate the profilename-package-summary.html
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   270
                    // and profilename-package-frame.html pages for that package.
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   271
                    PackageDoc pkg = packages.get(j);
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24221
diff changeset
   272
                    if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   273
                        ProfilePackageFrameWriter.generate(configuration, pkg, i);
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   274
                        next = getNamedPackage(packages, j + 1);
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   275
                        AbstractBuilder profilePackageSummaryBuilder =
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   276
                                configuration.getBuilderFactory().getProfilePackageSummaryBuilder(
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   277
                                pkg, prev, next, Profile.lookup(i));
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   278
                        profilePackageSummaryBuilder.build();
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   279
                        prev = pkg;
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   280
                    }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   281
                }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   282
                nextProfile = (i + 1 < configuration.profiles.getProfileCount()) ?
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   283
                        Profile.lookup(i + 1) : null;
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   284
                AbstractBuilder profileSummaryBuilder =
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   285
                        configuration.getBuilderFactory().getProfileSummaryBuilder(
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   286
                        Profile.lookup(i), prevProfile, nextProfile);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   287
                profileSummaryBuilder.build();
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   288
                prevProfile = Profile.lookup(i);
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   289
            }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   290
        }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   291
    }
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   292
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   293
    PackageDoc getNamedPackage(List<PackageDoc> list, int idx) {
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   294
        if (idx < list.size()) {
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   295
            PackageDoc pkg = list.get(idx);
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   296
            if (!pkg.name().isEmpty()) {
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   297
                return pkg;
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   298
            }
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   299
        }
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   300
        return null;
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   301
    }
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   302
15723
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   303
    /**
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   304
     * {@inheritDoc}
58a73dac9ee4 8006124: javadoc/doclet should be updated to support profiles
bpatel
parents: 14549
diff changeset
   305
     */
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   306
    protected void generatePackageFiles(ClassTree classtree) throws Exception {
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   307
        Set<PackageDoc> packages = configuration.packages;
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   308
        if (packages.size() > 1) {
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   309
            PackageIndexFrameWriter.generate(configuration);
06bc494ca11e Initial load
duke
parents:
diff changeset
   310
        }
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   311
        List<PackageDoc> pList = new ArrayList<>(configuration.packages);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   312
        PackageDoc prev = null, next;
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   313
        for (int i = 0; i < pList.size(); i++) {
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
   314
            // if -nodeprecated option is set and the package is marked as
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
   315
            // deprecated, do not generate the package-summary.html, package-frame.html
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
   316
            // and package-tree.html pages for that package.
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   317
            PackageDoc pkg = pList.get(i);
25454
376a52c9540c 8039028: [javadoc] refactor the usage of Util.java
ksrini
parents: 24221
diff changeset
   318
            if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   319
                PackageFrameWriter.generate(configuration, pkg);
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   320
                next = getNamedPackage(pList, i + 1);
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
   321
                //If the next package is unnamed package, skip 2 ahead if possible
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   322
                if (next == null)
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   323
                    next = getNamedPackage(pList, i + 2);
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
   324
                AbstractBuilder packageSummaryBuilder =
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
   325
                        configuration.getBuilderFactory().getPackageSummaryBuilder(
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   326
                        pkg, prev, next);
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
   327
                packageSummaryBuilder.build();
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
   328
                if (configuration.createtree) {
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
   329
                    PackageTreeWriter.generate(configuration,
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   330
                            pkg, prev, next,
9606
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
   331
                            configuration.nodeprecated);
e5a619cb5dd3 6492694: @deprecated tag doesn't work in package-info files.
bpatel
parents: 7681
diff changeset
   332
                }
24221
2376793dd33b 8038583: [javadoc] Refactor uses of arrays to Collections
ksrini
parents: 22447
diff changeset
   333
                prev = pkg;
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   334
            }
06bc494ca11e Initial load
duke
parents:
diff changeset
   335
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   336
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   337
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   338
    public static final ConfigurationImpl sharedInstanceForOptions =
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   339
            new ConfigurationImpl();
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   340
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   341
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   342
     * Check for doclet added options here.
06bc494ca11e Initial load
duke
parents:
diff changeset
   343
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   344
     * @return number of arguments to option. Zero return means
06bc494ca11e Initial load
duke
parents:
diff changeset
   345
     * option not known.  Negative value means error occurred.
06bc494ca11e Initial load
duke
parents:
diff changeset
   346
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   347
    public static int optionLength(String option) {
06bc494ca11e Initial load
duke
parents:
diff changeset
   348
        // Construct temporary configuration for check
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   349
        return sharedInstanceForOptions.optionLength(option);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   350
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   351
06bc494ca11e Initial load
duke
parents:
diff changeset
   352
    /**
06bc494ca11e Initial load
duke
parents:
diff changeset
   353
     * Check that options have the correct arguments here.
06bc494ca11e Initial load
duke
parents:
diff changeset
   354
     * <P>
06bc494ca11e Initial load
duke
parents:
diff changeset
   355
     * This method is not required and will default gracefully
06bc494ca11e Initial load
duke
parents:
diff changeset
   356
     * (to true) if absent.
06bc494ca11e Initial load
duke
parents:
diff changeset
   357
     * <P>
06bc494ca11e Initial load
duke
parents:
diff changeset
   358
     * Printing option related error messages (using the provided
06bc494ca11e Initial load
duke
parents:
diff changeset
   359
     * DocErrorReporter) is the responsibility of this method.
06bc494ca11e Initial load
duke
parents:
diff changeset
   360
     *
06bc494ca11e Initial load
duke
parents:
diff changeset
   361
     * @return true if the options are valid.
06bc494ca11e Initial load
duke
parents:
diff changeset
   362
     */
06bc494ca11e Initial load
duke
parents:
diff changeset
   363
    public static boolean validOptions(String options[][],
06bc494ca11e Initial load
duke
parents:
diff changeset
   364
            DocErrorReporter reporter) {
14542
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   365
        docletToStart = new HtmlDoclet();
7062120649c2 8000800: javadoc uses static non-final fields
jjg
parents: 14368
diff changeset
   366
        return docletToStart.configuration.validOptions(options, reporter);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   367
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   368
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
   369
    private void performCopy(String filename) {
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
   370
        if (filename.isEmpty())
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
   371
            return;
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
   372
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   373
        try {
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
   374
            DocFile fromfile = DocFile.createFileForInput(configuration, filename);
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
   375
            DocPath path = DocPath.create(fromfile.getName());
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
   376
            DocFile toFile = DocFile.createFileForOutput(configuration, path);
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
   377
            if (toFile.isSameFile(fromfile))
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
   378
                return;
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
   379
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
   380
            configuration.message.notice((SourcePosition) null,
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
   381
                    "doclet.Copying_File_0_To_File_1",
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
   382
                    fromfile.toString(), path.getPath());
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
   383
            toFile.copyFile(fromfile);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   384
        } catch (IOException exc) {
14368
6f4c62de6985 8001664: refactor javadoc to use abstraction to handle files
jjg
parents: 14357
diff changeset
   385
            configuration.message.error((SourcePosition) null,
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   386
                    "doclet.perform_copy_exception_encountered",
06bc494ca11e Initial load
duke
parents:
diff changeset
   387
                    exc.toString());
19667
fdfce85627a9 8001669: javadoc internal DocletAbortException should set cause when appropriate
jjg
parents: 15723
diff changeset
   388
            throw new DocletAbortException(exc);
10
06bc494ca11e Initial load
duke
parents:
diff changeset
   389
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
   390
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
   391
}