KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > tools > doclets > standard > PackageTreeWriter


1 /* -*- Mode: JDE; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2  *
3  * This file is part of the debugger and core tools for the AspectJ(tm)
4  * programming language; see http://aspectj.org
5  *
6  * The contents of this file are subject to the Mozilla Public License
7  * Version 1.1 (the "License"); you may not use this file except in
8  * compliance with the License. You may obtain a copy of the License at
9  * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
10  *
11  * Software distributed under the License is distributed on an "AS IS" basis,
12  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13  * for the specific language governing rights and limitations under the
14  * License.
15  *
16  * The Original Code is AspectJ.
17  *
18  * The Initial Developer of the Original Code is Xerox Corporation. Portions
19  * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
20  * All Rights Reserved.
21  */

22 package org.aspectj.tools.doclets.standard;
23
24 import com.sun.javadoc.ClassDoc;
25 import com.sun.javadoc.PackageDoc;
26 import com.sun.tools.doclets.ClassTree;
27 import com.sun.tools.doclets.DirectoryManager;
28 import com.sun.tools.doclets.DocletAbortException;
29
30 import java.io.IOException JavaDoc;
31 import java.util.List JavaDoc;
32
33 public class PackageTreeWriter
34     extends com.sun.tools.doclets.standard.PackageTreeWriter
35 {
36
37     protected class Del extends AbstractTreeWriter {
38         public Del(String JavaDoc s, ClassTree c)
39             throws IOException JavaDoc, DocletAbortException {
40             super(s, c);
41         }
42         public void print(String JavaDoc s) {
43             PackageTreeWriter.this.print(s);
44         }
45     }
46     final protected Del del;
47     {
48         Standard.quiet();
49         Del d = null;
50         try {
51             d = new Del(filename, classtree);
52         } catch (Exception JavaDoc e) {
53             Standard.configuration().standardmessage.
54                 error("doclet.exception_encountered",
55                       e+"", filename);
56         } finally {
57             del = d;
58             Standard.speak();
59         }
60     }
61     protected void generateLevelInfo(ClassDoc parent, List JavaDoc list) {
62         del.generateLevelInfo(parent, list);
63     }
64     protected void generateTree(List JavaDoc list, String JavaDoc heading) {
65         del.generateTree(list, heading);
66     }
67
68     public PackageTreeWriter(String JavaDoc path,
69                              String JavaDoc filename,
70                              PackageDoc packagedoc,
71                              PackageDoc prev,
72                              PackageDoc next,
73                              boolean noDeprecated)
74                       throws IOException JavaDoc, DocletAbortException {
75         super(path, filename, packagedoc, prev, next, noDeprecated);
76     }
77
78     public static void generate(PackageDoc pkg, PackageDoc prev,
79                                 PackageDoc next, boolean noDeprecated)
80                          throws DocletAbortException {
81         PackageTreeWriter pw = null;
82         String JavaDoc path = DirectoryManager.getDirectoryPath(pkg);
83         String JavaDoc filename = "package-tree.html";
84         try {
85             (pw = new PackageTreeWriter(path, filename, pkg,
86                                         prev, next, noDeprecated)).
87                 generatePackageTreeFile();
88         } catch (IOException JavaDoc e) {
89             Standard.configuration().standardmessage.
90                 error("doclet.exception_encountered",
91                       e+"", filename);
92             throw new DocletAbortException();
93         } finally {
94             if (pw != null) pw.close();
95         }
96     }
97 }
98
Popular Tags