}
}
protected ASTNode generateElementAST(ASTRewrite rewriter, IDocument document, ICompilationUnit cu) throws JavaModelException {
if (this.createdNode == null) {
this.source = removeIndentAndNewLines(this.source, document, cu);
ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setSource(this.source.toCharArray());
parser.setProject(getCompilationUnit().getJavaProject());
parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS);
ASTNode node = parser.createAST(this.progressMonitor);
String createdNodeSource;
if (node.getNodeType() != ASTNode.TYPE_DECLARATION) {
createdNodeSource = generateSyntaxIncorrectAST();
if (this.createdNode == null)
throw new JavaModelException(new JavaModelStatus(IJavaModelStatusConstants.INVALID_CONTENTS));