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.

SplitIndexWriter.java 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 com.sun.javadoc.ClassDoc;
  24. import com.sun.javadoc.MemberDoc;
  25. import com.sun.tools.doclets.DirectoryManager;
  26. import com.sun.tools.doclets.DocletAbortException;
  27. import com.sun.tools.doclets.IndexBuilder;
  28. import java.io.IOException;
  29. public class SplitIndexWriter
  30. extends com.sun.tools.doclets.standard.SplitIndexWriter
  31. {
  32. protected class Del extends AbstractIndexWriter {
  33. public Del(String s, IndexBuilder i) throws IOException {
  34. super(s, i);
  35. }
  36. public void print(String s) {
  37. SplitIndexWriter.this.print(s);
  38. }
  39. }
  40. final protected Del del;
  41. {
  42. Standard.quiet();
  43. Del d = null;
  44. try {
  45. d = new Del(filename, indexbuilder);
  46. } catch (Exception e) {
  47. Standard.configuration().standardmessage.
  48. error("doclet.exception_encountered",
  49. e+"", filename);
  50. } finally {
  51. del = d;
  52. Standard.speak();
  53. }
  54. }
  55. protected void printMemberDesc(MemberDoc member) {
  56. del.printMemberDesc(member);
  57. }
  58. protected void printClassInfo(ClassDoc cd) {
  59. del.printClassInfo(cd);
  60. }
  61. public SplitIndexWriter(String path, String filename,
  62. String relpath, IndexBuilder indexbuilder,
  63. int prev, int next) throws IOException {
  64. super(path, filename, relpath,
  65. indexbuilder, prev, next);
  66. }
  67. public static void generate(IndexBuilder indexbuilder)
  68. throws DocletAbortException {
  69. SplitIndexWriter sw = null;
  70. String filename = "";
  71. String path = DirectoryManager.getPath("index-files");
  72. String relpath = DirectoryManager.getRelativePath("index-files");
  73. try {
  74. for (int i = 0; i < indexbuilder.elements().length; i++) {
  75. int j = i + 1;
  76. int prev = (j == 1)? -1: i;
  77. int next = (j == indexbuilder.elements().length)? -1: j + 1;
  78. filename = "index-" + j +".html";
  79. (sw = new SplitIndexWriter(path, filename, relpath,
  80. indexbuilder, prev, next)).
  81. generateIndexFile((Character)
  82. indexbuilder.elements()[i]);
  83. }
  84. } catch (IOException e) {
  85. Standard.configuration().
  86. standardmessage.error("doclet.exception_encountered",
  87. e+"", filename);
  88. throw new DocletAbortException();
  89. } finally {
  90. if (sw != null) sw.close();
  91. }
  92. }
  93. }