/** * Executes the given query in the event dispatch thread (EDT). This method waits until the query has finished its * execution. * * @param query the query to execute. * @param <T> the return type of the action to execute. * @return the result of the query executed in the main thread. * @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. * @see #executeInEDT() * @see #execute(Callable) */ @Nullable public static <T> T execute(@Nonnull GuiQuery<T> query) { if (!executeInEDT) { return executeInCurrentThread(query); } run(query); return resultOf(query); }