mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 15:06:56 +07:00
SettingsTransferActivity - use serviceAsync
GitOrigin-RevId: 3e70a454dfe6ab15fc49b1e154508972c21857d0
This commit is contained in:
committed by
intellij-monorepo-bot
parent
afc812872f
commit
a313dd217f
@@ -1,20 +1,30 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.spellchecker.settings
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.components.serviceAsync
|
||||
import com.intellij.openapi.extensions.ExtensionNotApplicableException
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.startup.ProjectActivity
|
||||
import com.intellij.spellchecker.ApplicationDictionaryLayer
|
||||
import com.intellij.spellchecker.ProjectDictionaryLayer
|
||||
import com.intellij.spellchecker.state.ProjectDictionaryState
|
||||
|
||||
internal class SettingsTransferActivity : ProjectActivity {
|
||||
private class SettingsTransferActivity : ProjectActivity {
|
||||
init {
|
||||
if (ApplicationManager.getApplication().isUnitTestMode) {
|
||||
throw ExtensionNotApplicableException.create()
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun execute(project: Project) {
|
||||
val settings = SpellCheckerSettings.getInstance(project)
|
||||
val settings = project.serviceAsync<SpellCheckerSettings>()
|
||||
if (settings.isSettingsTransferred) {
|
||||
return
|
||||
}
|
||||
|
||||
if (settings.isUseSingleDictionaryToSave && ProjectDictionaryLayer.name.get() == settings.dictionaryToSave &&
|
||||
project.getService(ProjectDictionaryState::class.java).projectDictionary.words.isEmpty()) {
|
||||
project.serviceAsync<ProjectDictionaryState>().projectDictionary.words.isEmpty()) {
|
||||
settings.dictionaryToSave = ApplicationDictionaryLayer.name
|
||||
}
|
||||
settings.isSettingsTransferred = true
|
||||
|
||||
Reference in New Issue
Block a user