Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2011-04-15 10:25:37 +0000
committerDani Megert2011-04-15 10:25:37 +0000
commitf9cd29b08bf60d689aa2d6fa79f8f75c9bca9c3f (patch)
treea31b28e815b3f625666cdae17b804a71832d496b /org.eclipse.search
parent2d41eefaddd21bad5f1f165caa32ce0e638b7a57 (diff)
downloadeclipse.platform.text-f9cd29b08bf60d689aa2d6fa79f8f75c9bca9c3f.tar.gz
eclipse.platform.text-f9cd29b08bf60d689aa2d6fa79f8f75c9bca9c3f.tar.xz
eclipse.platform.text-f9cd29b08bf60d689aa2d6fa79f8f75c9bca9c3f.zip
Fixed bug 342932: replace does not replace all matches found in same file
Diffstat (limited to 'org.eclipse.search')
-rw-r--r--org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java
index da46eef81..66d5bb03f 100644
--- a/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java
+++ b/org.eclipse.search/search/org/eclipse/search/internal/ui/text/ReplaceRefactoring.java
@@ -18,6 +18,7 @@ import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
@@ -151,7 +152,7 @@ public class ReplaceRefactoring extends Refactoring {
private HashMap/*<IFile,Set<Match>*/ fMatches;
- private ArrayList fAffectedLocations;
+ private Map fAffectedLocations;
private String fReplaceString;
@@ -164,7 +165,7 @@ public class ReplaceRefactoring extends Refactoring {
fSelection= selection;
fMatches= new HashMap();
- fAffectedLocations= new ArrayList(selection != null ? selection.length : result.getElements().length);
+ fAffectedLocations= new HashMap(selection != null ? selection.length : result.getElements().length);
fReplaceString= null;
}
@@ -257,15 +258,17 @@ public class ReplaceRefactoring extends Refactoring {
}
private boolean isAlreadyCollected(FileMatch match) {
- URI uri= match.getFile().getLocationURI();
+ IFile file= match.getFile();
+ URI uri= file.getLocationURI();
if (uri == null)
return false;
- for (Iterator iter= fAffectedLocations.iterator(); iter.hasNext();) {
+ for (Iterator iter= fAffectedLocations.keySet().iterator(); iter.hasNext();) {
if (URIUtil.equals((URI)iter.next(), uri))
- return true;
+ return !file.equals(fAffectedLocations.get(uri));
}
- fAffectedLocations.add(uri);
+
+ fAffectedLocations.put(uri, file);
return false;
}

Back to the top