rewrite.markAsReplaced(imp.getName(), name);
rewrite.markAsReplaced(imp.getName(), name, null);
	public void testImportDeclaration() throws Exception {		IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);		StringBuffer buf= new StringBuffer();		buf.append("package test1;\n");		buf.append("import java.util.Vector;\n");		buf.append("import java.util.Vector;\n");		buf.append("import java.net.*;\n");		buf.append("import java.text.*;\n");							buf.append("public class Z {\n");		buf.append("}\n");			ICompilationUnit cu= pack1.createCompilationUnit("Z.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);				List imports= astRoot.imports();		assertTrue("Number of imports not 4", imports.size() == 4);				{ // rename import			ImportDeclaration imp= (ImportDeclaration) imports.get(0);						Name name= ast.newName(new String[] { "org", "eclipse", "X" });			rewrite.markAsReplaced(imp.getName(), name);		}		{ // change to import on demand			ImportDeclaration imp= (ImportDeclaration) imports.get(1);						Name name= ast.newName(new String[] { "java", "util" });			rewrite.markAsReplaced(imp.getName(), name);						rewrite.markAsReplaced(imp, ImportDeclaration.ON_DEMAND_PROPERTY, Boolean.TRUE, null);		}		{ // change to single import			ImportDeclaration imp= (ImportDeclaration) imports.get(2);						rewrite.markAsReplaced(imp, ImportDeclaration.ON_DEMAND_PROPERTY, Boolean.FALSE, null);		}		{ // rename import			ImportDeclaration imp= (ImportDeclaration) imports.get(3);						Name name= ast.newName(new String[] { "org", "eclipse" });			rewrite.markAsReplaced(imp.getName(), name);		}										String preview= evaluateRewrite(cu, rewrite);				buf= new StringBuffer();		buf.append("package test1;\n");		buf.append("import org.eclipse.X;\n");		buf.append("import java.util.*;\n");		buf.append("import java.net;\n");		buf.append("import org.eclipse.*;\n");					buf.append("public class Z {\n");		buf.append("}\n");			assertEqualString(preview, buf.toString());	}