Example usage for org.eclipse.jdt.internal.compiler.ast AbstractVariableDeclaration ENUM_CONSTANT

List of usage examples for org.eclipse.jdt.internal.compiler.ast AbstractVariableDeclaration ENUM_CONSTANT

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.ast AbstractVariableDeclaration ENUM_CONSTANT.

Prototype

int ENUM_CONSTANT

To view the source code for org.eclipse.jdt.internal.compiler.ast AbstractVariableDeclaration ENUM_CONSTANT.

Click Source Link

Usage

From source file:org.nabucco.framework.mda.model.java.ast.extension.type.TypeDeclarationExtension.java

License:Open Source License

public StringBuffer printBody(int indent, StringBuffer output) {
    output.append(" {"); //$NON-NLS-1$

    // Inner classes are not supported

    if (this.memberTypes != null) {

        throw new IllegalArgumentException(
                "Inner classes are not supported! Found in '" + new String(this.name) + ".java'.");

        // for (int i = 0; i < this.memberTypes.length; i++) {
        // if (this.memberTypes[i] != null) {
        // output.append('\n');
        // this.memberTypes[i].print(indent + 1, output);
        // } }/*from ww w . j  av a2 s  . co  m*/
    }

    if (this.fields != null) {
        for (int i = 0; i < this.fields.length; i++) {

            FieldDeclaration field = this.fields[i];

            if (field != null) {
                output.append('\n');
                field.print(indent + 1, output);

                if (field.getKind() == AbstractVariableDeclaration.ENUM_CONSTANT) {

                    if (i == this.fields.length - 1) {
                        output.append(SEMICOLON);
                    } else {

                        FieldDeclaration nextField = fields[i + 1];

                        if (nextField == null
                                || nextField.getKind() != AbstractVariableDeclaration.ENUM_CONSTANT) {
                            output.append(SEMICOLON);
                        }
                    }
                }
            }
        }
    }
    if (this.methods != null) {

        Arrays.sort(this.methods, AbstractMethodDeclarationComparator.getInstance());

        for (int i = 0; i < this.methods.length; i++) {
            if (this.methods[i] != null) {
                output.append('\n');
                this.methods[i].print(indent + 1, output);
            }
        }
    }
    output.append('\n');
    return printIndent(indent, output).append('}');
}