Avoid persisting default anchor configuration
#KT-24309 In Progress
This commit is contained in:
+16
-1
@@ -32,16 +32,31 @@ class KotlinLibraryToSourceAnalysisStateComponent : PersistentStateComponent<Kot
|
||||
@OptionTag(converter = AtomicBooleanXmlbConverter::class)
|
||||
var isEnabled: AtomicBoolean = AtomicBoolean(false)
|
||||
|
||||
override fun getState(): KotlinLibraryToSourceAnalysisStateComponent? = this
|
||||
private var shouldPersist: Boolean = true
|
||||
|
||||
override fun getState(): KotlinLibraryToSourceAnalysisStateComponent? =
|
||||
if (shouldPersist) this else null
|
||||
|
||||
override fun loadState(state: KotlinLibraryToSourceAnalysisStateComponent) {
|
||||
XmlSerializerUtil.copyBean(state, this)
|
||||
}
|
||||
|
||||
override fun noStateLoaded() {
|
||||
shouldPersist = false
|
||||
}
|
||||
|
||||
fun setEnabled(newState: Boolean) {
|
||||
isEnabled.getAndSet(newState)
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
return other is KotlinLibraryToSourceAnalysisStateComponent && other.isEnabled.get() == isEnabled.get()
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
return isEnabled.get().hashCode()
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getInstance(project: Project): KotlinLibraryToSourceAnalysisStateComponent =
|
||||
ServiceManager.getService(project, KotlinLibraryToSourceAnalysisStateComponent::class.java)
|
||||
|
||||
Reference in New Issue
Block a user