void (@NotNull final ConfigurationError error, @NotNull final Project project, @NotNull final PairProcessor<? super ConfigurationErrors, ? super ConfigurationError> fun) { if (!project.isInitialized()) { StartupManager.getInstance(project).runWhenProjectIsInitialized( () -> fun.process(project.getMessageBus().syncPublisher(TOPIC), error)); return; } final MessageBus bus = project.getMessageBus(); if (EventQueue.isDispatchThread()) fun.process(bus.syncPublisher(TOPIC), error); else { //noinspection SSBasedInspection SwingUtilities.invokeLater(() -> fun.process(bus.syncPublisher(TOPIC), error)); } }