mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
JDK 6 update 6 does not have SunToolkit.getContainingWindow(c) method.
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user