void () { if (!requiresSmartMode() || !DumbService.isDumb(myProject)) return; AtomicBoolean canProceedWithTests = new AtomicBoolean(); ApplicationManager.getApplication().invokeAndWait(() -> { JLabel component = new JLabel(new HtmlBuilder() .appendRaw(ExecutionBundle.message("tests.wait.or.use.partial.index")) .wrapWithHtmlBody() .toString()); DialogWrapper dialog = new DialogWrapper(myProject) { { setTitle(IndexingBundle.message("progress.indexing.updating")); setOKButtonText(ExecutionBundle.message("test.button.run.with.partial.index")); init(); LaterInvocator.markTransparent(ModalityState.stateForComponent(component)); } @Override protected JComponent createCenterPanel() { return component; } }; myProject.getMessageBus().connect(dialog.getDisposable()).subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() { @Override public void exitDumbMode() { canProceedWithTests.set(true); Window window = ComponentUtil.getWindow(component); if (window != null) { window.setVisible(false); } } }); if (dialog.showAndGet()) { myAllowIndexInDumbMode = true; canProceedWithTests.set(true); } }); if (canProceedWithTests.get()) { return; } throw new ProcessCanceledException(); }