This is an automated email from the ASF dual-hosted git repository.

junichi11 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 41c0624  [NETBEANS-5048] PHP - cancel Find Usages action
     new 53dfbbe  Merge pull request #2550 from 
KacerCZ/netbeans-5048-cancel-find-usages
41c0624 is described below

commit 41c0624385e59a4eee957db6e941e12a67fdbc3f
Author: Tomas Prochazka <ka...@razdva.cz>
AuthorDate: Sat Nov 21 06:56:53 2020 +0100

    [NETBEANS-5048] PHP - cancel Find Usages action
    
    https://issues.apache.org/jira/browse/NETBEANS-5048
    
    Allows to cancel Find Usages action in PHP editor.
---
 .../refactoring/php/findusages/PhpWhereUsedQueryPlugin.java        | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git 
a/php/php.refactoring/src/org/netbeans/modules/refactoring/php/findusages/PhpWhereUsedQueryPlugin.java
 
b/php/php.refactoring/src/org/netbeans/modules/refactoring/php/findusages/PhpWhereUsedQueryPlugin.java
index 36573df..6ec637c 100644
--- 
a/php/php.refactoring/src/org/netbeans/modules/refactoring/php/findusages/PhpWhereUsedQueryPlugin.java
+++ 
b/php/php.refactoring/src/org/netbeans/modules/refactoring/php/findusages/PhpWhereUsedQueryPlugin.java
@@ -40,6 +40,7 @@ public class PhpWhereUsedQueryPlugin extends 
ProgressProviderAdapter implements
 
     protected AbstractRefactoring refactoring;
     private WhereUsedSupport usages;
+    private volatile boolean cancelled;
 
     public PhpWhereUsedQueryPlugin(AbstractRefactoring refactoring) {
         this.refactoring = refactoring;
@@ -63,6 +64,11 @@ public class PhpWhereUsedQueryPlugin extends 
ProgressProviderAdapter implements
                 if (fileObject == null) {
                     continue;
                 }
+                if (cancelled) {
+                    // Reset cancelled state for repeated search to work.
+                    cancelled = false;
+                    break;
+                }
                 usages.collectUsages(fileObject);
                 fireProgressListenerStep();
             }
@@ -127,6 +133,7 @@ public class PhpWhereUsedQueryPlugin extends 
ProgressProviderAdapter implements
 
     @Override
     public void cancelRequest() {
+        cancelled = true;
     }
 
     /**


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to