void () { ApplicationManager.getApplication().getMessageBus().connect(this) .subscribe(MavenServerConnector.DOWNLOAD_LISTENER_TOPIC, myDownloadListener); ApplicationManager.getApplication().getMessageBus().connect(this) .subscribe(MavenIndex.INDEX_IS_BROKEN, new MavenSearchIndexListener(this)); if (ApplicationManager.getApplication().isUnitTestMode()) { MavenProjectsManager.getInstance(myProject).addProjectsTreeListener(new MavenProjectsTree.Listener() { @Override public void projectsUpdated(@NotNull List<Pair<MavenProject, MavenProjectChanges>> updated, @NotNull List<MavenProject> deleted) { DependencySearchService.getInstance(myProject).clearCache(); } @Override public void projectResolved(@NotNull Pair<MavenProject, MavenProjectChanges> projectWithChanges, @Nullable NativeMavenProjectHolder nativeMavenProject) { DependencySearchService.getInstance(myProject).clearCache(); } }, this); return; } MavenRepositoryProvider.EP_NAME.addChangeListener(() -> scheduleUpdateIndicesList(null), this); MavenProjectsManager projectsManager = MavenProjectsManager.getInstance(myProject); projectsManager.addProjectsTreeListener(new MavenProjectsTree.Listener() { @Override public void projectResolved(@NotNull Pair<MavenProject, MavenProjectChanges> projectWithChanges, @Nullable NativeMavenProjectHolder nativeMavenProject) { scheduleUpdateIndicesList(null); } }, this); }