protected ASTRewrite getRewrite() throws CoreException {
CompilationUnit astRoot = ASTResolving.findParentCompilationUnit(typeDecl);
AST ast = astRoot.getAST();
ASTRewrite astRewrite = ASTRewrite.create(ast);
ImportRewrite importRewrite = StubUtility.createImportRewrite(astRoot, true);
ListRewrite listRewriter = astRewrite.getListRewrite(typeDecl, (typeDecl).getBodyDeclarationsProperty());
if (listRewriter != null) {
IJavaProject javaProject = compilationUnit.getJavaProject();
CodeGenerationSettings settings = JavaPreferencesSettings.getCodeGenerationSettings(javaProject);