mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
(IDEA-327207) Settings Transfer: fix localization issues
GitOrigin-RevId: ab36838f1488285e8e0765349ed16a9bbfed4392
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f1f44389ab
commit
e491e82cd1
@@ -277,6 +277,13 @@ error.cannot.convert.project=Cannot convert project: {0}
|
||||
message.text.files.do.not.exist=<html><body>The following files don''t exist: <br>\
|
||||
{0}The corresponding modules won''t be converted. Do you want to continue?</body></html>
|
||||
|
||||
transfer-settings.keymap.extension-custom-shortcuts=<html>Some extensions from {0} might have added custom shortcuts. These shortcuts are also displayed in this list</html>
|
||||
transfer-settings.keymap.custom-shortcuts=Only custom shortcuts
|
||||
transfer-settings.keymap.more=more\u2026
|
||||
transfer-settings.plugins.more=and {0} more
|
||||
transfer-settings.sections.more=More..
|
||||
transfer-settings.vs-win.resharper-settings-found=ReSharper settings are found and will be imported
|
||||
|
||||
select.in.file.structure=File Structure
|
||||
|
||||
about.box.build.number=Build #{0}
|
||||
|
||||
@@ -5,6 +5,7 @@ package com.intellij.ide
|
||||
|
||||
import com.intellij.openapi.components.BaseState
|
||||
import com.intellij.openapi.util.IntellijInternalApi
|
||||
import com.intellij.openapi.util.NlsSafe
|
||||
import com.intellij.openapi.wm.impl.FrameInfo
|
||||
import com.intellij.util.xmlb.annotations.Attribute
|
||||
import com.intellij.util.xmlb.annotations.MapAnnotation
|
||||
@@ -24,7 +25,7 @@ class RecentProjectMetaInfo : BaseState() {
|
||||
var hidden: Boolean by property(false)
|
||||
|
||||
@get:Attribute
|
||||
var displayName: String? by string()
|
||||
var displayName: @NlsSafe String? by string()
|
||||
|
||||
// to set frame title as early as possible
|
||||
@get:Attribute
|
||||
|
||||
-63
@@ -1,63 +0,0 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.ide.customize.transferSettings
|
||||
|
||||
import com.intellij.ide.customize.transferSettings.controllers.TransferSettingsListener
|
||||
import com.intellij.ide.customize.transferSettings.models.IdeVersion
|
||||
import com.intellij.ide.customize.transferSettings.models.Settings
|
||||
import com.intellij.ide.customize.transferSettings.models.TransferSettingsModel
|
||||
import com.intellij.ide.customize.transferSettings.providers.TransferSettingsPerformContext
|
||||
import com.intellij.ide.customize.transferSettings.providers.vscode.VSCodeTransferSettingsProvider
|
||||
import com.intellij.ide.customize.transferSettings.ui.TransferSettingsProgressIndicatorBase
|
||||
import com.intellij.ide.customize.transferSettings.ui.TransferSettingsView
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.util.concurrency.ThreadingAssertions
|
||||
import javax.swing.JButton
|
||||
import javax.swing.JLabel
|
||||
import javax.swing.JProgressBar
|
||||
|
||||
class TransferSettingsFacade(private val project: Project?) {
|
||||
private val config = DefaultTransferSettingsConfiguration(TransferSettingsDataProvider(VSCodeTransferSettingsProvider()), false)
|
||||
val hasVsCode = (config.dataProvider.orderedIdeVersions.firstOrNull() as? IdeVersion)?.provider is VSCodeTransferSettingsProvider
|
||||
|
||||
private val model: TransferSettingsModel = TransferSettingsModel(config, true)
|
||||
|
||||
val button by lazy { JButton("Import") }
|
||||
val status by lazy { JLabel("No yet status") }
|
||||
val progressBar by lazy { JProgressBar(0, 100) }
|
||||
val successOrFailureLabel by lazy { JLabel().apply { isVisible = false } }
|
||||
private val progressBase by lazy { TransferSettingsProgressIndicatorBase(progressBar, status, successOrFailureLabel) }
|
||||
|
||||
val view by lazy { initView() }
|
||||
|
||||
private fun initView(): TransferSettingsView {
|
||||
ThreadingAssertions.assertEventDispatchThread()
|
||||
|
||||
val view = TransferSettingsView(config, model)
|
||||
|
||||
button.addActionListener {
|
||||
val selectedIde = view.selectedIde as? IdeVersion ?: error("Selected ide is null or not IdeVersion")
|
||||
config.controller.performImport(project, selectedIde, progressBase)
|
||||
}
|
||||
|
||||
config.controller.addListener(object : TransferSettingsListener {
|
||||
override fun importStarted(ideVersion: IdeVersion, settings: Settings) {
|
||||
successOrFailureLabel.isVisible = false
|
||||
button.isEnabled = false
|
||||
}
|
||||
|
||||
override fun importFailed(ideVersion: IdeVersion, settings: Settings, throwable: Throwable) {
|
||||
successOrFailureLabel.isVisible = true
|
||||
successOrFailureLabel.text = "Failed"
|
||||
button.isEnabled = true
|
||||
}
|
||||
|
||||
override fun importPerformed(ideVersion: IdeVersion, settings: Settings, context: TransferSettingsPerformContext) {
|
||||
successOrFailureLabel.isVisible = true
|
||||
successOrFailureLabel.text = "Success"
|
||||
progressBar.isVisible = false
|
||||
}
|
||||
})
|
||||
|
||||
return view
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -190,7 +190,7 @@ class VSWinTransferSettingsProvider : TransferSettingsProvider {
|
||||
private fun timeFn() = System.nanoTime()
|
||||
private fun convertTimeFn(time: Long): Duration = time.nanoseconds
|
||||
|
||||
override fun getRightPanel(ideV: IdeVersion, config: TransferSettingsConfiguration): TransferSettingsRightPanelChooser? {
|
||||
override fun getRightPanel(ideV: IdeVersion, config: TransferSettingsConfiguration): TransferSettingsRightPanelChooser {
|
||||
return VSWinTransferSettingsRightPanelChooser(ideV, config)
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ class VSWinTransferSettingsProvider : TransferSettingsProvider {
|
||||
panel {
|
||||
row {
|
||||
icon(AllIcons.TransferSettings.Resharper).customize(UnscaledGaps(left = 5, right = 5))
|
||||
label("ReSharper settings are found and will be imported")
|
||||
label(IdeBundle.message("transfer-settings.vs-win.resharper-settings-found"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-11
@@ -1,33 +1,28 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.ide.customize.transferSettings.ui.representation.ideVersion.sections
|
||||
|
||||
import com.intellij.ide.IdeBundle
|
||||
import com.intellij.ide.customize.transferSettings.models.SettingsPreferences
|
||||
import com.intellij.ide.customize.transferSettings.models.SettingsPreferencesKind
|
||||
import com.intellij.ide.customize.transferSettings.ui.representation.ideVersion.TransferSettingsIdeRepresentationListener
|
||||
import com.intellij.openapi.observable.properties.AtomicBooleanProperty
|
||||
import com.intellij.openapi.ui.DialogPanel
|
||||
import com.intellij.openapi.ui.popup.JBPopup
|
||||
import com.intellij.openapi.ui.popup.JBPopupFactory
|
||||
import com.intellij.openapi.util.IconLoader
|
||||
import com.intellij.openapi.util.NlsContexts
|
||||
import com.intellij.ui.ActiveComponent
|
||||
import com.intellij.ui.awt.RelativePoint
|
||||
import com.intellij.ui.components.panels.Wrapper
|
||||
import com.intellij.ui.dsl.builder.*
|
||||
import com.intellij.ui.dsl.gridLayout.UnscaledGaps
|
||||
import com.intellij.ui.popup.AbstractPopup
|
||||
import com.intellij.ui.scale.JBUIScale
|
||||
import com.intellij.util.EventDispatcher
|
||||
import com.intellij.util.ui.JBUI
|
||||
import com.intellij.util.ui.UIUtil
|
||||
import java.util.EventListener
|
||||
import javax.swing.Icon
|
||||
import javax.swing.JComponent
|
||||
import javax.swing.JLabel
|
||||
import org.jetbrains.annotations.Nls
|
||||
import java.awt.Dimension
|
||||
import java.awt.Point
|
||||
import java.awt.Rectangle
|
||||
import javax.swing.Icon
|
||||
import javax.swing.JComponent
|
||||
import javax.swing.JLabel
|
||||
|
||||
abstract class IdeRepresentationSection(private val prefs: SettingsPreferences,
|
||||
final override val key: SettingsPreferencesKind,
|
||||
@@ -41,7 +36,7 @@ abstract class IdeRepresentationSection(private val prefs: SettingsPreferences,
|
||||
protected open val disabledCheckboxText: String? = null
|
||||
private val leftGap = 20
|
||||
private var morePanelFactory: ((AtomicBooleanProperty) -> JComponent)? = null
|
||||
private var moreLabel: String = "More.."
|
||||
private var moreLabel: @Nls String = IdeBundle.message("transfer-settings.sections.more")
|
||||
|
||||
val isSelected: Boolean by _isSelected
|
||||
|
||||
|
||||
+12
-12
@@ -1,7 +1,8 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.ide.customize.transferSettings.ui.representation.ideVersion.sections
|
||||
|
||||
import com.intellij.icons.AllIcons
|
||||
import com.intellij.ide.IdeBundle
|
||||
import com.intellij.ide.customize.transferSettings.models.*
|
||||
import com.intellij.openapi.actionSystem.KeyboardShortcut
|
||||
import com.intellij.openapi.keymap.KeymapUtil
|
||||
@@ -22,7 +23,6 @@ import com.intellij.util.ui.UIUtil
|
||||
import com.intellij.util.ui.components.BorderLayoutPanel
|
||||
import net.miginfocom.swing.MigLayout
|
||||
import org.jetbrains.annotations.Nls
|
||||
import java.awt.Font
|
||||
import javax.swing.*
|
||||
import javax.swing.border.CompoundBorder
|
||||
|
||||
@@ -30,23 +30,23 @@ class KeymapSection(private val ideVersion: IdeVersion) : IdeRepresentationSecti
|
||||
companion object {
|
||||
@Nls
|
||||
private val delim = if (SystemInfo.isMac) "" else "+"
|
||||
private val delimToParse = "+"
|
||||
private const val DELIM_TO_PARSE = "+"
|
||||
|
||||
private fun getKeystrokeText(accelerator: KeyStroke?): String {
|
||||
if (accelerator == null) return ""
|
||||
|
||||
return if (SystemInfo.isMac)
|
||||
MacKeymapUtil.getKeyStrokeText(accelerator, delimToParse, true)
|
||||
MacKeymapUtil.getKeyStrokeText(accelerator, DELIM_TO_PARSE, true)
|
||||
else KeymapUtil.getKeystrokeText(accelerator)
|
||||
}
|
||||
|
||||
private fun init(sc: KeyboardShortcut): Pair<List<String>, List<String>?> {
|
||||
return Pair(getKeystrokeText(sc.firstKeyStroke).split(delimToParse),
|
||||
sc.secondKeyStroke?.let { getKeystrokeText(it).split(delimToParse) })
|
||||
return Pair(getKeystrokeText(sc.firstKeyStroke).split(DELIM_TO_PARSE),
|
||||
sc.secondKeyStroke?.let { getKeystrokeText(it).split(DELIM_TO_PARSE) })
|
||||
}
|
||||
|
||||
private fun init(sc: DummyKeyboardShortcut): Pair<List<String>, List<String>?> {
|
||||
return Pair(sc.firstKeyStroke.split(delimToParse), sc.secondKeyStroke?.split(delimToParse))
|
||||
return Pair(sc.firstKeyStroke.split(DELIM_TO_PARSE), sc.secondKeyStroke?.split(DELIM_TO_PARSE))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,15 +63,15 @@ class KeymapSection(private val ideVersion: IdeVersion) : IdeRepresentationSecti
|
||||
val customShortcuts = (keymap as? PatchedKeymap)?.overrides
|
||||
|
||||
if (!customShortcuts.isNullOrEmpty()) {
|
||||
withMoreLabel("more...") {
|
||||
withMoreLabel(IdeBundle.message("transfer-settings.keymap.more")) {
|
||||
BorderLayoutPanel().apply {
|
||||
border = JBUI.Borders.empty()
|
||||
addToTop(JPanel().apply {
|
||||
layout = BoxLayout(this, BoxLayout.Y_AXIS)
|
||||
add(JLabel("Only custom shortcuts").apply {
|
||||
add(JLabel(IdeBundle.message("transfer-settings.keymap.custom-shortcuts")).apply {
|
||||
border = JBUI.Borders.empty(5, 5, 0, 5)
|
||||
})
|
||||
add(JLabel("<html>Some extensions from ${ideVersion.name} might have added custom shortcuts. These shortcuts are also displayed in this list</html>").apply {
|
||||
add(JLabel(IdeBundle.message("transfer-settings.keymap.extension-custom-shortcuts", ideVersion.name)).apply {
|
||||
border = JBUI.Borders.empty(0, 5)
|
||||
font = JBFont.small()
|
||||
foreground = JBUI.CurrentTheme.Label.disabledForeground()
|
||||
@@ -93,7 +93,7 @@ class KeymapSection(private val ideVersion: IdeVersion) : IdeRepresentationSecti
|
||||
|
||||
return panel {
|
||||
val items = keymap.demoShortcuts.take(LIMIT)
|
||||
items.forEachIndexed { idx, it ->
|
||||
items.forEach {
|
||||
row {
|
||||
val dsc = it.defaultShortcut
|
||||
shortcutComp(dsc)
|
||||
@@ -125,7 +125,7 @@ class KeymapSection(private val ideVersion: IdeVersion) : IdeRepresentationSecti
|
||||
if (dsc is DummyKeyboardShortcut) cell(KeyboardTwoShortcuts(dsc, _isSelected, _isEnabled)).customize(UnscaledGaps.EMPTY)
|
||||
}
|
||||
|
||||
private inner class KeyboardTwoShortcuts private constructor(private val shortcut: Pair<List<String>, List<String>?>, private val isSelected: AtomicBooleanProperty, private val isEnabledPanel: AtomicBooleanProperty) : JPanel() {
|
||||
private inner class KeyboardTwoShortcuts private constructor(shortcut: Pair<List<String>, List<String>?>, private val isSelected: AtomicBooleanProperty, private val isEnabledPanel: AtomicBooleanProperty) : JPanel() {
|
||||
init {
|
||||
layout = MigLayout("novisualpadding, ins 0, gap 0")
|
||||
parsePart(shortcut.first)
|
||||
|
||||
+3
-2
@@ -15,14 +15,14 @@ import com.intellij.util.ui.JBUI
|
||||
import com.intellij.util.ui.UIUtil
|
||||
import javax.swing.JComponent
|
||||
|
||||
class PluginsSection(private val ideVersion: IdeVersion) : IdeRepresentationSection(ideVersion.settingsCache.preferences, SettingsPreferencesKind.Plugins, AllIcons.TransferSettings.PluginsAndFeatures) {
|
||||
class PluginsSection(ideVersion: IdeVersion) : IdeRepresentationSection(ideVersion.settingsCache.preferences, SettingsPreferencesKind.Plugins, AllIcons.TransferSettings.PluginsAndFeatures) {
|
||||
private val plugins = ideVersion.settingsCache.plugins.values.filter { !it.isHidden }
|
||||
override val name: String = "Plugins and Features"
|
||||
override fun worthShowing(): Boolean = plugins.isNotEmpty()
|
||||
|
||||
override fun getContent(): JComponent {
|
||||
if (plugins.size > LIMIT) {
|
||||
withMoreLabel("and ${plugins.size - LIMIT} more") {
|
||||
withMoreLabel(IdeBundle.message("transfer-settings.plugins.more", plugins.size - LIMIT)) {
|
||||
return@withMoreLabel JBScrollPane(Wrapper(panel {
|
||||
for (plugin in plugins.drop(LIMIT)) {
|
||||
createPluginRow(plugin, this)
|
||||
@@ -49,6 +49,7 @@ class PluginsSection(private val ideVersion: IdeVersion) : IdeRepresentationSect
|
||||
}
|
||||
}
|
||||
|
||||
@Suppress("DialogTitleCapitalization")
|
||||
comment(
|
||||
when (plugin) {
|
||||
is BuiltInFeature -> IdeBundle.message("transfersettings.plugin.built.in")
|
||||
|
||||
+1
-3
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.ide.customize.transferSettings.ui.representation.ideVersion.sections
|
||||
|
||||
import com.intellij.icons.AllIcons
|
||||
@@ -6,10 +6,8 @@ import com.intellij.ide.IdeBundle
|
||||
import com.intellij.ide.customize.transferSettings.models.IdeVersion
|
||||
import com.intellij.ide.customize.transferSettings.models.RecentPathInfo
|
||||
import com.intellij.ide.customize.transferSettings.models.SettingsPreferencesKind
|
||||
import com.intellij.openapi.util.NlsSafe
|
||||
import com.intellij.ui.components.JBScrollPane
|
||||
import com.intellij.ui.components.panels.Wrapper
|
||||
import com.intellij.ui.dsl.builder.Align
|
||||
import com.intellij.ui.dsl.builder.panel
|
||||
import com.intellij.util.ui.JBUI
|
||||
import org.jetbrains.annotations.Nls
|
||||
|
||||
+4
-9
@@ -4,11 +4,7 @@ package com.intellij.ide.startup.importSettings.transfer
|
||||
import com.intellij.icons.AllIcons
|
||||
import com.intellij.ide.customize.transferSettings.models.BaseIdeVersion
|
||||
import com.intellij.ide.customize.transferSettings.models.IdeVersion
|
||||
import com.intellij.ide.startup.importSettings.data.DialogImportItem
|
||||
import com.intellij.ide.startup.importSettings.data.IconProductSize
|
||||
import com.intellij.ide.startup.importSettings.data.ImportFromProduct
|
||||
import com.intellij.ide.startup.importSettings.data.ImportProgress
|
||||
import com.intellij.ide.startup.importSettings.data.SettingsContributor
|
||||
import com.intellij.ide.startup.importSettings.data.*
|
||||
import com.intellij.ide.startup.importSettings.jb.JbProductInfo
|
||||
import com.intellij.ide.startup.importSettings.jb.NameMappings
|
||||
import com.intellij.openapi.application.ModalityState
|
||||
@@ -63,16 +59,15 @@ class ProgressIndicatorAdapter(private val backend: TransferSettingsProgressIndi
|
||||
override fun cancel() { cancelled = true }
|
||||
override fun isCanceled() = cancelled
|
||||
|
||||
private val textProp = Property<String?>(null)
|
||||
private val text2Prop = Property<String?>(null)
|
||||
private val textProp = Property<@ProgressText String?>(null)
|
||||
private val text2Prop = Property<@ProgressText String?>(null)
|
||||
init {
|
||||
textProp.compose(text2Prop, ::Pair).advise(Lifetime.Eternal) { (t1, t2) ->
|
||||
val text = when {
|
||||
t1 == null && t2 == null -> null
|
||||
t1 == null && t2 != null -> t2
|
||||
t1 != null && t2 == null -> t1
|
||||
t1 != null && t2 != null -> "$t1 / $t2"
|
||||
else -> error("Impossible")
|
||||
else -> "$t1 / $t2"
|
||||
}
|
||||
backend.progressMessage.set(text)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user