void (@NotNull Map<VirtualFile, VcsLogProvider> logProviders, @NotNull PostponableLogRefresher refresher, @NotNull Disposable disposableParent) { MultiMap<VcsLogProvider, VirtualFile> providers2roots = MultiMap.create(); logProviders.forEach((key, value) -> providers2roots.putValue(value, key)); VcsLogRefresher wrappedRefresher = root -> { ApplicationManager.getApplication().invokeLater(() -> { refresher.refresh(root); }, ModalityState.any()); }; for (Map.Entry<VcsLogProvider, Collection<VirtualFile>> entry : providers2roots.entrySet()) { Disposable disposable = entry.getKey().subscribeToRootRefreshEvents(entry.getValue(), wrappedRefresher); Disposer.register(disposableParent, disposable); } }