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


##########
platform/openide.explorer/src/org/netbeans/modules/openide/explorer/ExplorerActionsImpl.java:
##########
@@ -557,34 +565,15 @@ public void actionPerformed(ActionEvent e) {
             Utilities.disabledActionBeep();
         }
 
+        /*
+        * Returns the current paste types without waiting for a pending
+        * update, so that it is safe to call on the AWT thread from
+        * listeners reacting to action state changes. Use
+        * {@link #actionPerformed} when up-to-date types are required.
+        */
         @Override
         public Object getValue(String s) {
             if ("delegates".equals(s)) { // NOI18N
-                String prev = "";

Review Comment:
   - Hard to foresee the consequences of this _"await check"_ removal. 
   - It is good to know it fixes the _slow clipboard problem_
   - but it can break anything anywhere...



##########
platform/openide.explorer/src/org/netbeans/modules/openide/explorer/ExplorerActionsImpl.java:
##########
@@ -869,7 +858,9 @@ private void schedule() {
             cutActionPerformer.toEnabled(false);
             deleteActionPerformerConfirm.toEnabled(false);
             deleteActionPerformerNoConfirm.toEnabled(false);
-            pasteActionPerformer.toEnabled(false);
+            // paste types are unknown until the update runs, so drop the
+            // stale ones as well; setPasteTypes(null) also force-disables
+            pasteActionPerformer.setPasteTypes(null);

Review Comment:
   - immediately setting the state to "unknown" is correct, but then:
   - some code must wait for the state to become known...
      - for example `OwnPaste.actionPerformed`!?
   - I don't see such a change



##########
platform/openide.explorer/test/unit/src/org/openide/explorer/ExplorerActionsImplTest.java:
##########
@@ -120,6 +118,9 @@ public void testPasteActionGetDelegatesBlocks() throws 
Exception {
         assertNull("No delegates yet", action.getValue("delegates"));
 
         em.setSelectedNodes(new Node[] { ch3 });
+        // "delegates" is a non-blocking read of the current paste types,
+        // so wait for the asynchronous action update to finish first
+        em.waitActionsFinished();

Review Comment:
   - is this an example of something that got broken ...
   - due to ["delegates" returning 
immediately](https://github.com/apache/netbeans/pull/9772/changes#r4434654918)?



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