mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Don't show empty parentheses in action description when there's no shortcut assigned for Web Preview
GitOrigin-RevId: 1be17fc7e71c500076f21282bdc1cea0c66932bb
This commit is contained in:
committed by
intellij-monorepo-bot
parent
bfb16e1b3f
commit
d5be2396f1
@@ -99,19 +99,21 @@ internal class BaseOpenInBrowserAction(private val browser: WebBrowser) : DumbAw
|
||||
|
||||
var description = templatePresentation.text
|
||||
if (ActionPlaces.CONTEXT_TOOLBAR == e.place) {
|
||||
val builder = StringBuilder(description)
|
||||
builder.append(" (")
|
||||
val shortcuts = KeymapManager.getInstance().activeKeymap.getShortcuts("WebOpenInAction")
|
||||
val exists = shortcuts.isNotEmpty()
|
||||
if (exists) {
|
||||
builder.append(KeymapUtil.getShortcutText(shortcuts[0]))
|
||||
}
|
||||
val shortcutInfo = buildString {
|
||||
val shortcuts = KeymapManager.getInstance().activeKeymap.getShortcuts("WebOpenInAction")
|
||||
val exists = shortcuts.isNotEmpty()
|
||||
if (exists) {
|
||||
append(KeymapUtil.getShortcutText(shortcuts[0]))
|
||||
}
|
||||
|
||||
if (HtmlUtil.isHtmlFile(result.file)) {
|
||||
builder.append(if (exists) ", " else "").append("hold Shift to open URL of local file")
|
||||
if (HtmlUtil.isHtmlFile(result.file)) {
|
||||
append(if (exists) ", " else "")
|
||||
append("hold Shift to open URL of local file")
|
||||
}
|
||||
}
|
||||
if (shortcutInfo.isNotEmpty()) {
|
||||
description = "$description ($shortcutInfo)"
|
||||
}
|
||||
builder.append(')')
|
||||
description = builder.toString()
|
||||
}
|
||||
e.presentation.text = description
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user