Search in sources :

Example 1 with PackageDoc

use of com.sun.javadoc.PackageDoc in project abstools by abstools.

the class SequenceTaglet method getPathToJavadocDestination.

private String getPathToJavadocDestination(Tag tag) throws SequenceTagletException {
    PackageDoc pdoc = null;
    if (tag.holder() instanceof PackageDoc) {
        pdoc = (PackageDoc) tag.holder();
    } else {
        ProgramElementDoc pedoc = (ProgramElementDoc) tag.holder();
        pdoc = pedoc.containingPackage();
    }
    if (pdoc.allClasses() == null || pdoc.allClasses().length == 0) {
        throw new SequenceTagletException("Cowardly refusing to generate a sequence diagram for an empty package", null);
    }
    String qualifiedName = pdoc.allClasses()[0].qualifiedName();
    String path = "";
    for (int i = 0; i < qualifiedName.length(); i++) {
        if (qualifiedName.charAt(i) == '.') {
            path += "../";
        }
    }
    return path;
}
Also used : PackageDoc(com.sun.javadoc.PackageDoc) ProgramElementDoc(com.sun.javadoc.ProgramElementDoc)

Example 2 with PackageDoc

use of com.sun.javadoc.PackageDoc in project markdown-doclet by Abnaxos.

the class UmlTagRenderer method render.

@Override
public void render(Tag tag, StringBuilder target, MarkdownDoclet doclet) {
    if (config == null) {
        if (doclet.getOptions().getPlantUmlConfigFile() != null) {
            try {
                config = Collections.singletonList(Files.toString(doclet.getOptions().getPlantUmlConfigFile(), doclet.getOptions().getEncoding()));
            } catch (IOException e) {
                doclet.printError("Error loading PlantUML configuration file " + doclet.getOptions().getPlantUmlConfigFile() + ": " + e.getLocalizedMessage());
            }
        } else {
            config = Collections.emptyList();
        }
    }
    String packageName;
    if (tag.holder() instanceof ProgramElementDoc) {
        packageName = ((ProgramElementDoc) tag.holder()).containingPackage().name();
    } else if (tag.holder() instanceof PackageDoc) {
        packageName = ((PackageDoc) (tag.holder())).name();
    } else if (tag.holder() instanceof RootDoc) {
        packageName = null;
    } else {
        doclet.printError(tag.position(), "Cannot handle tag for holder " + tag.holder());
        return;
    }
    String source = tag.text().trim();
    int pos = CharMatcher.WHITESPACE.indexIn(source);
    if (pos < 0) {
        doclet.printError(tag.position(), "Invalid @startuml tag: Expected filename and PlantUML source");
        return;
    }
    String fileName = source.substring(0, pos);
    source = "@startuml " + fileName + "\n" + source.substring(pos).trim() + "\n@enduml";
    File outputFile;
    if (packageName == null) {
        outputFile = doclet.getOptions().getDestinationDir();
    } else {
        outputFile = new File(doclet.getOptions().getDestinationDir(), packageName.replace(".", File.separator));
    }
    outputFile.mkdirs();
    outputFile = new File(outputFile, fileName.replace("/", File.separator));
    doclet.printNotice("Generating UML diagram " + outputFile);
    // render
    SourceStringReader reader = new SourceStringReader(new Defines(), source, config);
    try {
        reader.generateImage(outputFile);
    } catch (IOException e) {
        doclet.printError(tag.position(), "Error generating UML image " + outputFile + ": " + e.getLocalizedMessage());
    }
}
Also used : PackageDoc(com.sun.javadoc.PackageDoc) ProgramElementDoc(com.sun.javadoc.ProgramElementDoc) Defines(net.sourceforge.plantuml.preproc.Defines) SourceStringReader(net.sourceforge.plantuml.SourceStringReader) IOException(java.io.IOException) RootDoc(com.sun.javadoc.RootDoc) File(java.io.File)

Example 3 with PackageDoc

use of com.sun.javadoc.PackageDoc in project com.revolsys.open by revolsys.

the class ClientDoclet method documentation.

@Override
public void documentation() {
    DocletUtil.contentContainer(this.writer, "col-md-12");
    this.writer.element(HtmlElem.H1, this.docTitle);
    DocletUtil.description(this.writer, null, this.root);
    for (final PackageDoc packageDoc : this.root.specifiedPackages()) {
        documentationPackage(packageDoc);
    }
    DocletUtil.endContentContainer(this.writer);
}
Also used : PackageDoc(com.sun.javadoc.PackageDoc)

Example 4 with PackageDoc

use of com.sun.javadoc.PackageDoc in project com.revolsys.open by revolsys.

the class RestDoclet method documentation.

@Override
public void documentation() {
    DocletUtil.contentContainer(this.writer, "col-md-12");
    this.writer.element(HtmlElem.H1, this.docTitle);
    DocletUtil.description(this.writer, null, this.root);
    for (final PackageDoc packageDoc : this.root.specifiedPackages()) {
        final Map<String, ClassDoc> classes = new TreeMap<>();
        for (final ClassDoc classDoc : packageDoc.ordinaryClasses()) {
            classes.put(classDoc.name(), classDoc);
        }
        for (final ClassDoc classDoc : classes.values()) {
            documentationClass(classDoc);
        }
    }
    DocletUtil.endContentContainer(this.writer);
}
Also used : PackageDoc(com.sun.javadoc.PackageDoc) TreeMap(java.util.TreeMap) ClassDoc(com.sun.javadoc.ClassDoc)

Example 5 with PackageDoc

use of com.sun.javadoc.PackageDoc in project com.revolsys.open by revolsys.

the class JavaDoclet method documentation.

@Override
public void documentation() {
    this.writer.startTag(HtmlElem.DIV);
    for (final PackageDoc packageDoc : this.root.specifiedPackages()) {
        documentationPackage(packageDoc);
    }
    this.writer.endTagLn(HtmlElem.DIV);
}
Also used : PackageDoc(com.sun.javadoc.PackageDoc)

Aggregations

PackageDoc (com.sun.javadoc.PackageDoc)10 ClassDoc (com.sun.javadoc.ClassDoc)5 ExecutableMemberDoc (com.sun.javadoc.ExecutableMemberDoc)2 MemberDoc (com.sun.javadoc.MemberDoc)2 ProgramElementDoc (com.sun.javadoc.ProgramElementDoc)2 TreeMap (java.util.TreeMap)2 RootDoc (com.sun.javadoc.RootDoc)1 File (java.io.File)1 IOException (java.io.IOException)1 SourceStringReader (net.sourceforge.plantuml.SourceStringReader)1 Defines (net.sourceforge.plantuml.preproc.Defines)1