src/share/classes/java/awt/Dialog.java
Print this page
*** 38,47 ****
--- 38,48 ----
import sun.awt.SunToolkit;
import sun.awt.PeerEvent;
import sun.awt.util.IdentityArrayList;
import sun.awt.util.IdentityLinkedList;
import java.security.AccessControlException;
+ import java.util.function.BooleanSupplier;
/**
* A Dialog is a top-level window with a title and a border
* that is typically used to take some form of input from the user.
*
*** 1042,1058 ****
Component predictedFocusOwner = null;
try {
predictedFocusOwner = getMostRecentFocusOwner();
if (conditionalShow(predictedFocusOwner, time)) {
modalFilter = ModalEventFilter.createFilterForDialog(this);
- final Conditional cond = new Conditional() {
- @Override
- public boolean evaluate() {
- return windowClosingException == null;
- }
- };
-
// if this dialog is toolkit-modal, the filter should be added
// to all EDTs (for all AppContexts)
if (modalityType == ModalityType.TOOLKIT_MODAL) {
Iterator<AppContext> it = AppContext.getAppContexts().iterator();
while (it.hasNext()) {
--- 1043,1052 ----
*** 1061,1088 ****
continue;
}
EventQueue eventQueue = (EventQueue)appContext.get(AppContext.EVENT_QUEUE_KEY);
// it may occur that EDT for appContext hasn't been started yet, so
// we post an empty invocation event to trigger EDT initialization
! Runnable createEDT = new Runnable() {
! public void run() {};
! };
! eventQueue.postEvent(new InvocationEvent(this, createEDT));
EventDispatchThread edt = eventQueue.getDispatchThread();
edt.addEventFilter(modalFilter);
}
}
modalityPushed();
try {
final EventQueue eventQueue = AccessController.doPrivileged(
! new PrivilegedAction<EventQueue>() {
! public EventQueue run() {
! return Toolkit.getDefaultToolkit().getSystemEventQueue();
! }
! });
! secondaryLoop = eventQueue.createSecondaryLoop(cond, modalFilter, 0);
if (!secondaryLoop.enter()) {
secondaryLoop = null;
}
} finally {
modalityPopped();
--- 1055,1075 ----
continue;
}
EventQueue eventQueue = (EventQueue)appContext.get(AppContext.EVENT_QUEUE_KEY);
// it may occur that EDT for appContext hasn't been started yet, so
// we post an empty invocation event to trigger EDT initialization
! eventQueue.postEvent(new InvocationEvent(this, () -> {}));
EventDispatchThread edt = eventQueue.getDispatchThread();
edt.addEventFilter(modalFilter);
}
}
modalityPushed();
try {
final EventQueue eventQueue = AccessController.doPrivileged(
! (PrivilegedAction<EventQueue>) Toolkit.getDefaultToolkit()::getSystemEventQueue);
! secondaryLoop = eventQueue.createSecondaryLoop(() -> true, modalFilter, 0);
if (!secondaryLoop.enter()) {
secondaryLoop = null;
}
} finally {
modalityPopped();
*** 1100,1114 ****
EventQueue eventQueue = (EventQueue)appContext.get(AppContext.EVENT_QUEUE_KEY);
EventDispatchThread edt = eventQueue.getDispatchThread();
edt.removeEventFilter(modalFilter);
}
}
-
- if (windowClosingException != null) {
- windowClosingException.fillInStackTrace();
- throw windowClosingException;
- }
}
} finally {
if (predictedFocusOwner != null) {
// Restore normal key event dispatching
KeyboardFocusManager.getCurrentKeyboardFocusManager().
--- 1087,1096 ----
*** 1132,1151 ****
SunToolkit stk = (SunToolkit)tk;
stk.notifyModalityPopped(this);
}
}
- void interruptBlocking() {
- if (isModal()) {
- disposeImpl();
- } else if (windowClosingException != null) {
- windowClosingException.fillInStackTrace();
- windowClosingException.printStackTrace();
- windowClosingException = null;
- }
- }
-
private void hideAndDisposePreHandler() {
isInHide = true;
synchronized (getTreeLock()) {
if (secondaryLoop != null) {
modalHide();
--- 1114,1123 ----