91 */ 92 @Override // defined by AbstractDoclet 93 public HtmlConfiguration getConfiguration() { 94 return configuration; 95 } 96 97 /** 98 * Start the generation of files. Call generate methods in the individual 99 * writers, which will in turn generate the documentation files. Call the 100 * TreeWriter generation first to ensure the Class Hierarchy is built 101 * first and then can be used in the later generation. 102 * 103 * For new format. 104 * 105 * @throws DocletException if there is a problem while writing the other files 106 */ 107 @Override // defined by AbstractDoclet 108 protected void generateOtherFiles(DocletEnvironment docEnv, ClassTree classtree) 109 throws DocletException { 110 super.generateOtherFiles(docEnv, classtree); 111 if (configuration.linksource) { 112 SourceToHTMLConverter.convertRoot(configuration, 113 docEnv, DocPaths.SOURCE_OUTPUT); 114 } 115 // Modules with no documented classes may be specified on the 116 // command line to specify a service provider, allow these. 117 if (configuration.getSpecifiedModuleElements().isEmpty() && 118 configuration.topFile.isEmpty()) { 119 messages.error("doclet.No_Non_Deprecated_Classes_To_Document"); 120 return; 121 } 122 boolean nodeprecated = configuration.nodeprecated; 123 performCopy(configuration.helpfile); 124 performCopy(configuration.stylesheetfile); 125 for (String stylesheet : configuration.additionalStylesheets) { 126 performCopy(stylesheet); 127 } 128 // do early to reduce memory footprint 129 if (configuration.classuse) { 130 ClassUseWriter.generate(configuration, classtree); 131 } 132 IndexBuilder indexbuilder = new IndexBuilder(configuration, nodeprecated); 133 134 if (configuration.createtree) { 135 TreeWriter.generate(configuration, classtree); 136 } 137 138 if (!(configuration.nodeprecatedlist || nodeprecated)) { 139 DeprecatedListWriter.generate(configuration); 140 } 141 142 if (configuration.createoverview) { 143 if (configuration.showModules) { 144 ModuleIndexWriter.generate(configuration); 145 } else { 146 PackageIndexWriter.generate(configuration); 147 } 148 } 149 150 if (configuration.createindex) { 151 configuration.buildSearchTagIndex(); 152 if (configuration.splitindex) { 153 SplitIndexWriter.generate(configuration, indexbuilder); 154 } else { 155 SingleIndexWriter.generate(configuration, indexbuilder); 156 } 157 AllClassesIndexWriter.generate(configuration, 158 new IndexBuilder(configuration, nodeprecated, true)); 159 if (!configuration.packages.isEmpty()) { 160 AllPackagesIndexWriter.generate(configuration); 161 } 162 SystemPropertiesWriter.generate(configuration); 163 } 164 165 if (configuration.createoverview) { 166 IndexRedirectWriter.generate(configuration, DocPaths.OVERVIEW_SUMMARY, DocPaths.INDEX); 167 } else { 168 IndexRedirectWriter.generate(configuration); 169 } 170 171 if (configuration.helpfile.isEmpty() && !configuration.nohelp) { 172 HelpWriter.generate(configuration); 173 } 174 // If a stylesheet file is not specified, copy the default stylesheet 175 // and replace newline with platform-specific newline. 176 DocFile f; 177 if (configuration.stylesheetfile.length() == 0) { 178 f = DocFile.createFileForOutput(configuration, DocPaths.STYLESHEET); 179 f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.STYLESHEET), true, true); 180 } 181 f = DocFile.createFileForOutput(configuration, DocPaths.JAVASCRIPT); 182 f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.JAVASCRIPT), true, true); 183 if (configuration.createindex) { 184 f = DocFile.createFileForOutput(configuration, DocPaths.SEARCH_JS); 185 f.copyResource(DOCLET_RESOURCES.resolve(DocPaths.SEARCH_JS), true, true); 186 187 f = DocFile.createFileForOutput(configuration, DocPaths.RESOURCES.resolve(DocPaths.GLASS_IMG)); 188 f.copyResource(DOCLET_RESOURCES.resolve(DocPaths.GLASS_IMG), true, false); 189 190 f = DocFile.createFileForOutput(configuration, DocPaths.RESOURCES.resolve(DocPaths.X_IMG)); 191 f.copyResource(DOCLET_RESOURCES.resolve(DocPaths.X_IMG), true, false); 192 copyJqueryFiles(); 193 } 194 } 195 196 private void copyJqueryFiles() throws DocletException { 197 List<String> files = Arrays.asList( 198 "jquery-3.4.1.js", 199 "jquery-ui.js", 200 "jquery-ui.css", 201 "jquery-ui.min.js", 202 "jquery-ui.min.css", 203 "jquery-ui.structure.min.css", 255 /** 256 * {@inheritDoc} 257 */ 258 @Override // defined by AbstractDoclet 259 protected void generateModuleFiles() throws DocletException { 260 if (configuration.showModules) { 261 List<ModuleElement> mdles = new ArrayList<>(configuration.modulePackages.keySet()); 262 for (ModuleElement mdle : mdles) { 263 AbstractBuilder moduleSummaryBuilder = 264 configuration.getBuilderFactory().getModuleSummaryBuilder(mdle); 265 moduleSummaryBuilder.build(); 266 } 267 } 268 } 269 270 /** 271 * {@inheritDoc} 272 */ 273 @Override // defined by AbstractDoclet 274 protected void generatePackageFiles(ClassTree classtree) throws DocletException { 275 Set<PackageElement> packages = configuration.packages; 276 List<PackageElement> pList = new ArrayList<>(packages); 277 for (PackageElement pkg : pList) { 278 // if -nodeprecated option is set and the package is marked as 279 // deprecated, do not generate the package-summary.html, package-frame.html 280 // and package-tree.html pages for that package. 281 if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) { 282 AbstractBuilder packageSummaryBuilder = 283 configuration.getBuilderFactory().getPackageSummaryBuilder(pkg); 284 packageSummaryBuilder.build(); 285 if (configuration.createtree) { 286 PackageTreeWriter.generate(configuration, pkg, configuration.nodeprecated); 287 } 288 } 289 } 290 } 291 292 @Override // defined by Doclet 293 public Set<Option> getSupportedOptions() { 294 return configuration.getSupportedOptions(); 295 } 296 297 private void performCopy(String filename) throws DocFileIOException { 298 if (filename.isEmpty()) 299 return; 300 301 DocFile fromfile = DocFile.createFileForInput(configuration, filename); 302 DocPath path = DocPath.create(fromfile.getName()); 303 DocFile toFile = DocFile.createFileForOutput(configuration, path); 304 if (toFile.isSameFile(fromfile)) 305 return; 306 307 messages.notice("doclet.Copying_File_0_To_File_1", 308 fromfile.toString(), path.getPath()); 309 toFile.copyFile(fromfile); 310 } 311 } | 91 */ 92 @Override // defined by AbstractDoclet 93 public HtmlConfiguration getConfiguration() { 94 return configuration; 95 } 96 97 /** 98 * Start the generation of files. Call generate methods in the individual 99 * writers, which will in turn generate the documentation files. Call the 100 * TreeWriter generation first to ensure the Class Hierarchy is built 101 * first and then can be used in the later generation. 102 * 103 * For new format. 104 * 105 * @throws DocletException if there is a problem while writing the other files 106 */ 107 @Override // defined by AbstractDoclet 108 protected void generateOtherFiles(DocletEnvironment docEnv, ClassTree classtree) 109 throws DocletException { 110 super.generateOtherFiles(docEnv, classtree); 111 HtmlOptions options = configuration.getOptions(); 112 if (options.linkSource) { 113 SourceToHTMLConverter.convertRoot(configuration, 114 docEnv, DocPaths.SOURCE_OUTPUT); 115 } 116 // Modules with no documented classes may be specified on the 117 // command line to specify a service provider, allow these. 118 if (configuration.getSpecifiedModuleElements().isEmpty() && 119 configuration.topFile.isEmpty()) { 120 messages.error("doclet.No_Non_Deprecated_Classes_To_Document"); 121 return; 122 } 123 boolean nodeprecated = options.noDeprecated; 124 performCopy(options.helpFile); 125 performCopy(options.stylesheetFile); 126 for (String stylesheet : options.additionalStylesheets) { 127 performCopy(stylesheet); 128 } 129 // do early to reduce memory footprint 130 if (options.classUse) { 131 ClassUseWriter.generate(configuration, classtree); 132 } 133 IndexBuilder indexbuilder = new IndexBuilder(configuration, nodeprecated); 134 135 if (options.createTree) { 136 TreeWriter.generate(configuration, classtree); 137 } 138 139 if (!(options.noDeprecatedList || nodeprecated)) { 140 DeprecatedListWriter.generate(configuration); 141 } 142 143 if (options.createOverview) { 144 if (configuration.showModules) { 145 ModuleIndexWriter.generate(configuration); 146 } else { 147 PackageIndexWriter.generate(configuration); 148 } 149 } 150 151 if (options.createIndex) { 152 configuration.buildSearchTagIndex(); 153 if (options.splitIndex) { 154 SplitIndexWriter.generate(configuration, indexbuilder); 155 } else { 156 SingleIndexWriter.generate(configuration, indexbuilder); 157 } 158 AllClassesIndexWriter.generate(configuration, 159 new IndexBuilder(configuration, nodeprecated, true)); 160 if (!configuration.packages.isEmpty()) { 161 AllPackagesIndexWriter.generate(configuration); 162 } 163 SystemPropertiesWriter.generate(configuration); 164 } 165 166 if (options.createOverview) { 167 IndexRedirectWriter.generate(configuration, DocPaths.OVERVIEW_SUMMARY, DocPaths.INDEX); 168 } else { 169 IndexRedirectWriter.generate(configuration); 170 } 171 172 if (options.helpFile.isEmpty() && !options.noHelp) { 173 HelpWriter.generate(configuration); 174 } 175 // If a stylesheet file is not specified, copy the default stylesheet 176 // and replace newline with platform-specific newline. 177 DocFile f; 178 if (options.stylesheetFile.length() == 0) { 179 f = DocFile.createFileForOutput(configuration, DocPaths.STYLESHEET); 180 f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.STYLESHEET), true, true); 181 } 182 f = DocFile.createFileForOutput(configuration, DocPaths.JAVASCRIPT); 183 f.copyResource(DocPaths.RESOURCES.resolve(DocPaths.JAVASCRIPT), true, true); 184 if (options.createIndex) { 185 f = DocFile.createFileForOutput(configuration, DocPaths.SEARCH_JS); 186 f.copyResource(DOCLET_RESOURCES.resolve(DocPaths.SEARCH_JS), true, true); 187 188 f = DocFile.createFileForOutput(configuration, DocPaths.RESOURCES.resolve(DocPaths.GLASS_IMG)); 189 f.copyResource(DOCLET_RESOURCES.resolve(DocPaths.GLASS_IMG), true, false); 190 191 f = DocFile.createFileForOutput(configuration, DocPaths.RESOURCES.resolve(DocPaths.X_IMG)); 192 f.copyResource(DOCLET_RESOURCES.resolve(DocPaths.X_IMG), true, false); 193 copyJqueryFiles(); 194 } 195 } 196 197 private void copyJqueryFiles() throws DocletException { 198 List<String> files = Arrays.asList( 199 "jquery-3.4.1.js", 200 "jquery-ui.js", 201 "jquery-ui.css", 202 "jquery-ui.min.js", 203 "jquery-ui.min.css", 204 "jquery-ui.structure.min.css", 256 /** 257 * {@inheritDoc} 258 */ 259 @Override // defined by AbstractDoclet 260 protected void generateModuleFiles() throws DocletException { 261 if (configuration.showModules) { 262 List<ModuleElement> mdles = new ArrayList<>(configuration.modulePackages.keySet()); 263 for (ModuleElement mdle : mdles) { 264 AbstractBuilder moduleSummaryBuilder = 265 configuration.getBuilderFactory().getModuleSummaryBuilder(mdle); 266 moduleSummaryBuilder.build(); 267 } 268 } 269 } 270 271 /** 272 * {@inheritDoc} 273 */ 274 @Override // defined by AbstractDoclet 275 protected void generatePackageFiles(ClassTree classtree) throws DocletException { 276 HtmlOptions options = configuration.getOptions(); 277 Set<PackageElement> packages = configuration.packages; 278 List<PackageElement> pList = new ArrayList<>(packages); 279 for (PackageElement pkg : pList) { 280 // if -nodeprecated option is set and the package is marked as 281 // deprecated, do not generate the package-summary.html, package-frame.html 282 // and package-tree.html pages for that package. 283 if (!(options.noDeprecated && utils.isDeprecated(pkg))) { 284 AbstractBuilder packageSummaryBuilder = 285 configuration.getBuilderFactory().getPackageSummaryBuilder(pkg); 286 packageSummaryBuilder.build(); 287 if (options.createTree) { 288 PackageTreeWriter.generate(configuration, pkg, options.noDeprecated); 289 } 290 } 291 } 292 } 293 294 @Override // defined by Doclet 295 public Set<? extends Option> getSupportedOptions() { 296 return configuration.getOptions().getSupportedOptions(); 297 } 298 299 private void performCopy(String filename) throws DocFileIOException { 300 if (filename.isEmpty()) 301 return; 302 303 DocFile fromfile = DocFile.createFileForInput(configuration, filename); 304 DocPath path = DocPath.create(fromfile.getName()); 305 DocFile toFile = DocFile.createFileForOutput(configuration, path); 306 if (toFile.isSameFile(fromfile)) 307 return; 308 309 messages.notice("doclet.Copying_File_0_To_File_1", 310 fromfile.toString(), path.getPath()); 311 toFile.copyFile(fromfile); 312 } 313 } |