You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AbstractTreeWriter.java 3.6KB

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