- Timestamp:
- 2016-05-10T14:18:05+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/util/GuiHelper.java
r10164 r10172 43 43 import javax.swing.JOptionPane; 44 44 import javax.swing.JPanel; 45 import javax.swing.JPopupMenu; 45 46 import javax.swing.JScrollPane; 46 47 import javax.swing.Scrollable; … … 478 479 */ 479 480 public static Window getWindowAncestorFor(EventObject e) { 480 return e != null && e.getSource() instanceof Component ? SwingUtilities.getWindowAncestor((Component) e.getSource()) : null; 481 if (e != null) { 482 Object source = e.getSource(); 483 if (source instanceof Component) { 484 Window ancestor = SwingUtilities.getWindowAncestor((Component) source); 485 if (ancestor != null) { 486 return ancestor; 487 } else { 488 Container parent = ((Component) source).getParent(); 489 if (parent instanceof JPopupMenu) { 490 Component invoker = ((JPopupMenu) parent).getInvoker(); 491 return SwingUtilities.getWindowAncestor(invoker); 492 } 493 } 494 } 495 } 496 return null; 481 497 } 482 498
Note:
See TracChangeset
for help on using the changeset viewer.