01: /*
02: * Author: Mike Atkinson
03: *
04: * This software has been developed under the copyleft
05: * rules of the GNU General Public License. Please
06: * consult the GNU General Public License for more
07: * details about use and distribution of this software.
08: */
09: package org.acm.seguin.pretty.jdi;
10:
11: import net.sourceforge.jrefactory.ast.ASTEnumDeclaration;
12: import net.sourceforge.jrefactory.ast.ASTLiteral;
13: import net.sourceforge.jrefactory.ast.ASTAnnotation;
14: import net.sourceforge.jrefactory.ast.Node;
15: import org.acm.seguin.pretty.DescriptionPadder;
16: import org.acm.seguin.pretty.ForceJavadocComments;
17: import org.acm.seguin.pretty.PrintData;
18: import org.acm.seguin.pretty.ai.RequiredTags;
19:
20: /**
21: * Stores an <code>enum</code> declaration. Enumerations are new to JDK 1.5
22: *
23: * @author Mike Atkinson
24: * @since jRefactory 2.9.0, created October 16, 2003
25: */
26: public class EnumDeclaration extends BaseJDI {
27: private ASTEnumDeclaration enumeration;
28:
29: /**
30: * Constructor for the EnumDeclaration JavaDoc creator.
31: *
32: * @param enumeration Create JavaDoc for this node.
33: */
34: public EnumDeclaration(ASTEnumDeclaration enumeration) {
35: super ();
36: this .enumeration = enumeration;
37: }
38:
39: /**
40: * Checks to see if it was printed
41: *
42: * @return true if it still needs to be printed
43: */
44: public boolean isRequired() {
45: return jdi.isRequired()
46: && (new ForceJavadocComments()).isJavaDocRequired(
47: "field", enumeration);
48: }
49:
50: /**
51: * Prints all the java doc components
52: *
53: * @param printData the print data
54: */
55: public void printJavaDocComponents(PrintData printData) {
56: jdi.printJavaDocComponents(printData, bundle
57: .getString("enum.tags"));
58: }
59:
60: /** Makes sure all the java doc components are present */
61: public void finish() {
62: jdi.require("", DescriptionPadder.find(bundle, "enum.descr"));
63: int childNo = enumeration.skipAnnotations();
64: ASTLiteral litID = (ASTLiteral) enumeration
65: .jjtGetChild(childNo + 1);
66: // Require the other tags
67: RequiredTags.getTagger().addTags(bundle, "enum",
68: litID.getName(), jdi);
69: }
70:
71: }
|