List of usage examples for org.eclipse.jdt.core.dom EnumConstantDeclaration accept
public final void accept(ASTVisitor visitor)
From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java
License:Open Source License
@Override public boolean visit(EnumDeclaration node) { if (node.getJavadoc() != null) { node.getJavadoc().accept(this); }/* w ww .j a v a2 s. co m*/ printModifiers(node.modifiers()); this.fBuffer.append("enum ");//$NON-NLS-1$ node.getName().accept(this); this.fBuffer.append(" ");//$NON-NLS-1$ if (!node.superInterfaceTypes().isEmpty()) { this.fBuffer.append("implements ");//$NON-NLS-1$ for (Iterator<Type> it = node.superInterfaceTypes().iterator(); it.hasNext();) { Type t = it.next(); t.accept(this); if (it.hasNext()) { this.fBuffer.append(", ");//$NON-NLS-1$ } } this.fBuffer.append(" ");//$NON-NLS-1$ } this.fBuffer.append("{");//$NON-NLS-1$ for (Iterator<EnumConstantDeclaration> it = node.enumConstants().iterator(); it.hasNext();) { EnumConstantDeclaration d = it.next(); d.accept(this); // enum constant declarations do not include punctuation if (it.hasNext()) { // enum constant declarations are separated by commas this.fBuffer.append(", ");//$NON-NLS-1$ } } if (!node.bodyDeclarations().isEmpty()) { this.fBuffer.append("; ");//$NON-NLS-1$ for (Iterator<BodyDeclaration> it = node.bodyDeclarations().iterator(); it.hasNext();) { BodyDeclaration d = it.next(); d.accept(this); // other body declarations include trailing punctuation } } this.fBuffer.append("}");//$NON-NLS-1$ return false; }
From source file:coloredide.utils.CopiedNaiveASTFlattener.java
License:Open Source License
public boolean visit(EnumDeclaration node) { if (node.getJavadoc() != null) { node.getJavadoc().accept(this); }/*from w ww . j av a 2s.com*/ printIndent(); printModifiers(node.modifiers()); this.buffer.append("enum ");//$NON-NLS-1$ node.getName().accept(this); this.buffer.append(" ");//$NON-NLS-1$ if (!node.superInterfaceTypes().isEmpty()) { this.buffer.append("implements ");//$NON-NLS-1$ for (Iterator it = node.superInterfaceTypes().iterator(); it.hasNext();) { Type t = (Type) it.next(); t.accept(this); if (it.hasNext()) { this.buffer.append(", ");//$NON-NLS-1$ } } this.buffer.append(" ");//$NON-NLS-1$ } this.buffer.append("{");//$NON-NLS-1$ for (Iterator it = node.enumConstants().iterator(); it.hasNext();) { EnumConstantDeclaration d = (EnumConstantDeclaration) it.next(); d.accept(this); // enum constant declarations do not include punctuation if (it.hasNext()) { // enum constant declarations are separated by commas this.buffer.append(", ");//$NON-NLS-1$ } } if (!node.bodyDeclarations().isEmpty()) { this.buffer.append("; ");//$NON-NLS-1$ for (Iterator it = node.bodyDeclarations().iterator(); it.hasNext();) { BodyDeclaration d = (BodyDeclaration) it.next(); d.accept(this); // other body declarations include trailing punctuation } } this.buffer.append("}\n");//$NON-NLS-1$ return false; }
From source file:com.google.devtools.j2objc.ast.DebugASTPrinter.java
License:Apache License
@Override public boolean visit(EnumDeclaration node) { sb.printIndent();/*ww w .ja v a 2 s .com*/ printModifiers(node.getModifiers()); sb.print("enum "); node.getName().accept(this); sb.print(' '); sb.print('{'); for (Iterator<EnumConstantDeclaration> it = node.getEnumConstants().iterator(); it.hasNext();) { EnumConstantDeclaration d = (EnumConstantDeclaration) it.next(); d.accept(this); if (it.hasNext()) { sb.print(", "); } } if (!node.getBodyDeclarations().isEmpty()) { sb.print("; "); for (Iterator<BodyDeclaration> it = node.getBodyDeclarations().iterator(); it.hasNext();) { it.next().accept(this); } } sb.println('}'); return false; }
From source file:com.j2swift.ast.DebugASTPrinter.java
License:Apache License
@Override public boolean visit(EnumDeclaration node) { sb.printIndent();/*from w ww. j a v a2 s .c o m*/ printAnnotations(node.getAnnotations()); printModifiers(node.getModifiers()); sb.print("enum "); node.getName().accept(this); sb.print(' '); sb.print('{'); for (Iterator<EnumConstantDeclaration> it = node.getEnumConstants().iterator(); it.hasNext();) { EnumConstantDeclaration d = (EnumConstantDeclaration) it.next(); d.accept(this); if (it.hasNext()) { sb.print(", "); } } if (!node.getBodyDeclarations().isEmpty()) { sb.print("; "); for (Iterator<BodyDeclaration> it = node.getBodyDeclarations().iterator(); it.hasNext();) { it.next().accept(this); } } sb.println('}'); return false; }