mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[find usages] reuse precalculated presentation in popup
- to avoid psi access in EDT ^KTIJ-29277 fixed GitOrigin-RevId: 398cd929a24bd30cb0643d94301c5927ec4273bf
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5000e32a42
commit
222677861a
@@ -38,4 +38,17 @@ public final class UsageHistory {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public @NotNull Map<ConfigurableUsageTarget, String> getAllHistoryData() {
|
||||
synchronized (myHistory) {
|
||||
final Set<ConfigurableUsageTarget> entries = myHistory.keySet();
|
||||
for (Iterator<ConfigurableUsageTarget> iterator = entries.iterator(); iterator.hasNext(); ) {
|
||||
final ConfigurableUsageTarget target = iterator.next();
|
||||
if (!target.isValid()) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
return myHistory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,7 @@ import com.intellij.usages.UsageView;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
|
||||
public final class ShowRecentFindUsagesAction extends AnAction implements ActionRemoteBehaviorSpecification.Frontend {
|
||||
|
||||
@@ -43,8 +40,9 @@ public final class ShowRecentFindUsagesAction extends AnAction implements Action
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
UsageView usageView = e.getData(UsageView.USAGE_VIEW_KEY);
|
||||
Project project = Objects.requireNonNull(e.getProject());
|
||||
final FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(project)).getFindUsagesManager();
|
||||
List<ConfigurableUsageTarget> history = new ArrayList<>(findUsagesManager.getHistory().getAll());
|
||||
FindUsagesManager findUsagesManager = ((FindManagerImpl)FindManager.getInstance(project)).getFindUsagesManager();
|
||||
Map<ConfigurableUsageTarget, String> historyData = findUsagesManager.getHistory().getAllHistoryData();
|
||||
List<ConfigurableUsageTarget> history = new ArrayList<>(historyData.keySet());
|
||||
|
||||
if (!history.isEmpty()) {
|
||||
// skip most recent find usage, it's under your nose
|
||||
@@ -68,7 +66,7 @@ public final class ShowRecentFindUsagesAction extends AnAction implements Action
|
||||
if (data == null) {
|
||||
return FindBundle.message("recent.find.usages.action.nothing");
|
||||
}
|
||||
return data.getLongDescriptiveName();
|
||||
return historyData.get(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user