Convert KotlinImporterComponent into a module service
Relates to #KT-38407
This commit is contained in:
committed by
Vladimir Dolzhenko
parent
c2c8d81b49
commit
4908d7a78c
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
* 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.maven
|
||||
|
||||
import com.intellij.openapi.module.Module
|
||||
import org.jetbrains.kotlin.idea.util.application.getServiceSafe
|
||||
|
||||
// BUNCH: 192
|
||||
internal val Module.kotlinImporterComponent: KotlinImporterComponent
|
||||
get() = this.getServiceSafe()
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* 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.maven
|
||||
|
||||
import com.intellij.openapi.module.Module
|
||||
|
||||
// BUNCH: 192
|
||||
internal val Module.kotlinImporterComponent: KotlinImporterComponent
|
||||
get() = getComponent(KotlinImporterComponent::class.java) ?: throw IllegalStateException("No maven importer state configured")
|
||||
@@ -417,7 +417,4 @@ class KotlinImporterComponent : PersistentStateComponent<KotlinImporterComponent
|
||||
override fun getState(): State {
|
||||
return State(addedSources.sorted())
|
||||
}
|
||||
}
|
||||
|
||||
private val Module.kotlinImporterComponent: KotlinImporterComponent
|
||||
get() = getComponent(KotlinImporterComponent::class.java) ?: throw IllegalStateException("No maven importer state configured")
|
||||
}
|
||||
@@ -3036,7 +3036,7 @@ class KotlinMavenImporterTest : MavenImportingTestCase() {
|
||||
}
|
||||
|
||||
private fun assertImporterStatePresent() {
|
||||
assertNotNull("Kotlin importer component is not present", myTestFixture.module.getComponent(KotlinImporterComponent::class.java))
|
||||
assertNotNull("Kotlin importer component is not present", myTestFixture.module.kotlinImporterComponent)
|
||||
}
|
||||
|
||||
private fun facetSettings(moduleName: String) = KotlinFacet.get(getModule(moduleName))!!.configuration.settings
|
||||
|
||||
Reference in New Issue
Block a user