src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java

Wed, 13 Apr 2011 11:35:43 -0700

author
jjh
date
Wed, 13 Apr 2011 11:35:43 -0700
changeset 972
694ff82ca68e
parent 554
9d9f26857129
child 995
62bc3775d5bb
permissions
-rw-r--r--

7032975: API files in javax.annotation.processing need to be updated for references to JLS
7032972: API files in javax.tools need to updated for references to JVM Spec with editions/hyperlinks
7032978: API files in javax.tools need to be updated for references to JLS with editions/hyperlinks
Summary: Removed URLs and 'edition' references
Reviewed-by: jjg, darcy

     1 /*
     2  * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    24  */
    26 package com.sun.tools.doclets.internal.toolkit.util;
    28 import com.sun.tools.doclets.internal.toolkit.*;
    29 import com.sun.javadoc.*;
    30 import java.io.*;
    31 import java.util.*;
    33 /**
    34  * Write out the package index.
    35  *
    36  * This code is not part of an API.
    37  * It is implementation that is subject to change.
    38  * Do not use it as an API
    39  *
    40  * @see com.sun.javadoc.PackageDoc
    41  * @author Atul M Dambalkar
    42  */
    43 public class PackageListWriter extends PrintWriter {
    45     private Configuration configuration;
    47     /**
    48      * Constructor.
    49      *
    50      * @param configuration the current configuration of the doclet.
    51      */
    52     public PackageListWriter(Configuration configuration) throws IOException {
    53         super(Util.genWriter(configuration, configuration.destDirName,
    54             DocletConstants.PACKAGE_LIST_FILE_NAME, configuration.docencoding));
    55         this.configuration = configuration;
    56     }
    58     /**
    59      * Generate the package index.
    60      *
    61      * @param configuration the current configuration of the doclet.
    62      * @throws DocletAbortException
    63      */
    64     public static void generate(Configuration configuration) {
    65         PackageListWriter packgen;
    66         try {
    67             packgen = new PackageListWriter(configuration);
    68             packgen.generatePackageListFile(configuration.root);
    69             packgen.close();
    70         } catch (IOException exc) {
    71             configuration.message.error("doclet.exception_encountered",
    72                 exc.toString(), DocletConstants.PACKAGE_LIST_FILE_NAME);
    73             throw new DocletAbortException();
    74         }
    75     }
    77     protected void generatePackageListFile(RootDoc root) {
    78         PackageDoc[] packages = configuration.packages;
    79         String[] names = new String[packages.length];
    80         for (int i = 0; i < packages.length; i++) {
    81             names[i] = packages[i].name();
    82         }
    83         Arrays.sort(names);
    84         for (int i = 0; i < packages.length; i++) {
    85             println(names[i]);
    86         }
    87     }
    88 }

mercurial