sdedic commented on code in PR #5361:
URL: https://github.com/apache/netbeans/pull/5361#discussion_r1088914174


##########
ide/db/src/org/netbeans/modules/db/explorer/action/ConnectAction.java:
##########
@@ -62,63 +63,63 @@
 import org.openide.awt.ActionReference;
 import org.openide.awt.ActionRegistration;
 import org.openide.awt.ActionState;
-import org.openide.awt.StatusDisplayer;
+import org.openide.util.ContextAwareAction;
 import org.openide.util.HelpCtx;
 import org.openide.util.Lookup;
 import org.openide.util.Mutex;
 import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
+import org.openide.util.WeakListeners;
 
 @ActionRegistration(
         displayName = "#Connect", 
-        lazy = false,
+        lazy = true,
+        asynchronous = true,

Review Comment:
   Yes. In NB IDE it does only a little harm, as waiting on the dialog creates 
a nested event loop, and everything incl the 'blocked' EDT thread works (as the 
nested event loop services events). 
   But in headless mode, if the [action's code 
blocks](https://github.com/apache/netbeans/pull/5361/files#diff-033fc81193b23efa97939feead127364383d694ff672ba7d5d1612c37cf499dfL331),
 the caller message handling thread blocks, so the LSP client gets no progress 
messages etc.
   
   There were two options, actually: explicit offload the work to a 
RequestProcessor if headless, or this one. I'd slightly prefer `asynchronous = 
true` as it allows (eventually) the infrastructure to track what actions are 
running (not used now).



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