neilcsmith-net commented on code in PR #6294:
URL: https://github.com/apache/netbeans/pull/6294#discussion_r1283433991
##########
platform/core.windows/src/org/netbeans/core/windows/services/DialogDisplayerImpl.java:
##########
@@ -130,19 +137,24 @@ public Dialog run () {
private Window findDialogParent() {
Component parentComponent = Utilities.findDialogParent(null);
- if (parentComponent instanceof Window) {
- return (Window) parentComponent;
- }
- Window parent = null;
- if (parentComponent != null) {
- parent = SwingUtilities.windowForComponent(parentComponent);
- }
- if (parent == null || parent instanceof NbPresenter && ((NbPresenter)
parent).isLeaf ()) {
+ Window parent = findDialogParent(parentComponent);
+ if (parent == null || parent == JOptionPane.getRootFrame()
+ || parent instanceof NbPresenter && ((NbPresenter)
parent).isLeaf()) {
return WindowManager.getDefault().getMainWindow();
}
return parent;
}
+ private Window findDialogParent(Component component) {
+ if (component == null) {
+ return null;
+ }
+ if (component instanceof Frame || component instanceof Dialog) {
+ return (Window) component;
+ }
+ return findDialogParent(component.getParent());
+ }
+
Review Comment:
It was easier to split out like this. Unfortunately
`JOptionPane::getFrameForComponent` is public, but
`JOptionPane::getWindowForComponent` (which does similar to this) is not.
--
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