src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java

Print this page


   1 /*
   2  * Copyright (c) 1997, 2014, 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  */
  25 
  26 package com.sun.tools.doclets.formats.html;
  27 
  28 import java.io.*;
  29 import java.util.*;
  30 
  31 import com.sun.javadoc.*;
  32 import com.sun.tools.javac.jvm.Profile;
  33 import com.sun.tools.doclets.internal.toolkit.*;
  34 import com.sun.tools.doclets.internal.toolkit.builders.*;
  35 import com.sun.tools.doclets.internal.toolkit.util.*;
  36 













  37 /**
  38  * The class with "start" method, calls individual Writers.
  39  *
  40  *  <p><b>This is NOT part of any supported API.
  41  *  If you write code that depends on this, you do so at your own risk.
  42  *  This code and its internal interfaces are subject to change or
  43  *  deletion without notice.</b>
  44  *
  45  * @author Atul M Dambalkar
  46  * @author Robert Field
  47  * @author Jamie Ho
  48  *
  49  */
  50 public class HtmlDoclet extends AbstractDoclet {
  51     // An instance will be created by validOptions, and used by start.
  52     private static HtmlDoclet docletToStart = null;
  53 
  54     public HtmlDoclet() {
  55         configuration = new ConfigurationImpl();
  56     }
  57 
  58     /**
  59      * The global configuration information for this run.
  60      */
  61     public final ConfigurationImpl configuration;
  62 





  63     /**
  64      * The "start" method as required by Javadoc.
  65      *
  66      * @param root the root of the documentation tree.
  67      * @see com.sun.javadoc.RootDoc
  68      * @return true if the doclet ran without encountering any errors.
  69      */
  70     public static boolean start(RootDoc root) {
  71         // In typical use, options will have been set up by calling validOptions,
  72         // which will create an HtmlDoclet for use here.
  73         HtmlDoclet doclet;
  74         if (docletToStart != null) {
  75             doclet = docletToStart;
  76             docletToStart = null;
  77         } else {
  78             doclet = new HtmlDoclet();
  79         }
  80         return doclet.startDoclet(root);
  81     }
  82 
  83     /**
  84      * Create the configuration instance.
  85      * Override this method to use a different
  86      * configuration.
  87      */
  88     public Configuration configuration() {
  89         return configuration;
  90     }
  91 
  92     /**
  93      * Start the generation of files. Call generate methods in the individual
  94      * writers, which will in turn genrate the documentation files. Call the
  95      * TreeWriter generation first to ensure the Class Hierarchy is built
  96      * first and then can be used in the later generation.
  97      *
  98      * For new format.
  99      *
 100      * @see com.sun.javadoc.RootDoc
 101      */
 102     protected void generateOtherFiles(RootDoc root, ClassTree classtree)
 103             throws Exception {
 104         super.generateOtherFiles(root, classtree);
 105         if (configuration.linksource) {
 106             SourceToHTMLConverter.convertRoot(configuration,
 107                 root, DocPaths.SOURCE_OUTPUT);
 108         }
 109 
 110         if (configuration.topFile.isEmpty()) {
 111             configuration.standardmessage.
 112                 error("doclet.No_Non_Deprecated_Classes_To_Document");
 113             return;
 114         }
 115         boolean nodeprecated = configuration.nodeprecated;
 116         performCopy(configuration.helpfile);
 117         performCopy(configuration.stylesheetfile);
 118         // do early to reduce memory footprint
 119         if (configuration.classuse) {
 120             ClassUseWriter.generate(configuration, classtree);
 121         }
 122         IndexBuilder indexbuilder = new IndexBuilder(configuration, nodeprecated);


 143         FrameOutputWriter.generate(configuration);
 144 
 145         if (configuration.createoverview) {
 146             PackageIndexWriter.generate(configuration);
 147         }
 148         if (configuration.helpfile.length() == 0 &&
 149             !configuration.nohelp) {
 150             HelpWriter.generate(configuration);
 151         }
 152         // If a stylesheet file is not specified, copy the default stylesheet
 153         // and replace newline with platform-specific newline.
 154         DocFile f;
 155         if (configuration.stylesheetfile.length() == 0) {
 156             f = DocFile.createFileForOutput(configuration, DocPaths.STYLESHEET);
 157             f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.STYLESHEET), false, true);
 158         }
 159         f = DocFile.createFileForOutput(configuration, DocPaths.JAVASCRIPT);
 160         f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.JAVASCRIPT), true, true);
 161         if (configuration.createindex) {
 162             f = DocFile.createFileForOutput(configuration, DocPaths.SEARCH_JS);
 163             f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.SEARCH_JS), true, true);

 164             f = DocFile.createFileForOutput(configuration, DocPaths.RESOURCES.resolve(DocPaths.GLASS_IMG));
 165             f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.GLASS_IMG), true, false);

 166             f = DocFile.createFileForOutput(configuration, DocPaths.RESOURCES.resolve(DocPaths.X_IMG));
 167             f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.X_IMG), true, false);
 168             copyJqueryFiles();
 169         }
 170     }
 171 
 172     protected void copyJqueryFiles() {
 173         List<String> files = Arrays.asList(
 174                 "jquery-1.10.2.js",
 175                 "jquery-ui.js",
 176                 "jquery-ui.css",
 177                 "jquery-ui.min.js",
 178                 "jquery-ui.min.css",
 179                 "jquery-ui.structure.min.css",
 180                 "jquery-ui.structure.css",
 181                 "external/jquery/jquery.js",
 182                 "jszip/dist/jszip.js",
 183                 "jszip/dist/jszip.min.js",
 184                 "jszip-utils/dist/jszip-utils.js",
 185                 "jszip-utils/dist/jszip-utils.min.js",
 186                 "jszip-utils/dist/jszip-utils-ie.js",
 187                 "jszip-utils/dist/jszip-utils-ie.min.js",
 188                 "images/ui-bg_flat_0_aaaaaa_40x100.png",
 189                 "images/ui-icons_454545_256x240.png",
 190                 "images/ui-bg_glass_95_fef1ec_1x400.png",
 191                 "images/ui-bg_glass_75_dadada_1x400.png",
 192                 "images/ui-bg_highlight-soft_75_cccccc_1x100.png",
 193                 "images/ui-icons_888888_256x240.png",
 194                 "images/ui-icons_2e83ff_256x240.png",
 195                 "images/ui-bg_glass_65_ffffff_1x400.png",
 196                 "images/ui-icons_cd0a0a_256x240.png",
 197                 "images/ui-bg_glass_55_fbf9ee_1x400.png",
 198                 "images/ui-icons_222222_256x240.png",
 199                 "images/ui-bg_glass_75_e6e6e6_1x400.png",
 200                 "images/ui-bg_flat_75_ffffff_40x100.png");
 201         DocFile f;
 202         for (String file : files) {
 203             DocPath filePath = DocPaths.JQUERY_FILES.resolve(file);
 204             f = DocFile.createFileForOutput(configuration, filePath);
 205             f.copyResource(DocPaths.RESOURCES.resolve(filePath), true, false);
 206         }
 207     }
 208 
 209     /**
 210      * {@inheritDoc}
 211      */
 212     protected void generateClassFiles(ClassDoc[] arr, ClassTree classtree) {
 213         Arrays.sort(arr);
 214         for(int i = 0; i < arr.length; i++) {
 215             if (!(configuration.isGeneratedDoc(arr[i]) && arr[i].isIncluded())) {






 216                 continue;
 217             }
 218             ClassDoc prev = (i == 0)?
 219                 null:
 220                 arr[i-1];
 221             ClassDoc curr = arr[i];
 222             ClassDoc next = (i+1 == arr.length)?
 223                 null:
 224                 arr[i+1];
 225             try {
 226                 if (curr.isAnnotationType()) {
 227                     AbstractBuilder annotationTypeBuilder =
 228                         configuration.getBuilderFactory()
 229                             .getAnnotationTypeBuilder((AnnotationTypeDoc) curr,
 230                                 prev, next);

 231                     annotationTypeBuilder.build();
 232                 } else {
 233                     AbstractBuilder classBuilder =
 234                         configuration.getBuilderFactory()
 235                             .getClassBuilder(curr, prev, next, classtree);
 236                     classBuilder.build();
 237                 }
 238             } catch (IOException e) {
 239                 throw new DocletAbortException(e);
 240             } catch (DocletAbortException de) {
 241                 throw de;
 242             } catch (Exception e) {
 243                 e.printStackTrace();
 244                 throw new DocletAbortException(e);
 245             }
 246         }
 247     }
 248 
 249     /**
 250      * {@inheritDoc}
 251      */
 252     protected void generateProfileFiles() throws Exception {
 253         if (configuration.showProfiles && configuration.profilePackages.size() > 0) {
 254             ProfileIndexFrameWriter.generate(configuration);
 255             Profile prevProfile = null, nextProfile;
 256             String profileName;
 257             for (int i = 1; i < configuration.profiles.getProfileCount(); i++) {
 258                 profileName = Profile.lookup(i).name;
 259                 // Generate profile package pages only if there are any packages
 260                 // in a profile to be documented. The profilePackages map will not
 261                 // contain an entry for the profile if there are no packages to be documented.
 262                 if (!configuration.shouldDocumentProfile(profileName))
 263                     continue;
 264                 ProfilePackageIndexFrameWriter.generate(configuration, profileName);
 265                 List<PackageDoc> packages = configuration.profilePackages.get(
 266                         profileName);
 267                 PackageDoc prev = null, next;
 268                 for (int j = 0; j < packages.size(); j++) {
 269                     // if -nodeprecated option is set and the package is marked as
 270                     // deprecated, do not generate the profilename-package-summary.html
 271                     // and profilename-package-frame.html pages for that package.
 272                     PackageDoc pkg = packages.get(j);
 273                     if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
 274                         ProfilePackageFrameWriter.generate(configuration, pkg, i);
 275                         next = getNamedPackage(packages, j + 1);
 276                         AbstractBuilder profilePackageSummaryBuilder =
 277                                 configuration.getBuilderFactory().getProfilePackageSummaryBuilder(
 278                                 pkg, prev, next, Profile.lookup(i));
 279                         profilePackageSummaryBuilder.build();
 280                         prev = pkg;
 281                     }
 282                 }
 283                 nextProfile = (i + 1 < configuration.profiles.getProfileCount()) ?
 284                         Profile.lookup(i + 1) : null;
 285                 AbstractBuilder profileSummaryBuilder =
 286                         configuration.getBuilderFactory().getProfileSummaryBuilder(
 287                         Profile.lookup(i), prevProfile, nextProfile);
 288                 profileSummaryBuilder.build();
 289                 prevProfile = Profile.lookup(i);
 290             }
 291         }
 292     }
 293 
 294     PackageDoc getNamedPackage(List<PackageDoc> list, int idx) {
 295         if (idx < list.size()) {
 296             PackageDoc pkg = list.get(idx);
 297             if (!pkg.name().isEmpty()) {
 298                 return pkg;
 299             }
 300         }
 301         return null;
 302     }
 303 
 304     /**
 305      * {@inheritDoc}
 306      */
 307     protected void generatePackageFiles(ClassTree classtree) throws Exception {
 308         Set<PackageDoc> packages = configuration.packages;
 309         if (packages.size() > 1) {
 310             PackageIndexFrameWriter.generate(configuration);
 311         }
 312         List<PackageDoc> pList = new ArrayList<>(configuration.packages);
 313         PackageDoc prev = null, next;
 314         for (int i = 0; i < pList.size(); i++) {
 315             // if -nodeprecated option is set and the package is marked as
 316             // deprecated, do not generate the package-summary.html, package-frame.html
 317             // and package-tree.html pages for that package.
 318             PackageDoc pkg = pList.get(i);
 319             if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
 320                 PackageFrameWriter.generate(configuration, pkg);
 321                 next = getNamedPackage(pList, i + 1);
 322                 //If the next package is unnamed package, skip 2 ahead if possible
 323                 if (next == null)
 324                     next = getNamedPackage(pList, i + 2);





 325                 AbstractBuilder packageSummaryBuilder =
 326                         configuration.getBuilderFactory().getPackageSummaryBuilder(
 327                         pkg, prev, next);
 328                 packageSummaryBuilder.build();
 329                 if (configuration.createtree) {
 330                     PackageTreeWriter.generate(configuration,
 331                             pkg, prev, next,
 332                             configuration.nodeprecated);
 333                 }
 334                 prev = pkg;
 335             }
 336         }
 337     }
 338 
 339     public static final ConfigurationImpl sharedInstanceForOptions =
 340             new ConfigurationImpl();
 341 
 342     /**
 343      * Check for doclet added options here.
 344      *
 345      * @return number of arguments to option. Zero return means
 346      * option not known.  Negative value means error occurred.
 347      */
 348     public static int optionLength(String option) {
 349         // Construct temporary configuration for check
 350         return sharedInstanceForOptions.optionLength(option);
 351     }
 352 
 353     /**
 354      * Check that options have the correct arguments here.
 355      * <P>
 356      * This method is not required and will default gracefully
 357      * (to true) if absent.
 358      * <P>
 359      * Printing option related error messages (using the provided
 360      * DocErrorReporter) is the responsibility of this method.
 361      *
 362      * @return true if the options are valid.
 363      */
 364     public static boolean validOptions(String options[][],
 365             DocErrorReporter reporter) {
 366         docletToStart = new HtmlDoclet();
 367         return docletToStart.configuration.validOptions(options, reporter);
 368     }
 369 
 370     private void performCopy(String filename) {
 371         if (filename.isEmpty())
 372             return;
 373 
 374         try {
 375             DocFile fromfile = DocFile.createFileForInput(configuration, filename);
 376             DocPath path = DocPath.create(fromfile.getName());
 377             DocFile toFile = DocFile.createFileForOutput(configuration, path);
 378             if (toFile.isSameFile(fromfile))
 379                 return;
 380 
 381             configuration.message.notice((SourcePosition) null,
 382                     "doclet.Copying_File_0_To_File_1",
 383                     fromfile.toString(), path.getPath());
 384             toFile.copyFile(fromfile);
 385         } catch (IOException exc) {
 386             configuration.message.error((SourcePosition) null,
 387                     "doclet.perform_copy_exception_encountered",
 388                     exc.toString());
 389             throw new DocletAbortException(exc);
 390         }
 391     }
 392 }
   1 /*
   2  * Copyright (c) 1997, 2016, 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  */
  25 
  26 package jdk.javadoc.internal.doclets.formats.html;
  27 
  28 import java.io.*;
  29 import java.util.*;
  30 
  31 import javax.lang.model.element.PackageElement;
  32 import javax.lang.model.element.TypeElement;



  33 
  34 import jdk.javadoc.doclet.Doclet.Option;
  35 import jdk.javadoc.doclet.DocletEnvironment;
  36 import jdk.javadoc.doclet.Reporter;
  37 import jdk.javadoc.internal.doclets.toolkit.AbstractDoclet;
  38 import jdk.javadoc.internal.doclets.toolkit.Configuration;
  39 import jdk.javadoc.internal.doclets.toolkit.builders.AbstractBuilder;
  40 import jdk.javadoc.internal.doclets.toolkit.util.ClassTree;
  41 import jdk.javadoc.internal.doclets.toolkit.util.DocFile;
  42 import jdk.javadoc.internal.doclets.toolkit.util.DocPath;
  43 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
  44 import jdk.javadoc.internal.doclets.toolkit.util.DocletAbortException;
  45 import jdk.javadoc.internal.doclets.toolkit.util.IndexBuilder;
  46 
  47 /**
  48  * The class with "start" method, calls individual Writers.
  49  *
  50  *  <p><b>This is NOT part of any supported API.
  51  *  If you write code that depends on this, you do so at your own risk.
  52  *  This code and its internal interfaces are subject to change or
  53  *  deletion without notice.</b>
  54  *
  55  * @author Atul M Dambalkar
  56  * @author Robert Field
  57  * @author Jamie Ho
  58  *
  59  */
  60 public class HtmlDoclet extends AbstractDoclet {


  61 
  62     public HtmlDoclet() {
  63         configuration = new ConfigurationImpl();
  64     }
  65 
  66     /**
  67      * The global configuration information for this run.
  68      */
  69     public final ConfigurationImpl configuration;
  70 
  71     public void init(Locale locale, Reporter reporter) {
  72         configuration.reporter = reporter;
  73         configuration.locale = locale;
  74     }
  75 
  76     /**
  77      * The "start" method as required by Javadoc.
  78      *
  79      * @param root the root of the documentation tree.
  80      * @see jdk.doclet.DocletEnvironment
  81      * @return true if the doclet ran without encountering any errors.
  82      */
  83     public boolean run(DocletEnvironment root) {
  84         return startDoclet(root);







  85     }


  86 
  87     /**
  88      * Create the configuration instance.
  89      * Override this method to use a different
  90      * configuration.
  91      */
  92     public Configuration configuration() {
  93         return configuration;
  94     }
  95 
  96     /**
  97      * Start the generation of files. Call generate methods in the individual
  98      * writers, which will in turn genrate the documentation files. Call the
  99      * TreeWriter generation first to ensure the Class Hierarchy is built
 100      * first and then can be used in the later generation.
 101      *
 102      * For new format.
 103      *
 104      * @see jdk.doclet.RootDoc
 105      */
 106     protected void generateOtherFiles(DocletEnvironment root, ClassTree classtree)
 107             throws Exception {
 108         super.generateOtherFiles(root, classtree);
 109         if (configuration.linksource) {
 110             SourceToHTMLConverter.convertRoot(configuration,
 111                 root, DocPaths.SOURCE_OUTPUT);
 112         }
 113 
 114         if (configuration.topFile.isEmpty()) {
 115             configuration.standardmessage.
 116                 error("doclet.No_Non_Deprecated_Classes_To_Document");
 117             return;
 118         }
 119         boolean nodeprecated = configuration.nodeprecated;
 120         performCopy(configuration.helpfile);
 121         performCopy(configuration.stylesheetfile);
 122         // do early to reduce memory footprint
 123         if (configuration.classuse) {
 124             ClassUseWriter.generate(configuration, classtree);
 125         }
 126         IndexBuilder indexbuilder = new IndexBuilder(configuration, nodeprecated);


 147         FrameOutputWriter.generate(configuration);
 148 
 149         if (configuration.createoverview) {
 150             PackageIndexWriter.generate(configuration);
 151         }
 152         if (configuration.helpfile.length() == 0 &&
 153             !configuration.nohelp) {
 154             HelpWriter.generate(configuration);
 155         }
 156         // If a stylesheet file is not specified, copy the default stylesheet
 157         // and replace newline with platform-specific newline.
 158         DocFile f;
 159         if (configuration.stylesheetfile.length() == 0) {
 160             f = DocFile.createFileForOutput(configuration, DocPaths.STYLESHEET);
 161             f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.STYLESHEET), false, true);
 162         }
 163         f = DocFile.createFileForOutput(configuration, DocPaths.JAVASCRIPT);
 164         f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.JAVASCRIPT), true, true);
 165         if (configuration.createindex) {
 166             f = DocFile.createFileForOutput(configuration, DocPaths.SEARCH_JS);
 167             f.copyResource(DocPaths.RESOURCES_IN_FORMATS_HTML.resolve(DocPaths.SEARCH_JS), true, true);
 168 
 169             f = DocFile.createFileForOutput(configuration, DocPaths.RESOURCES.resolve(DocPaths.GLASS_IMG));
 170             f.copyResource(DocPaths.RESOURCES_IN_FORMATS_HTML.resolve(DocPaths.GLASS_IMG), true, false);
 171 
 172             f = DocFile.createFileForOutput(configuration, DocPaths.RESOURCES.resolve(DocPaths.X_IMG));
 173             f.copyResource(DocPaths.RESOURCES_IN_FORMATS_HTML.resolve(DocPaths.X_IMG), true, false);
 174             copyJqueryFiles();
 175         }
 176     }
 177 
 178     protected void copyJqueryFiles() {
 179         List<String> files = Arrays.asList(
 180                 "jquery-1.10.2.js",
 181                 "jquery-ui.js",
 182                 "jquery-ui.css",
 183                 "jquery-ui.min.js",
 184                 "jquery-ui.min.css",
 185                 "jquery-ui.structure.min.css",
 186                 "jquery-ui.structure.css",
 187                 "external/jquery/jquery.js",
 188                 "jszip/dist/jszip.js",
 189                 "jszip/dist/jszip.min.js",
 190                 "jszip-utils/dist/jszip-utils.js",
 191                 "jszip-utils/dist/jszip-utils.min.js",
 192                 "jszip-utils/dist/jszip-utils-ie.js",
 193                 "jszip-utils/dist/jszip-utils-ie.min.js",
 194                 "images/ui-bg_flat_0_aaaaaa_40x100.png",
 195                 "images/ui-icons_454545_256x240.png",
 196                 "images/ui-bg_glass_95_fef1ec_1x400.png",
 197                 "images/ui-bg_glass_75_dadada_1x400.png",
 198                 "images/ui-bg_highlight-soft_75_cccccc_1x100.png",
 199                 "images/ui-icons_888888_256x240.png",
 200                 "images/ui-icons_2e83ff_256x240.png",
 201                 "images/ui-bg_glass_65_ffffff_1x400.png",
 202                 "images/ui-icons_cd0a0a_256x240.png",
 203                 "images/ui-bg_glass_55_fbf9ee_1x400.png",
 204                 "images/ui-icons_222222_256x240.png",
 205                 "images/ui-bg_glass_75_e6e6e6_1x400.png",
 206                 "images/ui-bg_flat_75_ffffff_40x100.png");
 207         DocFile f;
 208         for (String file : files) {
 209             DocPath filePath = DocPaths.JQUERY_FILES.resolve(file);
 210             f = DocFile.createFileForOutput(configuration, filePath);
 211             f.copyResource(DocPaths.RESOURCES_IN_FORMATS_HTML.resolve(filePath), true, false);
 212         }
 213     }
 214 
 215     /**
 216      * {@inheritDoc}
 217      */
 218     protected void generateClassFiles(SortedSet<TypeElement> arr, ClassTree classtree) {
 219         List<TypeElement> list = new ArrayList<>(arr);
 220         ListIterator<TypeElement> iterator = list.listIterator();
 221         TypeElement klass = null;
 222         while (iterator.hasNext()) {
 223             TypeElement prev = iterator.hasPrevious() ? klass : null;
 224             klass = iterator.next();
 225             TypeElement next = iterator.nextIndex() == list.size()
 226                     ? null : list.get(iterator.nextIndex());
 227             if (!(configuration.isGeneratedDoc(klass) && utils.isIncluded(klass))) {
 228                 continue;
 229             }







 230             try {
 231                 if (utils.isAnnotationType(klass)) {
 232                     AbstractBuilder annotationTypeBuilder =
 233                         configuration.getBuilderFactory()
 234                             .getAnnotationTypeBuilder(klass,
 235                                 prev == null ? null : prev.asType(),
 236                                 next == null ? null : next.asType());
 237                     annotationTypeBuilder.build();
 238                 } else {
 239                     AbstractBuilder classBuilder =
 240                         configuration.getBuilderFactory().getClassBuilder(klass,
 241                                 prev, next, classtree);
 242                     classBuilder.build();
 243                 }
 244             } catch (IOException e) {
 245                 throw new DocletAbortException(e);
 246             } catch (DocletAbortException de) {
 247                 throw de;
 248             } catch (Exception e) {
 249                 e.printStackTrace();
 250                 throw new DocletAbortException(e);
 251             }
 252         }
 253     }
 254 












































 255 










 256     /**
 257      * {@inheritDoc}
 258      */
 259     protected void generatePackageFiles(ClassTree classtree) throws Exception {
 260         Set<PackageElement> packages = configuration.packages;
 261         if (packages.size() > 1) {
 262             PackageIndexFrameWriter.generate(configuration);
 263         }
 264         List<PackageElement> pList = new ArrayList<>(packages);
 265         PackageElement prev = null;
 266         for (int i = 0 ; i < pList.size() ; i++) {
 267             // if -nodeprecated option is set and the package is marked as
 268             // deprecated, do not generate the package-summary.html, package-frame.html
 269             // and package-tree.html pages for that package.
 270             PackageElement pkg = pList.get(i);
 271             if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
 272                 PackageFrameWriter.generate(configuration, pkg);
 273                 int nexti = i + 1;
 274                 PackageElement next = null;
 275                 if (nexti < pList.size()) {
 276                     next = pList.get(nexti);
 277                     // If the next package is unnamed package, skip 2 ahead if possible
 278                     if (next.isUnnamed() && ++nexti < pList.size()) {
 279                        next = pList.get(nexti);
 280                     }
 281                 }
 282                 AbstractBuilder packageSummaryBuilder =
 283                         configuration.getBuilderFactory().getPackageSummaryBuilder(
 284                         pkg, prev, next);
 285                 packageSummaryBuilder.build();
 286                 if (configuration.createtree) {
 287                     PackageTreeWriter.generate(configuration, pkg, prev, next,

 288                             configuration.nodeprecated);
 289                 }
 290                 prev = pkg;
 291             }
 292         }
 293     }
 294 
 295     public Set<Option> getSupportedOptions() {
 296         return configuration.getSupportedOptions();










 297     }
 298 

















 299     private void performCopy(String filename) {
 300         if (filename.isEmpty())
 301             return;
 302 
 303         try {
 304             DocFile fromfile = DocFile.createFileForInput(configuration, filename);
 305             DocPath path = DocPath.create(fromfile.getName());
 306             DocFile toFile = DocFile.createFileForOutput(configuration, path);
 307             if (toFile.isSameFile(fromfile))
 308                 return;
 309 
 310             configuration.message.notice("doclet.Copying_File_0_To_File_1",

 311                     fromfile.toString(), path.getPath());
 312             toFile.copyFile(fromfile);
 313         } catch (IOException exc) {
 314             configuration.message.error("doclet.perform_copy_exception_encountered",

 315                     exc.toString());
 316             throw new DocletAbortException(exc);
 317         }
 318     }
 319 }