From d3585f1d24d725151c818bcfa60444432acc5246 Mon Sep 17 00:00:00 2001 From: Vladimir Dolzhenko Date: Mon, 20 Apr 2020 21:55:30 +0200 Subject: [PATCH] Convert JvmPluginStartupComponent into a startup activity Relates to #KT-38407 --- .../kotlin/idea/JvmPluginStartupComponent.kt | 21 +++++-------- .../idea/JvmPluginStartupComponent.kt.192 | 30 +++++++++++++++++++ idea/resources/META-INF/jvm-common.xml | 6 ---- idea/resources/META-INF/jvm.xml | 1 + idea/resources/META-INF/jvm.xml.192 | 6 ++++ idea/resources/META-INF/jvm.xml.201 | 1 + 6 files changed, 45 insertions(+), 20 deletions(-) create mode 100644 idea/idea-jvm/src/org/jetbrains/kotlin/idea/JvmPluginStartupComponent.kt.192 diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/JvmPluginStartupComponent.kt b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/JvmPluginStartupComponent.kt index 270a8943ea6..37858315ae0 100644 --- a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/JvmPluginStartupComponent.kt +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/JvmPluginStartupComponent.kt @@ -13,28 +13,21 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.jetbrains.kotlin.idea -import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.components.BaseComponent +import com.intellij.openapi.project.Project +import com.intellij.openapi.startup.StartupActivity import org.jetbrains.kotlin.idea.ThreadTrackerPatcherForTeamCityTesting.patchThreadTracker import org.jetbrains.kotlin.idea.debugger.filter.addKotlinStdlibDebugFilterIfNeeded import org.jetbrains.kotlin.idea.util.application.isUnitTestMode -class JvmPluginStartupComponent : BaseComponent { - override fun getComponentName(): String = JvmPluginStartupComponent::class.java.name - - override fun initComponent() { +// BUNCH: 192 +class JvmPluginStartupActivity : StartupActivity { + override fun runActivity(project: Project) { if (isUnitTestMode()) { patchThreadTracker() } addKotlinStdlibDebugFilterIfNeeded() } - - override fun disposeComponent() {} - - companion object { - fun getInstance(): JvmPluginStartupComponent = - ApplicationManager.getApplication().getComponent(JvmPluginStartupComponent::class.java) - } -} \ No newline at end of file +} diff --git a/idea/idea-jvm/src/org/jetbrains/kotlin/idea/JvmPluginStartupComponent.kt.192 b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/JvmPluginStartupComponent.kt.192 new file mode 100644 index 00000000000..1a8b85fb694 --- /dev/null +++ b/idea/idea-jvm/src/org/jetbrains/kotlin/idea/JvmPluginStartupComponent.kt.192 @@ -0,0 +1,30 @@ +/* + * 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. + */ +package org.jetbrains.kotlin.idea + +import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.components.BaseComponent +import org.jetbrains.kotlin.idea.ThreadTrackerPatcherForTeamCityTesting.patchThreadTracker +import org.jetbrains.kotlin.idea.debugger.filter.addKotlinStdlibDebugFilterIfNeeded +import org.jetbrains.kotlin.idea.util.application.isUnitTestMode + +// BUNCH: 192 +class JvmPluginStartupComponent : BaseComponent { + override fun getComponentName(): String = JvmPluginStartupComponent::class.java.name + + override fun initComponent() { + if (isUnitTestMode()) { + patchThreadTracker() + } + addKotlinStdlibDebugFilterIfNeeded() + } + + override fun disposeComponent() {} + + companion object { + fun getInstance(): JvmPluginStartupComponent = + ApplicationManager.getApplication().getComponent(JvmPluginStartupComponent::class.java) + } +} \ No newline at end of file diff --git a/idea/resources/META-INF/jvm-common.xml b/idea/resources/META-INF/jvm-common.xml index 5816c7c781a..48ab2a379f9 100644 --- a/idea/resources/META-INF/jvm-common.xml +++ b/idea/resources/META-INF/jvm-common.xml @@ -1,10 +1,4 @@ - - - org.jetbrains.kotlin.idea.JvmPluginStartupComponent - - - org.jetbrains.kotlin.idea.compiler.KotlinCompilerManager diff --git a/idea/resources/META-INF/jvm.xml b/idea/resources/META-INF/jvm.xml index c2f9fde42c4..7a55680b1f2 100644 --- a/idea/resources/META-INF/jvm.xml +++ b/idea/resources/META-INF/jvm.xml @@ -2,6 +2,7 @@ + diff --git a/idea/resources/META-INF/jvm.xml.192 b/idea/resources/META-INF/jvm.xml.192 index 11ca8b73320..a35904ac9ec 100644 --- a/idea/resources/META-INF/jvm.xml.192 +++ b/idea/resources/META-INF/jvm.xml.192 @@ -1,4 +1,10 @@ + + + org.jetbrains.kotlin.idea.JvmPluginStartupComponent + + + org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerComponent diff --git a/idea/resources/META-INF/jvm.xml.201 b/idea/resources/META-INF/jvm.xml.201 index ec2ca5116fc..390e643e7e4 100644 --- a/idea/resources/META-INF/jvm.xml.201 +++ b/idea/resources/META-INF/jvm.xml.201 @@ -6,6 +6,7 @@ +