diff --git a/platform/platform-impl/src/com/intellij/ui/mac/MacMessagesImpl.java b/platform/platform-impl/src/com/intellij/ui/mac/MacMessagesImpl.java index 9e5c55465d5a..01e5f4340e52 100644 --- a/platform/platform-impl/src/com/intellij/ui/mac/MacMessagesImpl.java +++ b/platform/platform-impl/src/com/intellij/ui/mac/MacMessagesImpl.java @@ -321,7 +321,7 @@ public class MacMessagesImpl extends MacMessages { private static Window findDocumentRoot (final Component c) { if (c == null) return null; - Window w = (c instanceof Window) ? (Window)c : SunToolkit.getContainingWindow(c); + Window w = (c instanceof Window) ? (Window)c : getContainingWindow(c); synchronized (c.getTreeLock()) { while (w.getOwner() != null) { w = w.getOwner(); @@ -330,6 +330,15 @@ public class MacMessagesImpl extends MacMessages { return w; } + // This method is not available in jdk 1.6.0_6. Should be changed to the JDK implementation + // as soon as we will have switched on JDK 7. + private static Window getContainingWindow(Component comp) { + while (comp != null && !(comp instanceof Window)) { + comp = comp.getParent(); + } + return (Window)comp; + } + private static void startModal(final Window w, ID windowId) { synchronized (lock) { windowFromId.put(windowId.longValue(), w);