mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-166464 Be able to merge usage from the same line in the "find in path" preview pane dialog
This commit is contained in:
@@ -824,6 +824,7 @@ public class FindPopupPanel extends JBPanel implements FindUI, DataProvider {
|
||||
final FindUsagesProcessPresentation processPresentation =
|
||||
FindInProjectUtil.setupProcessPresentation(myProject, showPanelIfOnlyOneUsage, presentation);
|
||||
Ref<VirtualFile> lastUsageFileRef = new Ref<>();
|
||||
Ref<Usage> recentUsageRef = new Ref<>();
|
||||
|
||||
FindInProjectUtil.findUsages(myHelper.getModel().clone(), myProject, info -> {
|
||||
if(isCancelled()) {
|
||||
@@ -838,12 +839,26 @@ public class FindPopupPanel extends JBPanel implements FindUI, DataProvider {
|
||||
resultsFilesCount.incrementAndGet();
|
||||
lastUsageFileRef.set(usageFile);
|
||||
}
|
||||
final boolean merged;
|
||||
Usage recent = recentUsageRef.get();
|
||||
UsageInfo2UsageAdapter recentAdapter =
|
||||
recent != null && recent instanceof UsageInfo2UsageAdapter ? (UsageInfo2UsageAdapter)recent : null;
|
||||
UsageInfo2UsageAdapter currentAdapter = usage instanceof UsageInfo2UsageAdapter ? (UsageInfo2UsageAdapter)usage : null;
|
||||
if (currentAdapter != null && recentAdapter != null && recentAdapter.getFile().equals(usageFile) && recentAdapter.getLine() == currentAdapter.getLine()) {
|
||||
merged = recentAdapter.merge(currentAdapter);
|
||||
} else {
|
||||
merged = false;
|
||||
}
|
||||
recentUsageRef.set(usage);
|
||||
|
||||
|
||||
ApplicationManager.getApplication().invokeLater(() -> {
|
||||
if(isCancelled()) {
|
||||
return;
|
||||
}
|
||||
model.addRow(new Object[]{usage});
|
||||
if (!merged) {
|
||||
model.addRow(new Object[]{usage});
|
||||
}
|
||||
myCodePreviewComponent.setVisible(true);
|
||||
if (model.getRowCount() == 1 && myResultsPreviewTable.getModel() == model) {
|
||||
myResultsPreviewTable.setRowSelectionInterval(0, 0);
|
||||
|
||||
Reference in New Issue
Block a user