ASTNode newBody= rewrite.createMovePlaceholder(statement);
ASTNode newBody= rewrite.createMoveTarget(statement);
	public void testIfStatement2() throws Exception {		IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);		StringBuffer buf= new StringBuffer();		buf.append("package test1;\n");		buf.append("public class E {\n");		buf.append("    public void foo() {\n");		buf.append("        if (i == 0) {\n");		buf.append("            System.beep();\n");		buf.append("        }\n");		buf.append("        if (i == 0) {\n");		buf.append("            System.beep();\n");		buf.append("        } else {\n");		buf.append("            hoo(11);\n");		buf.append("        }\n");		buf.append("        if (i == 0) {\n");		buf.append("            System.beep();\n");		buf.append("        }\n");		buf.append("        if (i == 0) {\n");		buf.append("            System.beep();\n");		buf.append("        } else\n");		buf.append("            hoo(11);\n");		buf.append("    }\n");		buf.append("}\n");			ICompilationUnit cu= pack1.createCompilationUnit("E.java", buf.toString(), false, null);				CompilationUnit astRoot= createAST(cu);		NewASTRewrite rewrite= new NewASTRewrite(astRoot.getAST());		AST ast= astRoot.getAST();						assertTrue("Parse errors", (astRoot.getFlags() & ASTNode.MALFORMED) == 0);		TypeDeclaration type= findTypeDeclaration(astRoot, "E");		MethodDeclaration methodDecl= findMethodDeclaration(type, "foo");		Block block= methodDecl.getBody();		List statements= block.statements();		assertTrue("Number of statements not 4", statements.size() == 4);		{ // replace then block by statement, add else statement			IfStatement ifStatement= (IfStatement) statements.get(0);				Block body= (Block) ifStatement.getThenStatement();			ASTNode statement= (ASTNode) body.statements().get(0);						ASTNode newBody= rewrite.createMovePlaceholder(statement);						rewrite.markAsReplaced(body, newBody);						Statement returnStatement= ast.newReturnStatement();			rewrite.markAsInsert(ifStatement, IfStatement.ELSE_STATEMENT_PROPERTY, returnStatement, null);					}		{ // replace then block by statement, remove else statement			IfStatement ifStatement= (IfStatement) statements.get(1);				Block body= (Block) ifStatement.getThenStatement();			ASTNode statement= (ASTNode) body.statements().get(0);						ASTNode newBody= rewrite.createMovePlaceholder(statement);						rewrite.markAsReplaced(body, newBody);			rewrite.markAsRemoved(ifStatement.getElseStatement());		}		{ // replace then block by statement, add else statement			IfStatement ifStatement= (IfStatement) statements.get(2);				Block body= (Block) ifStatement.getThenStatement();			ASTNode statement= (ASTNode) body.statements().get(0);						ASTNode newBody= rewrite.createMovePlaceholder(statement);						rewrite.markAsReplaced(body, newBody);						Block newElseBlock= ast.newBlock();			Statement returnStatement= ast.newReturnStatement();			newElseBlock.statements().add(returnStatement);						rewrite.markAsInsert(ifStatement, IfStatement.ELSE_STATEMENT_PROPERTY, newElseBlock, null);					}		{ // replace then block by statement, remove else statement			IfStatement ifStatement= (IfStatement) statements.get(3);				Block body= (Block) ifStatement.getThenStatement();			ASTNode statement= (ASTNode) body.statements().get(0);						ASTNode newBody= rewrite.createMovePlaceholder(statement);						rewrite.markAsReplaced(body, newBody);			rewrite.markAsRemoved(ifStatement.getElseStatement());		}						String preview= evaluateRewrite(cu, rewrite);				buf= new StringBuffer();		buf.append("package test1;\n");		buf.append("public class E {\n");		buf.append("    public void foo() {\n");		buf.append("        if (i == 0)\n");		buf.append("            System.beep();\n");		buf.append("        else\n");		buf.append("            return;\n");				buf.append("        if (i == 0)\n");		buf.append("            System.beep();\n");		buf.append("        if (i == 0)\n");		buf.append("            System.beep();\n");		buf.append("        else {\n");		buf.append("            return;\n");		buf.append("        }\n");		buf.append("        if (i == 0)\n");		buf.append("            System.beep();\n");		buf.append("    }\n");		buf.append("}\n");		assertEqualString(preview, buf.toString());	}