Convert JvmPluginStartupComponent into a startup activity
Relates to #KT-38407
This commit is contained in:
committed by
Vladimir Dolzhenko
parent
fa2fb667e6
commit
d3585f1d24
@@ -13,28 +13,21 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.jetbrains.kotlin.idea
|
package org.jetbrains.kotlin.idea
|
||||||
|
|
||||||
import com.intellij.openapi.application.ApplicationManager
|
import com.intellij.openapi.project.Project
|
||||||
import com.intellij.openapi.components.BaseComponent
|
import com.intellij.openapi.startup.StartupActivity
|
||||||
import org.jetbrains.kotlin.idea.ThreadTrackerPatcherForTeamCityTesting.patchThreadTracker
|
import org.jetbrains.kotlin.idea.ThreadTrackerPatcherForTeamCityTesting.patchThreadTracker
|
||||||
import org.jetbrains.kotlin.idea.debugger.filter.addKotlinStdlibDebugFilterIfNeeded
|
import org.jetbrains.kotlin.idea.debugger.filter.addKotlinStdlibDebugFilterIfNeeded
|
||||||
import org.jetbrains.kotlin.idea.util.application.isUnitTestMode
|
import org.jetbrains.kotlin.idea.util.application.isUnitTestMode
|
||||||
|
|
||||||
class JvmPluginStartupComponent : BaseComponent {
|
// BUNCH: 192
|
||||||
override fun getComponentName(): String = JvmPluginStartupComponent::class.java.name
|
class JvmPluginStartupActivity : StartupActivity {
|
||||||
|
override fun runActivity(project: Project) {
|
||||||
override fun initComponent() {
|
|
||||||
if (isUnitTestMode()) {
|
if (isUnitTestMode()) {
|
||||||
patchThreadTracker()
|
patchThreadTracker()
|
||||||
}
|
}
|
||||||
addKotlinStdlibDebugFilterIfNeeded()
|
addKotlinStdlibDebugFilterIfNeeded()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun disposeComponent() {}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
fun getInstance(): JvmPluginStartupComponent =
|
|
||||||
ApplicationManager.getApplication().getComponent(JvmPluginStartupComponent::class.java)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +1,4 @@
|
|||||||
<idea-plugin>
|
<idea-plugin>
|
||||||
<application-components>
|
|
||||||
<component>
|
|
||||||
<implementation-class>org.jetbrains.kotlin.idea.JvmPluginStartupComponent</implementation-class>
|
|
||||||
</component>
|
|
||||||
</application-components>
|
|
||||||
|
|
||||||
<project-components>
|
<project-components>
|
||||||
<component>
|
<component>
|
||||||
<implementation-class>org.jetbrains.kotlin.idea.compiler.KotlinCompilerManager</implementation-class>
|
<implementation-class>org.jetbrains.kotlin.idea.compiler.KotlinCompilerManager</implementation-class>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
<extensions defaultExtensionNs="com.intellij">
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
<postStartupActivity implementation="org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerStartupActivity"/>
|
<postStartupActivity implementation="org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerStartupActivity"/>
|
||||||
|
<postStartupActivity implementation="org.jetbrains.kotlin.idea.JvmPluginStartupActivity"/>
|
||||||
|
|
||||||
<projectService serviceImplementation="org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerService"/>
|
<projectService serviceImplementation="org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerService"/>
|
||||||
</extensions>
|
</extensions>
|
||||||
|
|||||||
@@ -1,4 +1,10 @@
|
|||||||
<idea-plugin>
|
<idea-plugin>
|
||||||
|
<application-components>
|
||||||
|
<component>
|
||||||
|
<implementation-class>org.jetbrains.kotlin.idea.JvmPluginStartupComponent</implementation-class>
|
||||||
|
</component>
|
||||||
|
</application-components>
|
||||||
|
|
||||||
<project-components>
|
<project-components>
|
||||||
<component>
|
<component>
|
||||||
<implementation-class>org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerComponent</implementation-class>
|
<implementation-class>org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerComponent</implementation-class>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
<extensions defaultExtensionNs="com.intellij">
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
<postStartupActivity implementation="org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerStartupActivity"/>
|
<postStartupActivity implementation="org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerStartupActivity"/>
|
||||||
|
<postStartupActivity implementation="org.jetbrains.kotlin.idea.JvmPluginStartupActivity"/>
|
||||||
|
|
||||||
<projectService serviceImplementation="org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerService"/>
|
<projectService serviceImplementation="org.jetbrains.kotlin.idea.configuration.ui.KotlinConfigurationCheckerService"/>
|
||||||
</extensions>
|
</extensions>
|
||||||
|
|||||||
Reference in New Issue
Block a user