123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- /* -*- Mode: JDE; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- *
- * This file is part of the debugger and core tools for the AspectJ(tm)
- * programming language; see http://aspectj.org
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is AspectJ.
- *
- * The Initial Developer of the Original Code is Xerox Corporation. Portions
- * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
- * All Rights Reserved.
- */
- package org.aspectj.tools.doclets.standard;
-
- import org.aspectj.tools.ajdoc.Quietable;
-
- import com.sun.javadoc.RootDoc;
- import com.sun.tools.doclets.DocletAbortException;
- import com.sun.tools.doclets.standard.AllClassesFrameWriter;
- import com.sun.tools.doclets.standard.FrameOutputWriter;
- import com.sun.tools.doclets.standard.HelpWriter;
- import com.sun.tools.doclets.standard.PackageIndexFrameWriter;
- import com.sun.tools.doclets.standard.PackageIndexWriter;
- import com.sun.tools.doclets.standard.PackageListWriter;
- import com.sun.tools.doclets.standard.PackagesFileWriter;
- import com.sun.tools.doclets.standard.SerializedFormWriter;
- import com.sun.tools.doclets.standard.StylesheetWriter;
-
- import java.io.IOException;
-
- /**
- * Main doclet for ajdoc. It defines a number of
- * passes to use in generating the documentation.
- *
- * @author Jeff Palm
- */
- public class Standard extends AbstractStandard {
- private static Standard SINGLETON; // todo: prefer early/final?
- public static final Standard getSingleton() {
- if (null == SINGLETON) {
- SINGLETON = new Standard();
- }
- return SINGLETON;
- }
- private Standard() {}
-
- public static boolean start(RootDoc root) throws IOException {
- return start(getSingleton(), root);
- }
-
- public ConfigurationStandard getConfiguration() {
- return (ConfigurationStandard)configuration();
- }
-
- public static void quiet() {
- if (configuration().root instanceof Quietable) {
- ((Quietable)configuration().root).quiet();
- }
- }
- public static void speak() {
- if (configuration().root instanceof Quietable) {
- ((Quietable)configuration().root).speak();
- }
- }
-
- public static class ClassUseMapperPass extends Pass {
- protected boolean cond() {
- return cs.classuse;
- }
- protected void gen() throws DocletAbortException {
- ClassUseMapper.generate(root, std.classtree);
- }
- public String title() { return "class use mapper"; }
- }
-
- public static class TreeWriterPass extends Pass {
- protected boolean cond() {
- return cs.createtree;
- }
- protected void gen() throws DocletAbortException {
- TreeWriter.generate(std.classtree);
- }
- public String title() { return "tree writer"; }
- }
-
- public static class SplitIndexWriterPass extends Pass {
- protected boolean cond() {
- return cs.createindex && cs.splitindex;
- }
- protected void gen() throws DocletAbortException {
- SplitIndexWriter.generate(std.indexBuilder(root, false));
- }
- public String title() { return "split index"; }
- }
-
- public static class SingleIndexWriterPass extends Pass {
- protected boolean cond() {
- return cs.createindex && !cs.splitindex;
- }
- protected void gen() throws DocletAbortException {
- SingleIndexWriter.generate(std.indexBuilder(root, false));
- }
- public String title() { return "single index"; }
- }
-
- public static class DeprecatedListWriterPass extends Pass {
- protected boolean cond() {
- return !cs.nodeprecatedlist && !cs.nodeprecated;
- }
- protected void gen() throws DocletAbortException {
- DeprecatedListWriter.generate(root);
- }
- public String title() { return "deprecated list"; }
- }
-
- public static class AllClassesFrameWriterPass extends Pass {
- protected void gen() throws DocletAbortException {
- AllClassesFrameWriter.generate(std.indexBuilder(root, true));
- }
- public String title() { return "all classes frame"; }
- }
-
- public static class FrameOutputWriterPass extends Pass {
- protected void gen() throws DocletAbortException {
- FrameOutputWriter.generate();
- }
- public String title() { return "output frame"; }
- }
-
- public static class PackagesFileWriterPass extends Pass {
- protected void gen() throws DocletAbortException {
- PackagesFileWriter.generate();
- }
- public String title() { return "packages files"; }
- }
-
- public static class PackageIndexWriterPass extends Pass {
- protected boolean cond(ConfigurationStandard cs) {
- return cs.createoverview;
- }
- protected void gen() throws DocletAbortException {
- PackageIndexWriter.generate(root);
- }
- public String title() { return "package index"; }
- }
-
- public static class PackageIndexFrameWriterPass extends Pass {
- protected boolean cond() {
- return cs.packages.length > 1;
- }
- protected void gen() throws DocletAbortException {
- PackageIndexFrameWriter.generate();
- }
- public String title() { return "package index frame"; }
- }
-
- protected Class[] preGenerationClasses() {
- return new Class[] {
- ClassUseMapperPass.class,
- TreeWriterPass.class,
- SplitIndexWriterPass.class,
- SingleIndexWriterPass.class,
- DeprecatedListWriterPass.class,
- AllClassesFrameWriterPass.class,
- FrameOutputWriterPass.class,
- PackagesFileWriterPass.class,
- PackageIndexWriterPass.class,
- PackageIndexFrameWriterPass.class,
- };
- }
-
- public static class SerializedFormWriterPass extends Pass {
- protected void gen() throws DocletAbortException {
- SerializedFormWriter.generate(root);
- }
- public String title() { return "serialized form"; }
- }
-
- public static class PackageListWriterPass extends Pass {
- protected void gen() throws DocletAbortException {
- PackageListWriter.generate(root);
- }
- public String title() { return "package list"; }
- }
-
- public static class HelpWriterPass extends Pass {
- protected boolean cond() {
- return cs.helpfile.length() == 0 &&
- !cs.nohelp;
- }
- protected void gen() throws DocletAbortException {
- HelpWriter.generate();
- }
- public String title() { return "help"; }
- }
-
- public static class StylesheetWriterPass extends Pass {
- protected boolean cond() {
- return cs.stylesheetfile.length() == 0;
- }
- protected void gen() throws DocletAbortException {
- StylesheetWriter.generate();
- }
- public String title() { return "style sheet"; }
- }
-
-
- protected Class[] postGenerationClasses() {
- return new Class[] {
- SerializedFormWriterPass.class,
- PackageListWriterPass.class,
- HelpWriterPass.class,
- StylesheetWriterPass.class,
- };
- }
-
- public static class NoPublicClassesToDocumentCheck extends Check {
- protected boolean cond() {
- return root.classes().length == 0;
- }
- protected String message() {
- return "doclet.No_Public_Classes_To_Document";
- }
- }
- public static class NoNonDeprecatedClassToDocumentCheck extends Check {
- protected boolean cond() {
- return cs.topFile.length() == 0;
- }
- protected String message() {
- return "doclet.No_Non_Deprecated_Classes_To_Document";
- }
- }
-
- protected Class[] checkClasses() {
- return new Class[] {
- NoPublicClassesToDocumentCheck.class,
- NoNonDeprecatedClassToDocumentCheck.class,
- };
- }
- }
-
|