From a61d2438dc3732d5940bb1fee57d2afc07479256 Mon Sep 17 00:00:00 2001 From: Sergey Pak Date: Mon, 20 Jan 2025 17:05:25 +0100 Subject: [PATCH] after cherry-pick clean-up (compilation & tests) Signed-off-by: Sergey Pak GitOrigin-RevId: a7cd85eb64f76f32592ece70c2b1c9db9bf9d4ea --- .../settingsSync/core/ManualPushAction.kt | 2 +- .../core/SettingsSyncIdeMediatorImpl.kt | 27 +++++++++---------- .../settingsSync/core/SettingsSynchronizer.kt | 6 +++-- .../core/config/SettingsSyncPanelFactory.kt | 1 - .../git/SettingsHistoryToolWindowFactory.kt | 1 - .../core/git/SettingsSyncHistoryAction.kt | 2 +- 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/platform/settings-sync-core/src/com/intellij/settingsSync/core/ManualPushAction.kt b/platform/settings-sync-core/src/com/intellij/settingsSync/core/ManualPushAction.kt index c178325d36b9..be9ceb4687ec 100644 --- a/platform/settings-sync-core/src/com/intellij/settingsSync/core/ManualPushAction.kt +++ b/platform/settings-sync-core/src/com/intellij/settingsSync/core/ManualPushAction.kt @@ -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() } } \ No newline at end of file diff --git a/platform/settings-sync-core/src/com/intellij/settingsSync/core/SettingsSyncIdeMediatorImpl.kt b/platform/settings-sync-core/src/com/intellij/settingsSync/core/SettingsSyncIdeMediatorImpl.kt index ca571eb7a270..9a7634313747 100644 --- a/platform/settings-sync-core/src/com/intellij/settingsSync/core/SettingsSyncIdeMediatorImpl.kt +++ b/platform/settings-sync-core/src/com/intellij/settingsSync/core/SettingsSyncIdeMediatorImpl.kt @@ -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() diff --git a/platform/settings-sync-core/src/com/intellij/settingsSync/core/SettingsSynchronizer.kt b/platform/settings-sync-core/src/com/intellij/settingsSync/core/SettingsSynchronizer.kt index b9e22ae5f56a..74ad21d741a8 100644 --- a/platform/settings-sync-core/src/com/intellij/settingsSync/core/SettingsSynchronizer.kt +++ b/platform/settings-sync-core/src/com/intellij/settingsSync/core/SettingsSynchronizer.kt @@ -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("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 } diff --git a/platform/settings-sync-core/src/com/intellij/settingsSync/core/config/SettingsSyncPanelFactory.kt b/platform/settings-sync-core/src/com/intellij/settingsSync/core/config/SettingsSyncPanelFactory.kt index f3f2c073381c..17f94d1d456f 100644 --- a/platform/settings-sync-core/src/com/intellij/settingsSync/core/config/SettingsSyncPanelFactory.kt +++ b/platform/settings-sync-core/src/com/intellij/settingsSync/core/config/SettingsSyncPanelFactory.kt @@ -137,7 +137,6 @@ internal class SettingsSyncPanelHolder() { .onIsModified { holder.isModified() } - .enabled(isModifiable(holder)) comment(holder.description) } else { diff --git a/platform/settings-sync-core/src/com/intellij/settingsSync/core/git/SettingsHistoryToolWindowFactory.kt b/platform/settings-sync-core/src/com/intellij/settingsSync/core/git/SettingsHistoryToolWindowFactory.kt index 53cbc765f4e2..5fd54a999b4c 100644 --- a/platform/settings-sync-core/src/com/intellij/settingsSync/core/git/SettingsHistoryToolWindowFactory.kt +++ b/platform/settings-sync-core/src/com/intellij/settingsSync/core/git/SettingsHistoryToolWindowFactory.kt @@ -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() } diff --git a/platform/settings-sync-core/src/com/intellij/settingsSync/core/git/SettingsSyncHistoryAction.kt b/platform/settings-sync-core/src/com/intellij/settingsSync/core/git/SettingsSyncHistoryAction.kt index b6f37d730cfe..147a6167260c 100644 --- a/platform/settings-sync-core/src/com/intellij/settingsSync/core/git/SettingsSyncHistoryAction.kt +++ b/platform/settings-sync-core/src/com/intellij/settingsSync/core/git/SettingsSyncHistoryAction.kt @@ -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 } } \ No newline at end of file