langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/AbstractDoclet.java
changeset 40303 96a1226aca18
parent 39364 bd6d4a7936b4
child 40315 9e994c77db6a
equal deleted inserted replaced
40302:8c0d8d2c3519 40303:96a1226aca18
    56 public abstract class AbstractDoclet {
    56 public abstract class AbstractDoclet {
    57 
    57 
    58     /**
    58     /**
    59      * The global configuration information for this run.
    59      * The global configuration information for this run.
    60      */
    60      */
    61     public Configuration configuration;
    61     private Configuration configuration;
       
    62 
       
    63     protected Messages messages;
       
    64 
    62     /*
    65     /*
    63      *  a handle to our utility methods
    66      *  a handle to our utility methods
    64      */
    67      */
    65     protected Utils utils;
    68     protected Utils utils;
    66 
    69 
    74      * Verify that the only doclet that is using this toolkit is
    77      * Verify that the only doclet that is using this toolkit is
    75      * {@value #TOOLKIT_DOCLET_NAME}.
    78      * {@value #TOOLKIT_DOCLET_NAME}.
    76      */
    79      */
    77     private boolean isValidDoclet() {
    80     private boolean isValidDoclet() {
    78         if (!getClass().getName().equals(TOOLKIT_DOCLET_NAME)) {
    81         if (!getClass().getName().equals(TOOLKIT_DOCLET_NAME)) {
    79             configuration.message.error("doclet.Toolkit_Usage_Violation",
    82             messages.error("doclet.Toolkit_Usage_Violation",
    80                 TOOLKIT_DOCLET_NAME);
    83                 TOOLKIT_DOCLET_NAME);
    81             return false;
    84             return false;
    82         }
    85         }
    83         return true;
    86         return true;
    84     }
    87     }
    94         configuration.docEnv = root;
    97         configuration.docEnv = root;
    95         configuration.cmtUtils = new CommentUtils(configuration);
    98         configuration.cmtUtils = new CommentUtils(configuration);
    96         configuration.utils = new Utils(configuration);
    99         configuration.utils = new Utils(configuration);
    97         utils = configuration.utils;
   100         utils = configuration.utils;
    98         configuration.workArounds = new WorkArounds(configuration);
   101         configuration.workArounds = new WorkArounds(configuration);
       
   102         messages = configuration.getMessages();
       
   103 
    99         if (!isValidDoclet()) {
   104         if (!isValidDoclet()) {
   100             return false;
   105             return false;
   101         }
   106         }
   102 
   107 
   103         try {
   108         try {
   114                     configuration.reporter.print(ERROR, cause.toString());
   119                     configuration.reporter.print(ERROR, cause.toString());
   115                 }
   120                 }
   116             }
   121             }
   117             return false;
   122             return false;
   118         } catch (Exception exc) {
   123         } catch (Exception exc) {
       
   124             exc.printStackTrace(System.err);
   119             return false;
   125             return false;
   120         }
   126         }
   121         return true;
   127         return true;
   122     }
   128     }
   123 
   129 
   144      *
   150      *
   145      * @see jdk.doclet.DocletEnvironment
   151      * @see jdk.doclet.DocletEnvironment
   146      */
   152      */
   147     private void startGeneration(DocletEnvironment root) throws Configuration.Fault, Exception {
   153     private void startGeneration(DocletEnvironment root) throws Configuration.Fault, Exception {
   148         if (root.getIncludedClasses().isEmpty()) {
   154         if (root.getIncludedClasses().isEmpty()) {
   149             configuration.message.
   155             messages.error("doclet.No_Public_Classes_To_Document");
   150                 error("doclet.No_Public_Classes_To_Document");
       
   151             return;
   156             return;
   152         }
   157         }
   153         if (!configuration.setOptions()) {
   158         if (!configuration.setOptions()) {
   154             return;
   159             return;
   155         }
   160         }
   156         configuration.getDocletSpecificMsg().notice("doclet.build_version",
   161         messages.notice("doclet.build_version",
   157             configuration.getDocletSpecificBuildDate());
   162             configuration.getDocletSpecificBuildDate());
   158         ClassTree classtree = new ClassTree(configuration, configuration.nodeprecated);
   163         ClassTree classtree = new ClassTree(configuration, configuration.nodeprecated);
   159 
   164 
   160         generateClassFiles(root, classtree);
   165         generateClassFiles(root, classtree);
   161         configuration.utils.copyDocFiles(DocPaths.DOC_FILES);
   166         configuration.utils.copyDocFiles(DocPaths.DOC_FILES);