void (@NotNull Runnable runnable, @NotNull ModalityState modalityState) { if (isDispatchThread()) { runnable.run(); } else { try { SwingUtilities.invokeAndWait(runnable); } catch (Exception e) { throw new RuntimeException(e); } } }