mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
IJPL-175726 Find in Files: make it possible to track when search has finished
GitOrigin-RevId: 5afa06ee19d5821ba68a5b5def97017947db62c2
This commit is contained in:
committed by
intellij-monorepo-bot
parent
572f29bb66
commit
dd5ff89e56
@@ -1340,14 +1340,17 @@ public final class FindPopupPanel extends JBPanel<FindPopupPanel> implements Fin
|
||||
|
||||
public void onFinish() {
|
||||
ApplicationManager.getApplication().invokeLater(() -> {
|
||||
boolean isEmpty = resultsCount.get() == 0;
|
||||
|
||||
if (!isCancelled()) {
|
||||
boolean isEmpty = resultsCount.get() == 0;
|
||||
if (isEmpty) {
|
||||
showEmptyText(FindBundle.message("message.nothingFound"), true);
|
||||
}
|
||||
}
|
||||
FindUsagesCollector.recordSearchFinished(System.currentTimeMillis() - startTime.get(), resultsCount.get(), ShowUsagesAction.getUsagesPageSize());
|
||||
onStop(hash);
|
||||
|
||||
myHelper.onSearchFinish(isEmpty ? 0 : myResultsPreviewTable.getRowCount());
|
||||
}, state);
|
||||
}
|
||||
}, myResultsPreviewSearchProgress);
|
||||
@@ -1572,7 +1575,6 @@ public final class FindPopupPanel extends JBPanel<FindPopupPanel> implements Fin
|
||||
if (backendValidator.isFinished) {
|
||||
header.loadingIcon.setIcon(EmptyIcon.ICON_16);
|
||||
}
|
||||
myHelper.onSearchStop();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
public final class FindUIHelper implements Disposable {
|
||||
@@ -23,7 +24,7 @@ public final class FindUIHelper implements Disposable {
|
||||
private @NotNull FindModel myModel;
|
||||
FindModel myPreviousModel;
|
||||
private @NotNull Runnable myOkHandler;
|
||||
private @Nullable Runnable myStopHandler;
|
||||
private @Nullable Consumer<Integer> myFinishHandler;
|
||||
|
||||
FindUI myUI;
|
||||
|
||||
@@ -172,14 +173,14 @@ public final class FindUIHelper implements Disposable {
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public void setStopHandler(@Nullable Runnable stopHandler) {
|
||||
myStopHandler = stopHandler;
|
||||
public void setFinishHandler(@Nullable Consumer<Integer> finishHandler) {
|
||||
myFinishHandler = finishHandler;
|
||||
}
|
||||
|
||||
@ApiStatus.Internal
|
||||
public void onSearchStop() {
|
||||
if (myStopHandler != null) {
|
||||
myStopHandler.run();
|
||||
public void onSearchFinish(int count) {
|
||||
if (myFinishHandler != null) {
|
||||
myFinishHandler.accept(count);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ class FindInFilesCommand(text: String, line: Int) : PlaybackCommandCoroutineAdap
|
||||
val findSpan = PerformanceTestSpan.TRACER.spanBuilder("$SEARCH_SPAN_NAME: $it").startSpan()
|
||||
val findMutex = Mutex(true)
|
||||
|
||||
findHelper.setStopHandler {
|
||||
findHelper.setFinishHandler { resultsCount ->
|
||||
findSpan.end()
|
||||
findHelper.closeUI()
|
||||
findMutex.unlock()
|
||||
|
||||
Reference in New Issue
Block a user