diff --git a/platform/lang-impl/src/com/intellij/refactoring/introduce/inplace/OccurrencesChooser.java b/platform/lang-impl/src/com/intellij/refactoring/introduce/inplace/OccurrencesChooser.java index 128455e5656f..c3a852d9501f 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/introduce/inplace/OccurrencesChooser.java +++ b/platform/lang-impl/src/com/intellij/refactoring/introduce/inplace/OccurrencesChooser.java @@ -66,10 +66,15 @@ public class OccurrencesChooser { } public void showChooser(final T selectedOccurrence, final List allOccurrences, final Pass callback) { - Map> 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> occurrencesMap = Maps.newLinkedHashMap(); + occurrencesMap.put(ReplaceChoice.NO, Collections.singletonList(selectedOccurrence)); + occurrencesMap.put(ReplaceChoice.ALL, allOccurrences); + showChooser(callback, occurrencesMap); + } } public void showChooser(final Pass callback, final Map> occurrencesMap) {