langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java
changeset 40315 9e994c77db6a
parent 40303 96a1226aca18
child 40500 f293dbb81a53
equal deleted inserted replaced
40314:52f8470ce3e4 40315:9e994c77db6a
    30 
    30 
    31 import javax.lang.model.element.ModuleElement;
    31 import javax.lang.model.element.ModuleElement;
    32 import javax.lang.model.element.PackageElement;
    32 import javax.lang.model.element.PackageElement;
    33 import javax.lang.model.element.TypeElement;
    33 import javax.lang.model.element.TypeElement;
    34 
    34 
    35 import com.sun.javadoc.PackageDoc;
       
    36 import jdk.javadoc.doclet.Doclet.Option;
    35 import jdk.javadoc.doclet.Doclet.Option;
    37 import jdk.javadoc.doclet.DocletEnvironment;
    36 import jdk.javadoc.doclet.DocletEnvironment;
    38 import jdk.javadoc.doclet.Reporter;
    37 import jdk.javadoc.doclet.Reporter;
    39 import jdk.javadoc.internal.doclets.toolkit.AbstractDoclet;
    38 import jdk.javadoc.internal.doclets.toolkit.AbstractDoclet;
    40 import jdk.javadoc.internal.doclets.toolkit.Configuration;
    39 import jdk.javadoc.internal.doclets.toolkit.Configuration;
    64 
    63 
    65     public HtmlDoclet() {
    64     public HtmlDoclet() {
    66         configuration = new ConfigurationImpl();
    65         configuration = new ConfigurationImpl();
    67     }
    66     }
    68 
    67 
       
    68     @Override // defined by Doclet
       
    69     public String getName() {
       
    70         return "Html";
       
    71     }
       
    72 
    69     /**
    73     /**
    70      * The global configuration information for this run.
    74      * The global configuration information for this run.
    71      */
    75      */
    72     private final ConfigurationImpl configuration;
    76     private final ConfigurationImpl configuration;
    73 
    77 
    75 
    79 
    76 
    80 
    77     private static final DocPath DOCLET_RESOURCES = DocPath
    81     private static final DocPath DOCLET_RESOURCES = DocPath
    78             .create("/jdk/javadoc/internal/doclets/formats/html/resources");
    82             .create("/jdk/javadoc/internal/doclets/formats/html/resources");
    79 
    83 
       
    84     @Override // defined by Doclet
    80     public void init(Locale locale, Reporter reporter) {
    85     public void init(Locale locale, Reporter reporter) {
    81         configuration.reporter = reporter;
    86         configuration.reporter = reporter;
    82         configuration.locale = locale;
    87         configuration.locale = locale;
    83         messages = configuration.getMessages();
    88         messages = configuration.getMessages();
    84     }
    89     }
    85 
    90 
    86     /**
    91     /**
    87      * The "start" method as required by Javadoc.
       
    88      *
       
    89      * @param docEnv the root of the documentation tree.
       
    90      * @see jdk.doclet.DocletEnvironment
       
    91      * @return true if the doclet ran without encountering any errors.
       
    92      */
       
    93     public boolean run(DocletEnvironment docEnv) {
       
    94         return startDoclet(docEnv);
       
    95     }
       
    96 
       
    97     /**
       
    98      * Create the configuration instance.
    92      * Create the configuration instance.
    99      * Override this method to use a different
    93      * Override this method to use a different
   100      * configuration.
    94      * configuration.
   101      */
    95      */
       
    96     @Override // defined by AbstractDoclet
   102     public Configuration configuration() {
    97     public Configuration configuration() {
   103         return configuration;
    98         return configuration;
   104     }
    99     }
   105 
   100 
   106     /**
   101     /**
   111      *
   106      *
   112      * For new format.
   107      * For new format.
   113      *
   108      *
   114      * @see jdk.doclet.RootDoc
   109      * @see jdk.doclet.RootDoc
   115      */
   110      */
       
   111     @Override // defined by AbstractDoclet
   116     protected void generateOtherFiles(DocletEnvironment docEnv, ClassTree classtree)
   112     protected void generateOtherFiles(DocletEnvironment docEnv, ClassTree classtree)
   117             throws Exception {
   113             throws Exception {
   118         super.generateOtherFiles(docEnv, classtree);
   114         super.generateOtherFiles(docEnv, classtree);
   119         if (configuration.linksource) {
   115         if (configuration.linksource) {
   120             SourceToHTMLConverter.convertRoot(configuration,
   116             SourceToHTMLConverter.convertRoot(configuration,
   226     }
   222     }
   227 
   223 
   228     /**
   224     /**
   229      * {@inheritDoc}
   225      * {@inheritDoc}
   230      */
   226      */
       
   227     @Override // defined by AbstractDoclet
   231     protected void generateClassFiles(SortedSet<TypeElement> arr, ClassTree classtree) {
   228     protected void generateClassFiles(SortedSet<TypeElement> arr, ClassTree classtree) {
   232         List<TypeElement> list = new ArrayList<>(arr);
   229         List<TypeElement> list = new ArrayList<>(arr);
   233         ListIterator<TypeElement> iterator = list.listIterator();
   230         ListIterator<TypeElement> iterator = list.listIterator();
   234         TypeElement klass = null;
   231         TypeElement klass = null;
   235         while (iterator.hasNext()) {
   232         while (iterator.hasNext()) {
   268     }
   265     }
   269 
   266 
   270     /**
   267     /**
   271      * {@inheritDoc}
   268      * {@inheritDoc}
   272      */
   269      */
       
   270     @Override // defined by AbstractDoclet
   273     protected void generateModuleFiles() throws Exception {
   271     protected void generateModuleFiles() throws Exception {
   274         if (configuration.showModules) {
   272         if (configuration.showModules) {
   275             ModuleIndexFrameWriter.generate(configuration);
   273             ModuleIndexFrameWriter.generate(configuration);
   276             ModuleElement prevModule = null, nextModule;
   274             ModuleElement prevModule = null, nextModule;
   277             List<ModuleElement> mdles = new ArrayList<>(configuration.modulePackages.keySet());
   275             List<ModuleElement> mdles = new ArrayList<>(configuration.modulePackages.keySet());
   301     }
   299     }
   302 
   300 
   303     /**
   301     /**
   304      * {@inheritDoc}
   302      * {@inheritDoc}
   305      */
   303      */
       
   304     @Override // defined by AbstractDoclet
   306     protected void generatePackageFiles(ClassTree classtree) throws Exception {
   305     protected void generatePackageFiles(ClassTree classtree) throws Exception {
   307         Set<PackageElement> packages = configuration.packages;
   306         Set<PackageElement> packages = configuration.packages;
   308         if (packages.size() > 1) {
   307         if (packages.size() > 1) {
   309             PackageIndexFrameWriter.generate(configuration);
   308             PackageIndexFrameWriter.generate(configuration);
   310         }
   309         }
   337                 prev = pkg;
   336                 prev = pkg;
   338             }
   337             }
   339         }
   338         }
   340     }
   339     }
   341 
   340 
       
   341     @Override // defined by Doclet
   342     public Set<Option> getSupportedOptions() {
   342     public Set<Option> getSupportedOptions() {
   343         return configuration.getSupportedOptions();
   343         return configuration.getSupportedOptions();
   344     }
   344     }
   345 
   345 
   346     private void performCopy(String filename) {
   346     private void performCopy(String filename) {