diff --git a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/MavenImportListener.kt b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/MavenImportListener.kt index c48baf39f75..8e8f5dc1711 100644 --- a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/MavenImportListener.kt +++ b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/MavenImportListener.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.idea.maven import com.intellij.openapi.module.Module import com.intellij.openapi.project.Project +import com.intellij.openapi.startup.StartupActivity import org.jetbrains.idea.maven.project.MavenImportListener import org.jetbrains.idea.maven.project.MavenProject import org.jetbrains.idea.maven.project.MavenProjectsManager @@ -14,9 +15,11 @@ import org.jetbrains.kotlin.idea.configuration.KotlinMigrationProjectService import org.jetbrains.kotlin.idea.configuration.notifyOutdatedBundledCompilerIfNecessary import org.jetbrains.kotlin.idea.util.ProgressIndicatorUtils.runUnderDisposeAwareIndicator -class MavenImportListener(val project: Project) : MavenProjectsManager.Listener { - init { - project.messageBus.connect(project).subscribe( +// BUNCH: 192 +class MavenImportListener : StartupActivity { + + override fun runActivity(project: Project) { + project.messageBus.connect().subscribe( MavenImportListener.TOPIC, MavenImportListener { _: Collection, _: List -> runUnderDisposeAwareIndicator(project) { @@ -26,12 +29,14 @@ class MavenImportListener(val project: Project) : MavenProjectsManager.Listener } ) - MavenProjectsManager.getInstance(project)?.addManagerListener(this) + MavenProjectsManager.getInstance(project)?.addManagerListener(object : MavenProjectsManager.Listener { + override fun projectsScheduled() { + runUnderDisposeAwareIndicator(project) { + KotlinMigrationProjectService.getInstance(project).onImportAboutToStart() + } + } + }) } - override fun projectsScheduled() { - runUnderDisposeAwareIndicator(project) { - KotlinMigrationProjectService.getInstance(project).onImportAboutToStart() - } - } + } \ No newline at end of file diff --git a/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/MavenImportListener.kt.192 b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/MavenImportListener.kt.192 new file mode 100644 index 00000000000..95b57c7e924 --- /dev/null +++ b/idea/idea-maven/src/org/jetbrains/kotlin/idea/maven/MavenImportListener.kt.192 @@ -0,0 +1,38 @@ +/* + * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.idea.maven + +import com.intellij.openapi.module.Module +import com.intellij.openapi.project.Project +import org.jetbrains.idea.maven.project.MavenImportListener +import org.jetbrains.idea.maven.project.MavenProject +import org.jetbrains.idea.maven.project.MavenProjectsManager +import org.jetbrains.kotlin.idea.configuration.KotlinMigrationProjectService +import org.jetbrains.kotlin.idea.configuration.notifyOutdatedBundledCompilerIfNecessary +import org.jetbrains.kotlin.idea.util.ProgressIndicatorUtils.runUnderDisposeAwareIndicator + +// BUNCH: 192 +class MavenImportListener(val project: Project) : MavenProjectsManager.Listener { + init { + project.messageBus.connect(project).subscribe( + MavenImportListener.TOPIC, + MavenImportListener { _: Collection, _: List -> + runUnderDisposeAwareIndicator(project) { + notifyOutdatedBundledCompilerIfNecessary(project) + KotlinMigrationProjectService.getInstance(project).onImportFinished() + } + } + ) + + MavenProjectsManager.getInstance(project)?.addManagerListener(this) + } + + override fun projectsScheduled() { + runUnderDisposeAwareIndicator(project) { + KotlinMigrationProjectService.getInstance(project).onImportAboutToStart() + } + } +} \ No newline at end of file diff --git a/idea/resources/META-INF/maven-common.xml b/idea/resources/META-INF/maven-common.xml index 0ff06dae300..7238ecfc87c 100644 --- a/idea/resources/META-INF/maven-common.xml +++ b/idea/resources/META-INF/maven-common.xml @@ -1,10 +1,4 @@ - - - org.jetbrains.kotlin.idea.maven.MavenImportListener - - - @@ -109,12 +103,6 @@ implementation="org.jetbrains.kotlin.idea.maven.inspections.KotlinMavenUnresolvedReferenceQuickFixProvider" /> - - - org.jetbrains.kotlin.idea.maven.KotlinImporterComponent - - - diff --git a/idea/resources/META-INF/maven.xml b/idea/resources/META-INF/maven.xml new file mode 100644 index 00000000000..d9868fc0540 --- /dev/null +++ b/idea/resources/META-INF/maven.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/idea/resources/META-INF/maven.xml.192 b/idea/resources/META-INF/maven.xml.192 new file mode 100644 index 00000000000..605e386b370 --- /dev/null +++ b/idea/resources/META-INF/maven.xml.192 @@ -0,0 +1,7 @@ + + + + org.jetbrains.kotlin.idea.maven.MavenImportListener + + + diff --git a/idea/resources/META-INF/plugin.xml b/idea/resources/META-INF/plugin.xml index 5c94778c189..67ec89742f9 100644 --- a/idea/resources/META-INF/plugin.xml +++ b/idea/resources/META-INF/plugin.xml @@ -22,6 +22,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. org.jetbrains.plugins.gradle org.jetbrains.plugins.gradle org.intellij.groovy + org.jetbrains.idea.maven org.jetbrains.idea.maven TestNG-J Coverage diff --git a/idea/resources/META-INF/plugin.xml.191 b/idea/resources/META-INF/plugin.xml.191 index 92e379de4b6..391f698ad75 100644 --- a/idea/resources/META-INF/plugin.xml.191 +++ b/idea/resources/META-INF/plugin.xml.191 @@ -22,6 +22,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. org.jetbrains.plugins.gradle.java org.jetbrains.plugins.gradle.java org.intellij.groovy + org.jetbrains.idea.maven org.jetbrains.idea.maven TestNG-J Coverage diff --git a/idea/resources/META-INF/plugin.xml.192 b/idea/resources/META-INF/plugin.xml.192 index de2e8900d08..1e6afdd6c2f 100644 --- a/idea/resources/META-INF/plugin.xml.192 +++ b/idea/resources/META-INF/plugin.xml.192 @@ -22,6 +22,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. org.jetbrains.plugins.gradle.java org.jetbrains.plugins.gradle.java org.intellij.groovy + org.jetbrains.idea.maven org.jetbrains.idea.maven TestNG-J Coverage diff --git a/idea/resources/META-INF/plugin.xml.201 b/idea/resources/META-INF/plugin.xml.201 index 1b8cd15a31b..72fb2f314b6 100644 --- a/idea/resources/META-INF/plugin.xml.201 +++ b/idea/resources/META-INF/plugin.xml.201 @@ -22,6 +22,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. org.jetbrains.plugins.gradle org.jetbrains.plugins.gradle org.intellij.groovy + org.jetbrains.idea.maven org.jetbrains.idea.maven TestNG-J Coverage diff --git a/idea/resources/META-INF/plugin.xml.as35 b/idea/resources/META-INF/plugin.xml.as35 index f7b4b27084b..f4cdead2fa9 100644 --- a/idea/resources/META-INF/plugin.xml.as35 +++ b/idea/resources/META-INF/plugin.xml.as35 @@ -23,6 +23,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. org.jetbrains.plugins.gradle.java org.jetbrains.plugins.gradle.java org.intellij.groovy + org.jetbrains.idea.maven org.jetbrains.idea.maven TestNG-J com.intellij.copyright diff --git a/idea/resources/META-INF/plugin.xml.as36 b/idea/resources/META-INF/plugin.xml.as36 index a0ffea07287..09cbfae4256 100644 --- a/idea/resources/META-INF/plugin.xml.as36 +++ b/idea/resources/META-INF/plugin.xml.as36 @@ -23,6 +23,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. org.jetbrains.plugins.gradle.java org.jetbrains.plugins.gradle.java org.intellij.groovy + org.jetbrains.idea.maven org.jetbrains.idea.maven TestNG-J com.intellij.copyright diff --git a/idea/resources/META-INF/plugin.xml.as40 b/idea/resources/META-INF/plugin.xml.as40 index c4efd9c233d..e8bb0fd437d 100644 --- a/idea/resources/META-INF/plugin.xml.as40 +++ b/idea/resources/META-INF/plugin.xml.as40 @@ -23,6 +23,7 @@ The Kotlin plugin provides language support in IntelliJ IDEA and Android Studio. org.jetbrains.plugins.gradle org.jetbrains.plugins.gradle org.intellij.groovy + org.jetbrains.idea.maven org.jetbrains.idea.maven TestNG-J Coverage