mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-207411 Search Everywhere: Add sorting by element priority
This commit is contained in:
+2
-8
@@ -1260,14 +1260,8 @@ public class SearchEverywhereUI extends BigPopupUI implements DataProvider, Quic
|
||||
return isMoreElement(index) ? index : index + 1;
|
||||
}
|
||||
|
||||
//todo binary search
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (list.get(i).getSortWeight() > contributor.getSortWeight()) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return listElements.size();
|
||||
index = Collections.binarySearch(list, contributor, Comparator.comparingInt(SearchEverywhereContributor::getSortWeight));
|
||||
return -index - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -26,8 +26,8 @@ public class SearchModelTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
|
||||
// adding to empty -----------------------------------------------------------------------
|
||||
model.addElements(Arrays.asList(
|
||||
new SESearcher.ElementInfo("item_3_20", 340, STUB_CONTRIBUTOR_3),
|
||||
new SESearcher.ElementInfo("item_2_20", 250, STUB_CONTRIBUTOR_2),
|
||||
new SESearcher.ElementInfo("item_3_20", 340, STUB_CONTRIBUTOR_3),
|
||||
new SESearcher.ElementInfo("item_1_20", 160, STUB_CONTRIBUTOR_1),
|
||||
new SESearcher.ElementInfo("item_3_30", 330, STUB_CONTRIBUTOR_3),
|
||||
new SESearcher.ElementInfo("item_2_10", 280, STUB_CONTRIBUTOR_2),
|
||||
|
||||
Reference in New Issue
Block a user