getListRewrite(selectedNodes[0], fRewrite).insertAfter(insertedCode, selectedNodes[selectedNodes.length - 1], null);
if (selectedNodes.length == 1 && ASTNodes.isControlStatementBody(selectedNodes[0].getLocationInParent())) { Block wrap= ast.newBlock(); fRewrite.replace(selectedNodes[0], wrap, null); fRewrite.getListRewrite(wrap, Block.STATEMENTS_PROPERTY).insertFirst(insertedCode, null); } else { getListRewrite(selectedNodes[0], fRewrite).insertAfter(insertedCode, selectedNodes[selectedNodes.length - 1], null); }
	protected ASTRewrite getRewrite() throws CoreException {		if (fRewrite == null) {						Statement[] selectedNodes= fSelectedNodes;			AST ast= getAst();						fRewrite= ASTRewrite.create(ast);			Block newBody= ast.newBlock();			Statement insertedCode= generateCodeSkeleton(newBody, fRewrite);						BodyDeclaration enclosingBodyDeclaration= (BodyDeclaration)ASTNodes.getParent(selectedNodes[0], BodyDeclaration.class);			int maxVariableId= LocalVariableIndex.perform(enclosingBodyDeclaration) + 1;						List accessedAfter= getVariableDeclarationsAccessedAfter(selectedNodes[selectedNodes.length - 1], maxVariableId);			List readInside= getVariableDeclarationReadsInside(selectedNodes, maxVariableId);						moveToBlock(selectedNodes, newBody, accessedAfter, readInside, fRewrite);						getListRewrite(selectedNodes[0], fRewrite).insertAfter(insertedCode, selectedNodes[selectedNodes.length - 1], null);						setEndPosition(fRewrite.track(insertedCode));		}		return fRewrite;	}