StatementRewrite.create(fRewriter, selectedNodes).replace(createCallNodes(null), description);
new StatementRewrite(fRewriter, selectedNodes).replace(createCallNodes(null), description);
	public Change createChange(IProgressMonitor pm) throws CoreException {		if (fMethodName == null)			return null;		pm.beginTask("", 2); //$NON-NLS-1$		fAnalyzer.aboutToCreateChange();		BodyDeclaration declaration= fAnalyzer.getEnclosingBodyDeclaration();		fRewriter= ASTRewrite.create(declaration.getAST());		String sourceMethodName= declaration.getNodeType() == ASTNode.METHOD_DECLARATION 			? ((MethodDeclaration)declaration).getName().getIdentifier()			: ""; //$NON-NLS-1$				final CompilationUnitChange result= new CompilationUnitChange(			RefactoringCoreMessages.getFormattedString("ExtractMethodRefactoring.change_name", new String[]{fMethodName, sourceMethodName}),  //$NON-NLS-1$			fCUnit);		result.setSaveMode(TextFileChange.KEEP_SAVE_STATE);			MultiTextEdit root= new MultiTextEdit();		result.setEdit(root);		// This is cheap since the compilation unit is already open in a editor.		IPath path= ((IFile)WorkingCopyUtil.getOriginal(fCUnit).getResource()).getFullPath();		ITextFileBufferManager bufferManager= FileBuffers.getTextFileBufferManager();		try {			bufferManager.connect(path, new SubProgressMonitor(pm, 1));			IDocument document= bufferManager.getTextFileBuffer(path).getDocument();						ASTNode[] selectedNodes= fAnalyzer.getSelectedNodes();			ASTNodes.expandRange(selectedNodes, document, fSelectionStart, fSelectionLength);			MethodDeclaration mm= createNewMethod(fMethodName, true, selectedNodes, document.getLineDelimiter(0));			TextEditGroup insertDesc= new TextEditGroup(RefactoringCoreMessages.getFormattedString("ExtractMethodRefactoring.add_method", fMethodName)); //$NON-NLS-1$			result.addTextEditGroup(insertDesc);						if (fDestination == fDestinations[0]) {				ChildListPropertyDescriptor descriptor= (ChildListPropertyDescriptor)declaration.getLocationInParent();				ListRewrite container= fRewriter.getListRewrite(declaration.getParent(), descriptor);				container.insertAfter(mm, declaration, insertDesc);			} else {				BodyDeclarationRewrite container= BodyDeclarationRewrite.create(fRewriter, fDestination);				container.insert(mm, insertDesc);			}						TextEditGroup description= new TextEditGroup(RefactoringCoreMessages.getFormattedString("ExtractMethodRefactoring.substitute_with_call", fMethodName)); //$NON-NLS-1$			result.addTextEditGroup(description);						StatementRewrite.create(fRewriter, selectedNodes).replace(createCallNodes(null), description);						replaceDuplicates(result);					if (!fImportRewriter.isEmpty()) {				TextEdit edit= fImportRewriter.createEdit(document);				root.addChild(edit);				result.addTextEditGroup(new TextEditGroup(					RefactoringCoreMessages.getString("ExtractMethodRefactoring.organize_imports"), //$NON-NLS-1$					new TextEdit[] {edit}				));			}			root.addChild(fRewriter.rewriteAST(document, null));		} catch (BadLocationException e) {			throw new CoreException(new Status(IStatus.ERROR, JavaPlugin.getPluginId(), IStatus.ERROR,				e.getMessage(), e));		} finally {			bufferManager.disconnect(path, new SubProgressMonitor(pm, 1));			pm.done();		}		return result;	}