neilcsmith-net commented on code in PR #9776:
URL: https://github.com/apache/netbeans/pull/9776#discussion_r4494153944
##########
ide/projectui/src/org/netbeans/modules/project/ui/actions/LookupSensitiveAction.java:
##########
@@ -61,6 +62,15 @@ abstract class LookupSensitiveAction extends BasicAction
implements Runnable, Lo
private boolean refreshing = false;
+ private volatile Lookup pendingContext;
Review Comment:
What's this about? IIRC `lookup` in this class can and should be `final`?
##########
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:
Methods that may or may not be on the EDT are a pet hate of mine. Why not
schedule this back on to the EDT for all refresh calls?
--
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