void () { runWithReparseDelay(0, () -> { configureByText(PlainTextFileType.INSTANCE, ""); Editor editor = getEditor(); Set<Editor> applied = Collections.synchronizedSet(new HashSet<>()); Set<Editor> collected = Collections.synchronizedSet(new HashSet<>()); DocumentUtil.executeInBulk(editor.getDocument(), () -> { registerFakePass(applied, collected); EditorTracker editorTracker = EditorTracker.getInstance(myProject); setActiveEditors(editor); assertTrue(editorTracker.getActiveEditors().contains(editor)); assertSame(editor, FileEditorManager.getInstance(myProject).getSelectedTextEditor()); applied.clear(); collected.clear(); myDaemonCodeAnalyzer.restart(); // try to restart daemon long start = System.currentTimeMillis(); while (System.currentTimeMillis() < start + 5000) { assertEmpty(applied); // it must not restart assertEmpty(collected); UIUtil.dispatchAllInvocationEvents(); } }); applied.clear(); collected.clear(); myDaemonCodeAnalyzer.restart(); // try to restart daemon long start = System.currentTimeMillis(); while (System.currentTimeMillis() < start + 5000 && applied.isEmpty()) { UIUtil.dispatchAllInvocationEvents(); } assertNotEmpty(applied); // it must restart outside bulk assertNotEmpty(collected); }); }