newDeclFrag.setName(ast.newSimpleName(node.getIdentifier()));
	private ASTRewrite doAddLocal(CompilationUnit cu) throws CoreException {		AST ast= cu.getAST();				SimpleName node= fOriginalNode;		BodyDeclaration decl= ASTResolving.findParentBodyDeclaration(node);		if (decl instanceof MethodDeclaration || decl instanceof Initializer) {			ASTRewrite rewrite= new ASTRewrite(decl);						VariableDeclarationFragment newDeclFrag= ast.newVariableDeclarationFragment();			VariableDeclarationStatement newDecl= ast.newVariableDeclarationStatement(newDeclFrag);						Type type= evaluateVariableType(ast);			newDecl.setType(type);			newDeclFrag.setName(ast.newSimpleName(node.getIdentifier()));			newDeclFrag.setInitializer(ASTNodeFactory.newDefaultExpression(ast, type, 0));						ASTNode parent= node.getParent();			if (parent.getNodeType() == ASTNode.ASSIGNMENT) {				Assignment assignment= (Assignment) parent;				if (node.equals(assignment.getLeftHandSide())) {					int parentParentKind= parent.getParent().getNodeType();					if (parentParentKind == ASTNode.EXPRESSION_STATEMENT) {						Expression placeholder= (Expression) rewrite.createCopy(assignment.getRightHandSide());						newDeclFrag.setInitializer(placeholder);										rewrite.markAsReplaced(assignment.getParent(), newDecl);						return rewrite;					} else if (parentParentKind == ASTNode.FOR_STATEMENT) {						ForStatement forStatement= (ForStatement) parent.getParent();						if (forStatement.initializers().size() == 1 && assignment.equals(forStatement.initializers().get(0))) {							VariableDeclarationFragment frag= ast.newVariableDeclarationFragment();							VariableDeclarationExpression expression= ast.newVariableDeclarationExpression(frag);							frag.setName(ast.newSimpleName(node.getIdentifier()));							Expression placeholder= (Expression) rewrite.createCopy(assignment.getRightHandSide());							frag.setInitializer(placeholder);							expression.setType(evaluateVariableType(ast));														rewrite.markAsReplaced(assignment, expression);							return rewrite;						}								}							}			} else if (parent.getNodeType() == ASTNode.EXPRESSION_STATEMENT) {				rewrite.markAsReplaced(parent, newDecl);				return rewrite;			}			Statement statement= ASTResolving.findParentStatement(node);			if (statement != null) {				List list= ASTNodes.getContainingList(statement);				while (list == null && statement.getParent() instanceof Statement) { // parent must be if, for or while					statement= (Statement) statement.getParent();					list= ASTNodes.getContainingList(statement);				}				if (list != null) {					list.add(list.indexOf(statement), newDecl);					rewrite.markAsInserted(newDecl);					return rewrite;									}			}		}		return null;	}