langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java
changeset 25454 376a52c9540c
parent 22159 682da512ec17
equal deleted inserted replaced
25453:be80cf0463b3 25454:376a52c9540c
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    43 
    43 
    44     /**
    44     /**
    45      * The global configuration information for this run.
    45      * The global configuration information for this run.
    46      */
    46      */
    47     public Configuration configuration;
    47     public Configuration configuration;
       
    48     /*
       
    49      *  a handle to our utility methods
       
    50      */
       
    51     protected Utils utils;
    48 
    52 
    49     /**
    53     /**
    50      * The only doclet that may use this toolkit is {@value}
    54      * The only doclet that may use this toolkit is {@value}
    51      */
    55      */
    52     private static final String TOOLKIT_DOCLET_NAME =
    56     private static final String TOOLKIT_DOCLET_NAME =
    73      * @return true if the doclet executed without error.  False otherwise.
    77      * @return true if the doclet executed without error.  False otherwise.
    74      */
    78      */
    75     public boolean start(AbstractDoclet doclet, RootDoc root) {
    79     public boolean start(AbstractDoclet doclet, RootDoc root) {
    76         configuration = configuration();
    80         configuration = configuration();
    77         configuration.root = root;
    81         configuration.root = root;
       
    82         utils = configuration.utils;
    78         if (! isValidDoclet(doclet)) {
    83         if (! isValidDoclet(doclet)) {
    79             return false;
    84             return false;
    80         }
    85         }
    81         try {
    86         try {
    82             doclet.startGeneration(root);
    87             doclet.startGeneration(root);
    92                     root.printError(cause.toString());
    97                     root.printError(cause.toString());
    93                 }
    98                 }
    94             }
    99             }
    95             return false;
   100             return false;
    96         } catch (Exception exc) {
   101         } catch (Exception exc) {
    97             exc.printStackTrace();
       
    98             return false;
   102             return false;
    99         }
   103         }
   100         return true;
   104         return true;
   101     }
   105     }
   102 
   106 
   133         configuration.getDocletSpecificMsg().notice("doclet.build_version",
   137         configuration.getDocletSpecificMsg().notice("doclet.build_version",
   134             configuration.getDocletSpecificBuildDate());
   138             configuration.getDocletSpecificBuildDate());
   135         ClassTree classtree = new ClassTree(configuration, configuration.nodeprecated);
   139         ClassTree classtree = new ClassTree(configuration, configuration.nodeprecated);
   136 
   140 
   137         generateClassFiles(root, classtree);
   141         generateClassFiles(root, classtree);
   138         Util.copyDocFiles(configuration, DocPaths.DOC_FILES);
   142         configuration.utils.copyDocFiles(configuration, DocPaths.DOC_FILES);
   139 
   143 
   140         PackageListWriter.generate(configuration);
   144         PackageListWriter.generate(configuration);
   141         generatePackageFiles(classtree);
   145         generatePackageFiles(classtree);
   142         generateProfileFiles();
   146         generateProfileFiles();
   143 
   147