jtulach commented on code in PR #9776:
URL: https://github.com/apache/netbeans/pull/9776#discussion_r4463959988


##########
ide/projectui/src/org/netbeans/modules/project/ui/actions/LookupSensitiveAction.java:
##########
@@ -176,17 +180,34 @@ private void doRefresh(boolean immediate) {
         needsRefresh = false;
     }
 
-    // Abstract methods 
--------------------------------------------------------
-
     /** Called when the action is performed
      */
     protected abstract void actionPerformed( Lookup context );
 
-    /** Place where to change properties (enablement/name) when
-     *  the set of current projects changes.
+    /** 
+     * Place where to change properties (enablement/name) when
+     * the set of current projects changes.
      */
     protected abstract void refresh(Lookup context, boolean immediate);
 
+    /**
+     * Schedules a debounced refresh. Override (without calling super) to use 
custom scheduling.
+     */
+    protected void scheduleRefresh(Lookup context) {
+        if (sync) {
+            refresh(context, false);
+        } else {
+            needsRefresh = true;
+            pendingContext = context;
+            pendingRefresh.schedule(100);
+        }
+    }
+
+    /** For testing: makes {@link #scheduleRefresh} run synchronously. */
+    void setSynchronousRefresh(boolean sync) {

Review Comment:
   > the mock was already there
   
   What do you mean? The [sync 
field](https://github.com/apache/netbeans/pull/9776/changes#diff-8bd643c107bd74b9bf22ef25984f49ae41b07bc9420c7d30e11f811e33cd48acR63)
 seems to be newly added by this PR.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

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

Reply via email to