mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[platform]: ability to switch off statistics in listPopup autoselection
* (IDEA-166730) Switch off statistics for BranchPopup;
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user