1 22 23 package org.aspectj.tools.doclets.standard; 24 25 import org.aspectj.ajdoc.AspectDoc; 26 27 import com.sun.javadoc.ClassDoc; 28 import com.sun.javadoc.PackageDoc; 29 import com.sun.tools.doclets.ClassTree; 30 import com.sun.tools.doclets.DocletAbortException; 31 32 import java.io.IOException ; 33 import java.util.List ; 34 35 public class AbstractTreeWriter 36 extends com.sun.tools.doclets.standard.AbstractTreeWriter 37 { 38 39 protected boolean seenAspect = false; 40 protected boolean aspectMode = false; 41 42 protected AbstractTreeWriter(String filename, ClassTree classtree) 43 throws IOException , DocletAbortException { 44 super(filename, classtree); 45 } 46 47 protected AbstractTreeWriter(String path, String filename, 48 ClassTree classtree, PackageDoc pkg) 49 throws IOException , DocletAbortException { 50 super(path, filename, classtree, pkg); 51 } 52 53 protected void generateLevelInfo(ClassDoc parent, List list) { 54 if (list.size() > 0) { 55 ul(); 56 for (int i = 0; i < list.size(); i++) { 57 ClassDoc local = (ClassDoc)list.get(i); 58 boolean isAspect = local instanceof org.aspectj.ajdoc.AspectDoc; 59 if (aspectMode) { 60 if (!local.qualifiedTypeName().equals("java.lang.Object") 61 && !isAspect) { 62 continue; 63 } 64 } else if (isAspect) { 65 continue; 66 } 67 printPartialInfo(local); 68 printExtendsImplements(parent, local); 69 generateLevelInfo(local, classtree.subs(local)); 70 } 71 ulEnd(); 72 } 73 } 74 75 protected void printExtendsImplements(ClassDoc parent, ClassDoc cd) { 76 super.printExtendsImplements(parent, cd); 77 if (cd instanceof AspectDoc) { 78 printDominationInfo(((AspectDoc)cd).dominatees(), "dominates"); 79 printDominationInfo(((AspectDoc)cd).dominators(), "dominated by"); 80 } 81 } 82 83 protected void printDominationInfo(AspectDoc[] aspects, 84 String whosOnTop) { 85 if (aspects != null && aspects.length > 0) { 86 print(" (" + whosOnTop + " "); 87 for (int i = 0; i < aspects.length; i++) { 88 if (i > 0) print(", "); 89 printPreQualifiedClassLink(aspects[i]); 90 } 91 print(")"); 92 } 93 } 94 95 96 protected void generateTree(List list, String heading) { 97 super.generateTree(list, heading); 98 if (heading.equals("doclet.Class_Hierarchy")) { 99 aspectMode = true; 100 generateTree(list, "doclet.Aspect_Hierarchy"); 101 aspectMode = false; 102 } 103 } 104 } 105 | Popular Tags |