private static void addCurrentlySelectedItemToTop( Lookup lookup, List<LookupElement> items, LinkedHashSet<LookupElement> model) { if (!lookup.isSelectionTouched()) { LookupElement lastSelection = lookup.getCurrentItem(); if (ContainerUtil.indexOfIdentity(items, lastSelection) >= 0) { model.add(lastSelection); } } }
public static StatisticsUpdate collectStatisticChanges(LookupElement item, final Lookup lookup) { applyLastCompletionStatisticsUpdate(); final StatisticsInfo base = StatisticsWeigher.getBaseStatisticsInfo(item, null); if (base == StatisticsInfo.EMPTY) { return new StatisticsUpdate(StatisticsInfo.EMPTY); } StatisticsUpdate update = new StatisticsUpdate( StatisticsWeigher.composeStatsWithPrefix(base, lookup.itemPattern(item), true)); ourPendingUpdate = update; Disposer.register( update, new Disposable() { @Override public void dispose() { //noinspection AssignmentToStaticFieldFromInstanceMethod ourPendingUpdate = null; } }); return update; }