don't show chooser if single occurrence

This commit is contained in:
Dmitry Jemerov
2011-08-26 16:02:18 +02:00
parent c1ea3953b1
commit 9823062c8a
@@ -66,10 +66,15 @@ public class OccurrencesChooser<T extends PsiElement> {
}
public void showChooser(final T selectedOccurrence, final List<T> allOccurrences, final Pass<ReplaceChoice> callback) {
Map<ReplaceChoice, List<T>> occurrencesMap = Maps.newLinkedHashMap();
occurrencesMap.put(ReplaceChoice.NO, Collections.singletonList(selectedOccurrence));
occurrencesMap.put(ReplaceChoice.ALL, allOccurrences);
showChooser(callback, occurrencesMap);
if (allOccurrences.size() == 1) {
callback.pass(ReplaceChoice.ALL);
}
else {
Map<ReplaceChoice, List<T>> occurrencesMap = Maps.newLinkedHashMap();
occurrencesMap.put(ReplaceChoice.NO, Collections.singletonList(selectedOccurrence));
occurrencesMap.put(ReplaceChoice.ALL, allOccurrences);
showChooser(callback, occurrencesMap);
}
}
public void showChooser(final Pass<ReplaceChoice> callback, final Map<ReplaceChoice, List<T>> occurrencesMap) {