diff --git a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNameBase.java b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNameBase.java index a31b0b61e9f9..f9a5934b4e13 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNameBase.java +++ b/platform/lang-impl/src/com/intellij/ide/util/gotoByName/ChooseByNameBase.java @@ -1200,33 +1200,12 @@ public abstract class ChooseByNameBase { } protected List getChosenElements() { - - List values = new ArrayList(Arrays.asList(myList.getSelectedValues())); - values.remove(EXTRA_ELEM); - values.remove(NON_PREFIX_SEPARATOR); - - if (myCalcElementsThread == null || !values.isEmpty()) { - return values; - } - - final String text = myTextField.getText(); - if (text.length() == 0) return Collections.emptyList(); - final boolean checkBoxState = myCheckBox.isSelected(); - final String[] names = ourLoadNamesEachTime ? ensureNamesLoaded(checkBoxState) : getNamesSync(checkBoxState); - if (names == null) return Collections.emptyList(); - - Object uniqueElement = null; - - for (final String name : names) { - if (text.equalsIgnoreCase(name)) { - final Object[] elements = myModel.getElementsByName(name, checkBoxState, text); - if (elements.length > 1) return Collections.emptyList(); - if (elements.length == 0) continue; - if (uniqueElement != null) return Collections.emptyList(); - uniqueElement = elements[0]; + return ContainerUtil.filter(myList.getSelectedValues(), new Condition() { + @Override + public boolean value(Object o) { + return o != EXTRA_ELEM && o != NON_PREFIX_SEPARATOR; } - } - return uniqueElement == null ? Collections.emptyList() : Collections.singletonList(uniqueElement); + }); } protected void chosenElementMightChange() {