IDEA-324476 Fix text in restart required dialog

GitOrigin-RevId: d2b770545b9b58b4453a775fe0bdf2a5ee7c2c84
This commit is contained in:
Filipp Vakhitov
2023-07-24 12:16:12 +03:00
committed by intellij-monorepo-bot
parent 0f5cbfed90
commit 75acbf7e6f
4 changed files with 15 additions and 11 deletions

View File

@@ -287,7 +287,7 @@ public class RegistryValue {
Disposer.register(parentDisposable, () -> setValue(prev));
}
boolean isChangedSinceAppStart() {
public boolean isChangedSinceAppStart() {
return myChangedSinceStart;
}

View File

@@ -70,14 +70,16 @@ sync.restart.notification.title=Restart required after syncing settings
sync.notification.restart.message.plugin.install=Restart the IDE to install {0,choice,1#plugin|2#plugins}: {1}{0,choice,3#...}
sync.notification.restart.message.plugin.enable=Restart the IDE to enable {0,choice,1#plugin|2#plugins}: {1}{0,choice,3#...}
sync.notification.restart.message.plugin.disable=Restart the IDE to disable {0,choice,1#plugin|2#plugins}: {1}{0,choice,3#...}
sync.notification.restart.message.registry=Restart the IDE to enable the new UI
sync.notification.restart.message.new.ui.enable=Restart the IDE to enable the new UI
sync.notification.restart.message.new.ui.disable=Restart the IDE to disable the new UI
sync.notification.restart.message.list.title=Restart the IDE to complete the following actions:
# {0} - count of plugins, {1} - coma separated list of plugins (max two plugins)
sync.notification.restart.message.list.entry.plugin.install=Install {0,choice,1#plugin|2#plugins}: {1}{0,choice,3#...}
sync.notification.restart.message.list.entry.plugin.enable=Enable {0,choice,1#plugin|2#plugins}: {1}{0,choice,3#...}
sync.notification.restart.message.list.entry.plugin.disable=Disable {0,choice,1#plugin|2#plugins}: {1}{0,choice,3#...}
sync.notification.restart.message.list.entry.registry=Enable the new UI
sync.notification.restart.message.list.entry.new.ui.enable=Enable the new UI
sync.notification.restart.message.list.entry.new.ui.disable=Disable the new UI
# {0} - action (install, enable, disable), {1} - comma separated list of plugins
sync.restart.notification.submessage.plugins={0} plugin(s): {1}...

View File

@@ -108,13 +108,13 @@ internal class RestartForPluginDisable(val plugins: Collection<String>) : Restar
}
}
internal object RestartForNewUI : RestartReason() {
internal class RestartForNewUI(val enable: Boolean) : RestartReason() {
override val sortingPriority = 3
override fun getSingleReasonNotificationMessage(): String {
return SettingsSyncBundle.message("sync.notification.restart.message.registry")
return SettingsSyncBundle.message(if (enable) "sync.notification.restart.message.new.ui.enable" else "sync.notification.restart.message.new.ui.disable")
}
override fun getMultiReasonNotificationListEntry(number: Int): String {
return "$number. " + SettingsSyncBundle.message("sync.notification.restart.message.list.entry.registry")
return "$number. " + SettingsSyncBundle.message(if (enable) "sync.notification.restart.message.list.entry.new.ui.enable" else "sync.notification.restart.message.list.entry.new.ui.disable")
}
}

View File

@@ -15,6 +15,8 @@ import com.intellij.settingsSync.plugins.SettingsSyncPluginManager
import com.intellij.util.io.inputStreamIfExists
import com.intellij.util.io.systemIndependentPath
import com.intellij.util.io.write
import com.intellij.ui.NewUiValue
import com.intellij.util.io.*
import org.jetbrains.annotations.VisibleForTesting
import java.io.InputStream
import java.nio.file.FileVisitResult
@@ -107,7 +109,7 @@ internal class SettingsSyncIdeMediatorImpl(private val componentStore: Component
RestartForPluginInstall::class.java -> RestartForPluginInstall(reasons.flatMap { (it as RestartForPluginInstall).plugins })
RestartForPluginEnable::class.java -> RestartForPluginEnable(reasons.flatMap { (it as RestartForPluginEnable).plugins })
RestartForPluginDisable::class.java -> RestartForPluginDisable(reasons.flatMap { (it as RestartForPluginDisable).plugins })
RestartForNewUI::class.java -> RestartForNewUI
RestartForNewUI::class.java -> reasons.lastOrNull()
else -> null
}
}
@@ -287,8 +289,9 @@ internal class SettingsSyncIdeMediatorImpl(private val componentStore: Component
if (lastChanged.isNotEmpty()) {
componentStore.reloadComponents(lastChanged, emptyList())
}
if (Registry.getInstance().isRestartNeeded) {
SettingsSyncEvents.getInstance().fireRestartRequired(RestartForNewUI)
val newUI = Registry.get(NewUiValue.KEY)
if (newUI.isChangedSinceAppStart) {
SettingsSyncEvents.getInstance().fireRestartRequired(RestartForNewUI(newUI.asBoolean()))
}
}
}
@@ -308,8 +311,7 @@ internal class SettingsSyncIdeMediatorImpl(private val componentStore: Component
private fun getOrCreateLock(fileSpec: String) = fileSpecsToLocks.computeIfAbsent(fileSpec) { ReentrantReadWriteLock() }
companion object {
private val LOG = logger<SettingsSyncIdeMediatorImpl>()
val LOG = logger<SettingsSyncIdeMediatorImpl>()
internal fun <T: Any> findProviderById(id: String, state: T): SettingsProvider<T>? {
val provider = SettingsProvider.SETTINGS_PROVIDER_EP.findFirstSafe(Predicate { it.id == id })
if (provider != null) {