final void notifyExecutionCompleted() { executedInEDT(); if (executionNotification == null) { return; } executionNotification.countDown(); executionNotification = null; }
private static void run(@Nonnull final GuiAction action) { if (isEventDispatchThread()) { action.run(); return; } final CountDownLatch latch = new CountDownLatch(1); action.executionNotification(latch); invokeLater(action); try { latch.await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } }
/** * Wraps, with a {@link org.assertj.swing.exception.UnexpectedException}, and re-throws any caught exception in the given action. * * @param action the given action that may have a caught exception during its execution. * @throws org.assertj.swing.exception.UnexpectedException wrapping any <b>checked</b> exception thrown when executing the given query in the * event dispatch thread (EDT). Unchecked exceptions are re-thrown without any wrapping. */ private static void rethrowCaughtExceptionIn(@Nonnull GuiAction action) { Throwable caughtException = action.catchedException(); action.clearCaughtException(); if (caughtException == null) { return; } if (caughtException instanceof RuntimeException) { appendStackTraceInCurrentThreadToThrowable(caughtException, "execute"); throw (RuntimeException) caughtException; } if (caughtException instanceof Error) { caughtException.fillInStackTrace(); throw (Error) caughtException; } throw unexpected(caughtException); } }