From 5edc6554bf0d98cb775cb4e203a8cd1d5616d20c Mon Sep 17 00:00:00 2001 From: Sergey Pak Date: Thu, 22 May 2025 20:08:21 +0200 Subject: [PATCH] [settingsSync] IJPL-188449 Settings Sync: No icon indicators for sync states (cherry picked from commit e032801b59fad308dd60493494a88223763271c2) GitOrigin-RevId: 47971dca77459b74707180568ca5521837dc5d32 --- .../messages/SettingsSyncBundle.properties | 4 +- .../core/config/SettingsSyncConfigurable.kt | 44 +++++++++---------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/platform/settings-sync-core/resources/messages/SettingsSyncBundle.properties b/platform/settings-sync-core/resources/messages/SettingsSyncBundle.properties index e7f51cdfdc56..c1e7201aa97a 100644 --- a/platform/settings-sync-core/resources/messages/SettingsSyncBundle.properties +++ b/platform/settings-sync-core/resources/messages/SettingsSyncBundle.properties @@ -116,10 +116,12 @@ sync.restart.notification.submessage.plugins={0} plugin(s): {1}\u2026 # {0} - IDE name, i.e. Android Studio, MPS, etc. sync.restart.notification.action=Restart {0} sync.status.enabled=Backup and Sync is enabled -sync.status.will.enable=Backup and Sync will be enabled +# {0} - name of Apply button +sync.status.will.enable=Pending, click "{0}" to start syncing sync.status.disabled=Backup and Sync disabled sync.status.will.disable=Backup and Sync will be disabled sync.status.action.required=Action required: {0} +sync.status.action.required.comment=Pending, click "{0}" to {1} sync.status.failed=Sync failed: {0} sync.status.login.message=Login to enable Backup and Sync # {0} is last sync time (human-readable), after (in a different component) goes a user-name, for example: "Last synced 5 minutes ago for John.Doe" diff --git a/platform/settings-sync-core/src/com/intellij/settingsSync/core/config/SettingsSyncConfigurable.kt b/platform/settings-sync-core/src/com/intellij/settingsSync/core/config/SettingsSyncConfigurable.kt index bd491e1f27f7..665dede701b8 100644 --- a/platform/settings-sync-core/src/com/intellij/settingsSync/core/config/SettingsSyncConfigurable.kt +++ b/platform/settings-sync-core/src/com/intellij/settingsSync/core/config/SettingsSyncConfigurable.kt @@ -1,6 +1,8 @@ package com.intellij.settingsSync.core.config +import com.intellij.BundleBase +import com.intellij.CommonBundle import com.intellij.icons.AllIcons import com.intellij.ide.BrowserUtil import com.intellij.ide.DataManager @@ -249,6 +251,7 @@ internal class SettingsSyncConfigurable(private val coroutineScope: CoroutineSco userId = userDropDownLink.selectedItem?.userId providerCode = userDropDownLink.selectedItem?.providerCode } + cellDropDownLink.comment?.text = "" if (enableCheckbox.isSelected) { syncConfigPanel.apply() } @@ -360,7 +363,9 @@ internal class SettingsSyncConfigurable(private val coroutineScope: CoroutineSco withContext(Dispatchers.EDT) { triggerUpdateConfigurable() } - cellDropDownLink.comment?.text = message("sync.status.will.enable") + cellDropDownLink.comment?.text = " " + + message("sync.status.will.enable", + CommonBundle.getApplyButtonText().replace(BundleBase.MNEMONIC_STRING, "")) } else { enableCheckbox.isSelected = false } @@ -611,34 +616,29 @@ internal class SettingsSyncConfigurable(private val coroutineScope: CoroutineSco cellDropDownLink.comment?.text = "" //message("sync.status.disabled.message") return } + val currentStatus = SettingsSyncStatusTracker.getInstance().currentStatus + actionRequired.set(currentStatus is SettingsSyncStatusTracker.SyncStatus.ActionRequired) if (SettingsSyncSettings.getInstance().syncEnabled) { - val currentStatus = SettingsSyncStatusTracker.getInstance().currentStatus - actionRequired.set(currentStatus is SettingsSyncStatusTracker.SyncStatus.ActionRequired) - when(currentStatus) { - SettingsSyncStatusTracker.SyncStatus.Success -> { - //statusLabel.icon = icons.SettingsSyncIcons.StatusEnabled + + if (currentStatus is SettingsSyncStatusTracker.SyncStatus.ActionRequired) { + actionRequiredAction = { currentStatus.execute(syncConfigPanel) } + actionRequiredLabel.text = currentStatus.message + actionRequiredButton.text = currentStatus.actionTitle + cellDropDownLink.comment?.text = message("sync.status.action.required.comment", currentStatus.actionTitle, currentStatus.message) + } else { + cellDropDownLink.comment?.text = "" + actionRequiredAction = null + actionRequiredLabel.text = "" + actionRequiredButton.text = "" + if (currentStatus == SettingsSyncStatusTracker.SyncStatus.Success) { val lastSyncTime = SettingsSyncStatusTracker.getInstance().getLastSyncTime() if (lastSyncTime > 0) { - cellDropDownLink.comment?.text = message("sync.status.last.sync.message", DateFormatUtil.formatPrettyDateTime(lastSyncTime)) + cellDropDownLink.comment?.text = " " + message("sync.status.last.sync.message", DateFormatUtil.formatPrettyDateTime(lastSyncTime)) } else { cellDropDownLink.comment?.text = message("sync.status.enabled") } - } - is SettingsSyncStatusTracker.SyncStatus.Error -> { + } else if (currentStatus is SettingsSyncStatusTracker.SyncStatus.Error) { cellDropDownLink.comment?.text = message("sync.status.failed", currentStatus.errorMessage) - //statusLabel.icon = AllIcons.General.Error - } - is SettingsSyncStatusTracker.SyncStatus.ActionRequired -> { - actionRequiredAction = { currentStatus.execute(syncConfigPanel) } - actionRequiredLabel.text = currentStatus.message - actionRequiredButton.text = currentStatus.actionTitle - //actionRequiredData = Pair(currentStatus.message, currentStatus.actionTitle) - /* - cellDropDownLink.comment?.text = message("sync.status.action.required", currentStatus.message) - //statusLabel.icon = AllIcons.General.BalloonWarning - enableCheckbox.text = currentStatus.actionTitle - */ - } } }