private void removeReferences(Set<TextMatch> matches, SearchResultGroup group) { SearchMatch[] searchResults = group.getSearchResults(); for (int r = 0; r < searchResults.length; r++) { // int start= searchResults[r].getStart(); // doesn't work for pack.ReferencedType int unqualifiedStart = searchResults[r].getOffset() + searchResults[r].getLength() - fCurrentNameLength; for (Iterator<TextMatch> iter = matches.iterator(); iter.hasNext(); ) { TextMatch element = iter.next(); if (element.getStartPosition() == unqualifiedStart) iter.remove(); } } }
private void addTextUpdates(ICompilationUnit cu, Set<TextMatch> matches) { for (Iterator<TextMatch> resultIter = matches.iterator(); resultIter.hasNext(); ) { TextMatch match = resultIter.next(); if (!match.isQualified() && fOnlyQualified) continue; int matchStart = match.getStartPosition(); ReplaceEdit edit = new ReplaceEdit(matchStart, fCurrentNameLength, fNewName); try { TextChangeCompatibility.addTextEdit( fManager.get(cu), TEXT_EDIT_LABEL, edit, TEXTUAL_MATCHES); } catch (MalformedTreeException e) { // conflicting update -> omit text match } } }