void (ProcessEvent event) { Consumer<ProcessEvent> eventConsumer = onTerminate; if (eventConsumer != null) { eventConsumer.accept(event); } if (event.getExitCode() == 0) { return; } myImportEventProcessor.finish(); Project[] openProjects = ProjectManager.getInstance().getOpenProjects(); for (Project p : openProjects) { ReadAction.run(() -> { if (p.isDisposed()) { return; } MavenProjectsManager manager = MavenProjectsManager.getInstance(p); if (!manager.isMavenizedProject()) { return; } manager.terminateImport(event.getExitCode()); }); } }