mbien commented on code in PR #9776:
URL: https://github.com/apache/netbeans/pull/9776#discussion_r4440339185
##########
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:
yes but: the mock was already there + the alternative is to modify the test
cases and add a "sleep until value refreshed" - which isn't great either IMO.
maybe we could add a single test case which tests the delay specifically,
that test would wait for refresh. Rest is using the synced mock.
--
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