neilcsmith-net commented on code in PR #9776:
URL: https://github.com/apache/netbeans/pull/9776#discussion_r4496628934


##########
ide/projectui/src/org/netbeans/modules/project/ui/actions/LookupSensitiveAction.java:
##########
@@ -164,28 +174,50 @@ private void doRefresh(boolean immediate) {
                 
r.setResourceBundle(NbBundle.getBundle(LookupSensitiveAction.class));
                 r.setParameters(new Object[]{
                     getClass(),
-                    lookup
+                    context
                 });
                 r.setLoggerName(LOG.getName());
                 LOG.log(r);
             }
-            refresh(lookup, immediate);
+            refresh(context);
         } finally {
             refreshing = false;
         }
         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.
+     *
+     * <p>Invoked on a background (request processor) thread for
+     * scheduled refreshes, or synchronously on the calling thread
+     * (usually the EDT) when {@link #isEnabled()} or
+     * {@link #getValue(String)} forces a refresh of stale state.
      */
-    protected abstract void refresh(Lookup context, boolean immediate);
+    protected abstract void refresh(Lookup context);

Review Comment:
   Nice :airplane: reference.
   
   I just have concerns about mixing the coalescing and background processing.  
I realise it was before, but it seems (even) more confusing now.  There were 
some threading issues before, which I think you've partly fixed here.  But eg. 
`SetMainProject` still looks problematic?
   
   Splitting into a background and EDT method seem awkward.  `CompletionStage`s 
as mentioned above might work.  Or something like `refresh(Lookup lkp, Executor 
edt);` or `refresh(Lookup lkp, Consumer<Runnable> edt);` that passes a wrapper 
to `Mutex.EVENT.writeAccess()` ???
   
   



-- 
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