Source:
protected void addOccurrences(TextChangeManager manager, IProgressMonitor pm, RefactoringStatus status) throws CoreException { pm.beginTask("", fOccurrences.length); for (SearchResultGroup fOccurrence : fOccurrences) { ICompilationUnit cu= fOccurrence.getCompilationUnit(); if (cu == null) continue; List<SearchMatch> declarationsInThisCu= new ArrayList<>(); List<SearchMatch> referencesInThisCu= new ArrayList<>(); for (SearchMatch result : fOccurrence.getSearchResults()) { if (result instanceof MethodDeclarationMatch) { declarationsInThisCu.add(result); } else { referencesInThisCu.add(result); } } if (declarationsInThisCu.size() > 0) { if (fDelegateUpdating) { CompilationUnitRewrite rewrite= new CompilationUnitRewrite(cu); rewrite.setResolveBindings(true); for (SearchMatch element : declarationsInThisCu) { MethodDeclaration method= ASTNodeSearchUtil.getMethodDeclarationNode((IMethod) element.getElement(), rewrite.getRoot()); DelegateCreator creator= new DelegateMethodCreator(); creator.setDeclareDeprecated(fDelegateDeprecation); creator.setDeclaration(method); creator.setSourceRewrite(rewrite); creator.setNewElementName(getNewElementName()); creator.prepareDelegate(); creator.createEdit(); } TextChange changeForThisCu= rewrite.createChange(true); changeForThisCu.setKeepPreviewEdits(true); manager.manage(cu, changeForThisCu); } for (SearchMatch element : declarationsInThisCu) { simpleUpdate(element, cu, manager.get(cu)); } } if (fUpdateReferences) { for (SearchMatch element : referencesInThisCu) { simpleUpdate(element, cu, manager.get(cu)); } } pm.worked(1); if (pm.isCanceled()) throw new OperationCanceledException(); } pm.done(); }

Target:
protected void addOccurrences(TextChangeManager manager, IProgressMonitor pm, RefactoringStatus status) throws CoreException { pm.beginTask("", fOccurrences.length); for (SearchResultGroup occurrence : fOccurrences) { ICompilationUnit cu= occurrence.getCompilationUnit(); if (cu == null) continue; List<SearchMatch> declarationsInThisCu= new ArrayList<>(); List<SearchMatch> referencesInThisCu= new ArrayList<>(); for (SearchMatch result : occurrence.getSearchResults()) { if (result instanceof MethodDeclarationMatch) { declarationsInThisCu.add(result); } else { referencesInThisCu.add(result); } } if (declarationsInThisCu.size() > 0) { if (fDelegateUpdating) { CompilationUnitRewrite rewrite= new CompilationUnitRewrite(cu); rewrite.setResolveBindings(true); for (SearchMatch element : declarationsInThisCu) { MethodDeclaration method= ASTNodeSearchUtil.getMethodDeclarationNode((IMethod) element.getElement(), rewrite.getRoot()); DelegateCreator creator= new DelegateMethodCreator(); creator.setDeclareDeprecated(fDelegateDeprecation); creator.setDeclaration(method); creator.setSourceRewrite(rewrite); creator.setNewElementName(getNewElementName()); creator.prepareDelegate(); creator.createEdit(); } TextChange changeForThisCu= rewrite.createChange(true); changeForThisCu.setKeepPreviewEdits(true); manager.manage(cu, changeForThisCu); } for (SearchMatch element : declarationsInThisCu) { simpleUpdate(element, cu, manager.get(cu)); } } if (fUpdateReferences) { for (SearchMatch element : referencesInThisCu) { simpleUpdate(element, cu, manager.get(cu)); } } pm.worked(1); if (pm.isCanceled()) throw new OperationCanceledException(); } pm.done(); }