IJPL-245941 Settings: Fixed exception with mnemonics in "Remote Jar Repositories" settings.

(cherry picked from commit 6fd377626a1db2d07b5697cd61ff55b4cb7a04bc)

IJ-CR-213483

GitOrigin-RevId: 7b78f33dede3af8a57ed2c7c56b36e5a50c776fd
This commit is contained in:
Nikita Pavlenko
2026-07-17 11:08:30 +00:00
committed by intellij-monorepo-bot
parent 0bcabc2cd8
commit fe59a1297a
@@ -343,7 +343,10 @@ class RemoteRepositoriesConfigurable(private val project: Project) : SearchableC
private fun mnemonicButton(@Nls text: String): JButton {
val button = JButton()
val parsed = TextWithMnemonic.parse(text)
button.text = parsed.text
// Use getText(true) so the mnemonic suffix (e.g. "追加 (D)" in locales where the mnemonic
// char is not part of the text) is included; otherwise mnemonicIndex may point outside the text
// length and setDisplayedMnemonicIndex throws IllegalArgumentException.
button.text = parsed.getText(/*withMnemonicSuffix=*/true)
if (parsed.hasMnemonic()) {
button.mnemonic = parsed.mnemonicCode
button.displayedMnemonicIndex = parsed.mnemonicIndex