void () { MessageBusConnection connection = myProject.getMessageBus().connect(); connection.subscribe(FileDocumentManagerListener.TOPIC, new FileDocumentManagerListener() { @Override public void fileContentReloaded(@NotNull VirtualFile file, @NotNull Document document) { myFilesToCheck.remove(file); if (myEditedGeneratedFiles.remove(file)) { EditorNotifications.getInstance(myProject).updateNotifications(file); } } }); connection.subscribe(FileEditorManagerListener.FILE_EDITOR_MANAGER, new FileEditorManagerListener() { @Override public void fileClosed(@NotNull FileEditorManager source, @NotNull VirtualFile file) { myEditedGeneratedFiles.remove(file); } }); connection.subscribe(ModuleRootListener.TOPIC, new ModuleRootListener() { @Override public void rootsChanged(@NotNull ModuleRootEvent event) { resetOnRootsChanged(); } }); connection.subscribe(AdditionalLibraryRootsListener.TOPIC, (presentableLibraryName, oldRoots, newRoots, libraryNameForDebug) -> resetOnRootsChanged()); }