diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/ui/BranchActionGroupPopup.java b/platform/dvcs-impl/src/com/intellij/dvcs/ui/BranchActionGroupPopup.java index e867799a24ef..f4d66647f846 100644 --- a/platform/dvcs-impl/src/com/intellij/dvcs/ui/BranchActionGroupPopup.java +++ b/platform/dvcs-impl/src/com/intellij/dvcs/ui/BranchActionGroupPopup.java @@ -146,6 +146,11 @@ public class BranchActionGroupPopup extends FlatSpeedSearchPopup { ScrollingUtil.ensureSelectionExists(getList()); } + @Override + protected boolean shouldUseStatistics() { + return false; + } + protected boolean shouldBeShowing(@NotNull AnAction action) { if (!super.shouldBeShowing(action)) return false; if (getSpeedSearch().isHoldingFilter()) return !(action instanceof MoreAction); diff --git a/platform/platform-impl/src/com/intellij/ui/popup/list/ListPopupImpl.java b/platform/platform-impl/src/com/intellij/ui/popup/list/ListPopupImpl.java index a86fffb08cdc..88568a2d0b01 100644 --- a/platform/platform-impl/src/com/intellij/ui/popup/list/ListPopupImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/popup/list/ListPopupImpl.java @@ -156,6 +156,10 @@ public class ListPopupImpl extends WizardPopup implements ListPopup { return false; } + protected boolean shouldUseStatistics() { + return true; + } + private boolean autoSelectUsingStatistics() { final String filter = getSpeedSearch().getFilter(); if (!StringUtil.isEmpty(filter)) { @@ -405,11 +409,13 @@ public class ListPopupImpl extends WizardPopup implements ListPopup { } private void valuesSelected(final Object[] values) { - final String filter = getSpeedSearch().getFilter(); - if (!StringUtil.isEmpty(filter)) { - for (Object value : values) { - final String text = getListStep().getTextFor(value); - StatisticsManager.getInstance().incUseCount(new StatisticsInfo("#list_popup:" + getListStep().getTitle() + "#" + filter, text)); + if (shouldUseStatistics()) { + final String filter = getSpeedSearch().getFilter(); + if (!StringUtil.isEmpty(filter)) { + for (Object value : values) { + final String text = getListStep().getTextFor(value); + StatisticsManager.getInstance().incUseCount(new StatisticsInfo("#list_popup:" + getListStep().getTitle() + "#" + filter, text)); + } } } } @@ -588,19 +594,23 @@ public class ListPopupImpl extends WizardPopup implements ListPopup { protected void onSpeedSearchPatternChanged() { myListModel.refilter(); if (myListModel.getSize() > 0) { - if (!autoSelectUsingStatistics()) { - int fullMatchIndex = myListModel.getClosestMatchIndex(); - if (fullMatchIndex != -1) { - myList.setSelectedIndex(fullMatchIndex); - } - - if (myListModel.getSize() <= myList.getSelectedIndex() || !myListModel.isVisible(myList.getSelectedValue())) { - myList.setSelectedIndex(0); - } + if (!(shouldUseStatistics() && autoSelectUsingStatistics())) { + selectBestMatch(); } } } + private void selectBestMatch() { + int fullMatchIndex = myListModel.getClosestMatchIndex(); + if (fullMatchIndex != -1) { + myList.setSelectedIndex(fullMatchIndex); + } + + if (myListModel.getSize() <= myList.getSelectedIndex() || !myListModel.isVisible(myList.getSelectedValue())) { + myList.setSelectedIndex(0); + } + } + @Override protected void onSelectByMnemonic(Object value) { if (myListModel.isVisible(value)) {