You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2021/03/22 13:50:14 UTC

[GitHub] [netbeans] JaroslavTulach commented on a change in pull request #2823: Change invokeLaters to Mutex.EVENT.

JaroslavTulach commented on a change in pull request #2823:
URL: https://github.com/apache/netbeans/pull/2823#discussion_r598728741



##########
File path: java/java.source/src/org/netbeans/api/java/source/UiUtils.java
##########
@@ -377,27 +377,13 @@ private static boolean doOpen(FileObject fo, int offset) {
     }
     
     private static void doShow(final Line l, final int column) {
-        if (SwingUtilities.isEventDispatchThread()) {
-            l.show(ShowOpenType.OPEN, ShowVisibilityType.FOCUS, column);
-        } else {
-            SwingUtilities.invokeLater(new Runnable() {
-                public void run() {
-                    l.show(ShowOpenType.OPEN, ShowVisibilityType.FOCUS, column);
-                }
-            });
-        }
+        Mutex.EVENT.readAccess(() ->
+            l.show(ShowOpenType.OPEN, ShowVisibilityType.FOCUS, column)
+        );
     }
 
     private static void doOpen(final OpenCookie oc) {
-        if (SwingUtilities.isEventDispatchThread()) {
-            oc.open();
-        } else {
-            SwingUtilities.invokeLater(new Runnable() {
-                public void run() {
-                    oc.open();
-                }
-            });
-        }
+        Mutex.EVENT.readAccess(oc::open);

Review comment:
       Simplification as well.

##########
File path: java/java.source/src/org/netbeans/api/java/source/UiUtils.java
##########
@@ -377,27 +377,13 @@ private static boolean doOpen(FileObject fo, int offset) {
     }
     
     private static void doShow(final Line l, final int column) {
-        if (SwingUtilities.isEventDispatchThread()) {
-            l.show(ShowOpenType.OPEN, ShowVisibilityType.FOCUS, column);
-        } else {
-            SwingUtilities.invokeLater(new Runnable() {
-                public void run() {
-                    l.show(ShowOpenType.OPEN, ShowVisibilityType.FOCUS, column);
-                }
-            });
-        }
+        Mutex.EVENT.readAccess(() ->

Review comment:
       Simplification.

##########
File path: platform/core.windows/src/org/netbeans/core/windows/WindowManagerImpl.java
##########
@@ -1534,8 +1520,8 @@ public void run() {
                     FloatingWindowTransparencyManager.getDefault().start();
                 }
             });
-
-            SwingUtilities.invokeLater(getExclusive());
+            
+            Mutex.EVENT.postReadRequest(getExclusive());

Review comment:
       Yes, `postXYZRequest` is replacement for `invokeLater`.




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists