after cherry-pick clean-up (compilation & tests)

Signed-off-by: Sergey Pak <sergey.pak@jetbrains.com>

GitOrigin-RevId: a7cd85eb64f76f32592ece70c2b1c9db9bf9d4ea
This commit is contained in:
Sergey Pak
2025-01-20 17:05:25 +01:00
committed by intellij-monorepo-bot
parent f8175a2887
commit a61d2438dc
6 changed files with 19 additions and 20 deletions

View File

@@ -13,6 +13,6 @@ class ManualPushAction : DumbAwareAction() {
override fun getActionUpdateThread() = ActionUpdateThread.EDT
override fun update(e: AnActionEvent) {
e.presentation.isEnabledAndVisible = isSettingsSyncEnabledByKey() && SettingsSyncMain.isAvailable() && isSettingsSyncEnabledInSettings()
e.presentation.isEnabledAndVisible = SettingsSyncMain.isAvailable() && isSettingsSyncEnabledInSettings()
}
}

View File

@@ -2,6 +2,7 @@ package com.intellij.settingsSync.core
import com.intellij.concurrency.ConcurrentCollectionFactory
import com.intellij.configurationStore.*
import com.intellij.idea.AppMode
import com.intellij.openapi.application.PathManager.OPTIONS_DIRECTORY
import com.intellij.openapi.application.invokeAndWaitIfNeeded
import com.intellij.openapi.components.RoamingType
@@ -77,21 +78,19 @@ internal class SettingsSyncIdeMediatorImpl(private val componentStore: Component
SettingsSyncPluginManager.getInstance().pushChangesToIde(snapshot.plugins)
}
if (!AppMode.isRemoteDevHost()) {
// 3. after that update the rest of changed settings
val regularFileStates = snapshot.fileStates.filter { it != settingsSyncFileState }
writeStatesToAppConfig(regularFileStates)
// 3. after that update the rest of changed settings
val regularFileStates = snapshot.fileStates.filter { it != settingsSyncFileState }
writeStatesToAppConfig(regularFileStates)
// 4. apply changes from custom providers
for ((id, state) in snapshot.settingsFromProviders) {
val provider = findProviderById(id, state)
if (provider != null) {
LOG.debug("Applying settings for provider '$id'")
provider.applyNewSettings(state)
}
else {
LOG.warn("Couldn't find provider for id '$id' and state '${state.javaClass}'")
}
// 4. apply changes from custom providers
for ((id, state) in snapshot.settingsFromProviders) {
val provider = findProviderById(id, state)
if (provider != null) {
LOG.debug("Applying settings for provider '$id'")
provider.applyNewSettings(state)
}
else {
LOG.warn("Couldn't find provider for id '$id' and state '${state.javaClass}'")
}
}
notifyRestartNeeded()

View File

@@ -2,11 +2,13 @@ package com.intellij.settingsSync.core
import com.intellij.ide.ApplicationActivity
import com.intellij.openapi.application.ApplicationActivationListener
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.PathManager
import com.intellij.openapi.components.Service
import com.intellij.openapi.components.service
import com.intellij.openapi.components.serviceAsync
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.extensions.ExtensionNotApplicableException
import com.intellij.openapi.extensions.ExtensionPointName
import com.intellij.openapi.progress.blockingContext
import com.intellij.openapi.util.registry.Registry
@@ -26,7 +28,7 @@ private val MIGRATION_EP = ExtensionPointName<SettingsSyncMigration>("com.intell
private class SettingsSynchronizerApplicationInitializedListener : ApplicationActivity {
init {
if (ApplicationManager.getApplication().isHeadlessEnvironment || !isSettingsSyncEnabledByKey()) {
if (ApplicationManager.getApplication().isHeadlessEnvironment) {
throw ExtensionNotApplicableException.create()
}
}
@@ -123,7 +125,7 @@ private class SettingsSynchronizer : ApplicationActivationListener {
get() = Registry.intValue("settingsSync.autoSync.frequency.sec", 60).toLong()
override fun applicationActivated(ideFrame: IdeFrame) {
if (!isSettingsSyncEnabledByKey() || !isSettingsSyncEnabledInSettings() || !SettingsSyncMain.isAvailable()) {
if (!isSettingsSyncEnabledInSettings() || !SettingsSyncMain.isAvailable()) {
return
}

View File

@@ -137,7 +137,6 @@ internal class SettingsSyncPanelHolder() {
.onIsModified {
holder.isModified()
}
.enabled(isModifiable(holder))
comment(holder.description)
}
else {

View File

@@ -66,7 +66,6 @@ class SettingsHistoryToolWindowFactory(private val corotineScope: CoroutineScope
private fun isApplicable(): Boolean {
return Registry.`is`("settingsSync.ui.new.toolwindow.show")
&& SettingsSyncMain.isAvailable()
&& isSettingsSyncEnabledByKey()
&& isSettingsSyncEnabledInSettings()
}

View File

@@ -43,6 +43,6 @@ private class SettingsSyncHistoryAction : DumbAwareAction() {
override fun getActionUpdateThread() = ActionUpdateThread.BGT
override fun update(e: AnActionEvent) {
e.presentation.isEnabledAndVisible = e.project != null && isSettingsSyncEnabledByKey()
e.presentation.isEnabledAndVisible = e.project != null
}
}