/** * Runs this task action and verifies that it is executed in the event dispatch thread (EDT). * * @throws ActionFailedException if this task was not executed in the EDT. */ @Override public final void run() { if (!isEventDispatchThread()) { throw ActionFailedException.actionFailure("Task should be executed in the event dispatch thread"); } try { executeInEDT(); } catch (Throwable t) { catchedException(t); } finally { notifyExecutionCompleted(); } }
private static void executeInCurrentThread(@Nonnull GuiTask task) { try { task.executeInEDT(); } catch (Throwable e) { throw unexpected(e); } }