Esempio n. 1
0
 /**
  * Get list of all the deprecated classes and members in all the Packages specified on the Command
  * Line. Then instantiate DeprecatedListWriter and generate File.
  *
  * @param configuration the current configuration of the doclet.
  */
 public static void generate(ConfigurationImpl configuration) {
   String filename = "deprecated-list.html";
   try {
     DeprecatedListWriter depr = new DeprecatedListWriter(configuration, filename);
     depr.generateDeprecatedListFile(new DeprecatedAPIListBuilder(configuration.root));
     depr.close();
   } catch (IOException exc) {
     configuration.standardmessage.error("doclet.exception_encountered", exc.toString(), filename);
     throw new DocletAbortException();
   }
 }
 /**
  * Generate a class page.
  *
  * @param configuration the current configuration of the doclet.
  * @param mapper the mapping of the class usage.
  * @param pkgdoc the package doc being documented.
  */
 public static void generate(
     ConfigurationImpl configuration, ClassUseMapper mapper, PackageDoc pkgdoc) {
   PackageUseWriter pkgusegen;
   DocPath filename = DocPaths.PACKAGE_USE;
   try {
     pkgusegen = new PackageUseWriter(configuration, mapper, filename, pkgdoc);
     pkgusegen.generatePackageUseFile();
     pkgusegen.close();
   } catch (IOException exc) {
     configuration.standardmessage.error("doclet.exception_encountered", exc.toString(), filename);
     throw new DocletAbortException(exc);
   }
 }
 /**
  * Convert the given Class to an HTML.
  *
  * @param cd the class to convert.
  * @param outputdir the name of the directory to output to.
  */
 public void convertClass(ClassDoc cd, DocPath outputdir) {
   if (cd == null) {
     return;
   }
   try {
     SourcePosition sp = cd.position();
     if (sp == null) return;
     Reader r;
     // temp hack until we can update SourcePosition API.
     if (sp instanceof SourcePositionImpl) {
       FileObject fo = ((SourcePositionImpl) sp).fileObject();
       if (fo == null) return;
       r = fo.openReader(true);
     } else {
       File file = sp.file();
       if (file == null) return;
       r = new FileReader(file);
     }
     int lineno = 1;
     String line;
     relativePath = DocPaths.SOURCE_OUTPUT.resolve(DocPath.forPackage(cd)).invert();
     Content body = getHeader();
     Content pre = new HtmlTree(HtmlTag.PRE);
     try (LineNumberReader reader = new LineNumberReader(r)) {
       while ((line = reader.readLine()) != null) {
         addLineNo(pre, lineno);
         addLine(pre, line, lineno);
         lineno++;
       }
     }
     addBlankLines(pre);
     Content div = HtmlTree.DIV(HtmlStyle.sourceContainer, pre);
     body.addContent((configuration.allowTag(HtmlTag.MAIN)) ? HtmlTree.MAIN(div) : div);
     writeToFile(body, outputdir.resolve(DocPath.forClass(cd)));
   } catch (IOException e) {
     e.printStackTrace();
   }
 }