diff --git a/java/idea-ui/src/com/intellij/codeInsight/daemon/impl/AttachSourcesNotificationProvider.java b/java/idea-ui/src/com/intellij/codeInsight/daemon/impl/AttachSourcesNotificationProvider.java index 430d5d5fc5ea..d857030e9433 100644 --- a/java/idea-ui/src/com/intellij/codeInsight/daemon/impl/AttachSourcesNotificationProvider.java +++ b/java/idea-ui/src/com/intellij/codeInsight/daemon/impl/AttachSourcesNotificationProvider.java @@ -1,7 +1,6 @@ // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.daemon.impl; -import com.intellij.ProjectTopics; import com.intellij.codeEditor.JavaEditorFileSwapper; import com.intellij.codeInsight.AttachSourcesProvider; import com.intellij.ide.highlighter.JavaClassFileType; @@ -18,7 +17,10 @@ import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectBundle; import com.intellij.openapi.projectRoots.JavaSdkVersion; -import com.intellij.openapi.roots.*; +import com.intellij.openapi.roots.LibraryOrderEntry; +import com.intellij.openapi.roots.OrderEntry; +import com.intellij.openapi.roots.OrderRootType; +import com.intellij.openapi.roots.ProjectFileIndex; import com.intellij.openapi.roots.libraries.Library; import com.intellij.openapi.roots.ui.configuration.LibrarySourceRootDetectorUtil; import com.intellij.openapi.ui.Messages; @@ -59,14 +61,14 @@ public class AttachSourcesNotificationProvider extends EditorNotifications.Provi private final Project myProject; + @Deprecated // todo remove when Scala removes its usage public AttachSourcesNotificationProvider(Project project, final EditorNotifications notifications) { myProject = project; - myProject.getMessageBus().connect(project).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() { - @Override - public void rootsChanged(@NotNull ModuleRootEvent event) { - notifications.updateAllNotifications(); - } - }); + } + + @SuppressWarnings("unused") + public AttachSourcesNotificationProvider(Project project) { + myProject = project; } @NotNull diff --git a/java/idea-ui/src/com/intellij/codeInsight/daemon/impl/LibrarySourceNotificationProvider.kt b/java/idea-ui/src/com/intellij/codeInsight/daemon/impl/LibrarySourceNotificationProvider.kt index 9330174bc0b3..04ca3b1ba073 100644 --- a/java/idea-ui/src/com/intellij/codeInsight/daemon/impl/LibrarySourceNotificationProvider.kt +++ b/java/idea-ui/src/com/intellij/codeInsight/daemon/impl/LibrarySourceNotificationProvider.kt @@ -1,7 +1,6 @@ // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.daemon.impl -import com.intellij.ProjectTopics import com.intellij.diff.DiffContentFactory import com.intellij.diff.DiffManager import com.intellij.diff.requests.SimpleDiffRequest @@ -10,8 +9,6 @@ import com.intellij.openapi.fileEditor.FileEditor import com.intellij.openapi.fileTypes.LanguageFileType import com.intellij.openapi.project.Project import com.intellij.openapi.project.ProjectBundle -import com.intellij.openapi.roots.ModuleRootEvent -import com.intellij.openapi.roots.ModuleRootListener import com.intellij.openapi.roots.ProjectRootManager import com.intellij.openapi.util.Key import com.intellij.openapi.vfs.VirtualFile @@ -22,8 +19,7 @@ import com.intellij.ui.EditorNotificationPanel import com.intellij.ui.EditorNotifications import com.intellij.ui.LightColors -class LibrarySourceNotificationProvider(private val project: Project, notifications: EditorNotifications) : - EditorNotifications.Provider() { +class LibrarySourceNotificationProvider(private val project: Project) : EditorNotifications.Provider() { private companion object { private val KEY = Key.create("library.source.mismatch.panel") @@ -35,12 +31,6 @@ class LibrarySourceNotificationProvider(private val project: Project, notificati private const val CLASS = SHOW_NAME or SHOW_FQ_CLASS_NAMES or SHOW_EXTENDS_IMPLEMENTS or SHOW_RAW_TYPE } - init { - project.messageBus.connect(project).subscribe(ProjectTopics.PROJECT_ROOTS, object : ModuleRootListener { - override fun rootsChanged(event: ModuleRootEvent) = notifications.updateAllNotifications() - }) - } - override fun getKey(): Key = KEY override fun createNotificationPanel(file: VirtualFile, fileEditor: FileEditor): EditorNotificationPanel? { diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/impl/SdkSetupNotificationTestBase.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/impl/SdkSetupNotificationTestBase.java index c9d415353c29..e233c3ab6a94 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/impl/SdkSetupNotificationTestBase.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/impl/SdkSetupNotificationTestBase.java @@ -15,7 +15,6 @@ import com.intellij.psi.PsiFile; import com.intellij.testFramework.IdeaTestUtil; import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase; import com.intellij.ui.EditorNotificationPanel; -import com.intellij.ui.EditorNotifications; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -29,7 +28,6 @@ public abstract class SdkSetupNotificationTestBase extends JavaCodeInsightFixtur super.setUp(); setProjectSdk(IdeaTestUtil.getMockJdk17()); - new SdkSetupNotificationProvider(getProject(), EditorNotifications.getInstance(getProject())); } @Override diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/SdkSetupNotificationProvider.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/SdkSetupNotificationProvider.java index 3e1d602df9b8..19e0f82f1760 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/SdkSetupNotificationProvider.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/SdkSetupNotificationProvider.java @@ -1,14 +1,11 @@ // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.codeInsight.daemon.impl; -import com.intellij.ProjectTopics; import com.intellij.codeInsight.daemon.ProjectSdkSetupValidator; import com.intellij.openapi.fileEditor.FileEditor; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectBundle; -import com.intellij.openapi.roots.ModuleRootEvent; -import com.intellij.openapi.roots.ModuleRootListener; import com.intellij.openapi.util.Key; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.ui.EditorNotificationPanel; @@ -23,14 +20,8 @@ public class SdkSetupNotificationProvider extends EditorNotifications.Provider supportedFileTypes; - public ConfigureGroovyLibraryNotificationProvider(Project project, final EditorNotifications notifications) { + public ConfigureGroovyLibraryNotificationProvider(Project project) { myProject = project; - project.getMessageBus().connect(project).subscribe(ProjectTopics.PROJECT_ROOTS, new ModuleRootListener() { - @Override - public void rootsChanged(@NotNull ModuleRootEvent event) { - notifications.updateAllNotifications(); - } - }); supportedFileTypes = new HashSet<>(); supportedFileTypes.add(GroovyFileType.GROOVY_FILE_TYPE);