errael commented on code in PR #5280:
URL: https://github.com/apache/netbeans/pull/5280#discussion_r1082924184


##########
platform/openide.util.ui/src/org/openide/util/Utilities.java:
##########
@@ -1325,6 +1323,25 @@ private static Rectangle 
findCenterBounds(GraphicsConfiguration gconf, Dimension
         );
     }
 
+    /**
+     * Find the main NetBeans window; must have width or height.
+     * This is used locally to avoid dependency issues. 
+     * @return NetBeans' main window
+     */
+    private static Frame findMainWindow()
+    {
+        Frame f = null;
+        for( Frame f01 : Frame.getFrames() ) {
+            if( "NbMainWindow".equals(f01.getName())) { //NOI18N

Review Comment:
   > Why doesn't WindowManager.getDefault().getMainWindow() work for this 
purpose?
   
   Since I didn't write the original code, I can only guess. BTW, the bug 
report that prompted the change is at 
https://bz.apache.org/netbeans/show_bug.cgi?id=217737 and the change was made 
by the window system guru at the time, AFAIK. I looked through emi's old repo, 
but didn't find the original commit.
   
   I thought it was at least partly a module dependency issue, but I could be 
wrong. Side effects is another consideration. `Utilities.findMainWindow` looks 
for an existing window, may return null. `WindowManager...getMainWindow()` 
creates the window if not found.



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