Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Pazderski2019-08-21 04:40:06 -0400
committerMickael Istria2019-08-24 08:02:53 -0400
commitc58c96bcb725d38350343f31c7a8988853f19709 (patch)
treedc0a63049a5de14730a85e3bc17e7a3f13310e57
parent6d137808ffa01c81210628d07255fe733d3a41a7 (diff)
downloadeclipse.platform.text-c58c96bcb725d38350343f31c7a8988853f19709.tar.gz
eclipse.platform.text-c58c96bcb725d38350343f31c7a8988853f19709.tar.xz
eclipse.platform.text-c58c96bcb725d38350343f31c7a8988853f19709.zip
Bug 550261 - "Searching..." does not stop in Quick Search dialog
Recognize a search which is suspended due to max number of results as inactive. Change-Id: Iee6c5dfb0d6e9eab7273d67ed67c194a9338850a Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
-rw-r--r--org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/core/QuickTextSearcher.java12
-rw-r--r--org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchDialog.java2
2 files changed, 11 insertions, 3 deletions
diff --git a/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/core/QuickTextSearcher.java b/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/core/QuickTextSearcher.java
index 735553954..cbed465c5 100644
--- a/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/core/QuickTextSearcher.java
+++ b/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/core/QuickTextSearcher.java
@@ -163,7 +163,7 @@ public class QuickTextSearcher {
@Override
public void resume() {
//Only resume if we don't already exceed the maxResult limit.
- if (matches.size()<maxResults) {
+ if (isActive()) {
super.resume();
}
}
@@ -252,7 +252,7 @@ public class QuickTextSearcher {
private void add(LineItem line) {
if (matches.add(line)) {
requestor.add(line);
- if (matches.size() >= maxResults) {
+ if (!isActive()) {
walker.suspend();
}
}
@@ -294,6 +294,14 @@ public class QuickTextSearcher {
incrementalUpdate.schedule();
}
+ public boolean isActive() {
+ // Information for the job showing 'Searching ...' if we are still searching.
+ // The walker can be suspended for different reasons, not all of them count as
+ // inactive. The main situation where the walker is suspended and interpreted as
+ // inactive is when the max number of results are reached.
+ return !isDone() && matches.size() < maxResults;
+ }
+
public boolean isDone() {
//Walker can be null if job was canceled because dialog closed. But stuff like
//the job that shows 'Searching ...' doesn't instantly stop and may still
diff --git a/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchDialog.java b/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchDialog.java
index 785e7fdc5..eec298e52 100644
--- a/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchDialog.java
+++ b/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/QuickSearchDialog.java
@@ -196,7 +196,7 @@ public class QuickSearchDialog extends SelectionStatusDialog {
@Override
public IStatus runInUIThread(IProgressMonitor mon) {
if (!mon.isCanceled() && progressLabel!=null && !progressLabel.isDisposed()) {
- if (searcher==null || searcher.isDone()) {
+ if (searcher==null || !searcher.isActive()) {
progressLabel.setText(""); //$NON-NLS-1$
} else {
progressLabel.setText(NLS.bind(Messages.QuickSearchDialog_searching, currentFileInfo(searcher.getCurrentFile(), animate)));

Back to the top