tooltips: remove explicit actionid / use custom shortcut

This commit is contained in:
anstarovoyt
2018-05-13 18:52:35 +03:00
parent 0fbf46dd12
commit edbac54385
3 changed files with 7 additions and 7 deletions
@@ -30,14 +30,18 @@ import com.intellij.util.ui.Html
import com.intellij.util.ui.JBUI
import com.intellij.util.ui.UIUtil
import java.awt.*
import java.awt.event.KeyEvent
import java.awt.event.MouseEvent
import java.util.*
import javax.swing.JComponent
import javax.swing.JPanel
import javax.swing.KeyStroke
import javax.swing.MenuSelectionManager
import javax.swing.event.HyperlinkEvent
val runActionCustomShortcutSet = CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, KeyEvent.SHIFT_DOWN_MASK or KeyEvent.ALT_DOWN_MASK ))
internal class DaemonTooltipWithActionRenderer(text: String?,
private val tooltipAction: TooltipAction?,
width: Int,
@@ -90,7 +94,7 @@ internal class DaemonTooltipWithActionRenderer(text: String?,
actions: ArrayList<AnAction>,
tooltipReloader: TooltipReloader) {
super.fillPanel(editor, grid, hint, hintHint, actions, tooltipReloader)
if (grid !is JPanel || tooltipAction == null && !LineTooltipRenderer.isActiveHtml(myText!!)) return
if (tooltipAction == null && !LineTooltipRenderer.isActiveHtml(myText!!)) return
val settingsComponent = createSettingsComponent(hint, hintHint, tooltipReloader)
@@ -118,7 +122,7 @@ internal class DaemonTooltipWithActionRenderer(text: String?,
tooltipAction.execute(editor)
}
val shortcutRunActionText = getKeymap(IdeActions.ACTION_RUN_INTENTION_ACTION)
val shortcutRunActionText = KeymapUtil.getShortcutsText(runActionCustomShortcutSet.shortcuts)
val shortcutShowAllActionsText = getKeymap(IdeActions.ACTION_SHOW_INTENTION_ACTIONS)
val gridBag = GridBag()
@@ -142,7 +146,7 @@ internal class DaemonTooltipWithActionRenderer(text: String?,
}
init {
registerCustomShortcutSet(getActiveKeymapShortcuts(IdeActions.ACTION_RUN_INTENTION_ACTION), editor.contentComponent)
registerCustomShortcutSet(runActionCustomShortcutSet, editor.contentComponent)
}
})
@@ -291,7 +291,6 @@ public interface IdeActions {
@NonNls String GROUP_ANALYZE = "AnalyzeMenu";
@NonNls String ACTION_SHOW_ERROR_DESCRIPTION = "ShowErrorDescription";
@NonNls String ACTION_RUN_INTENTION_ACTION = "RunErrorIntentionAction";
@NonNls String ACTION_EDITOR_DUPLICATE = "EditorDuplicate";
@NonNls String ACTION_EDITOR_DUPLICATE_LINES = "EditorDuplicateLines";
@@ -439,9 +439,6 @@
<action id="ShowIntentionActions">
<keyboard-shortcut first-keystroke="alt ENTER"/>
</action>
<action id="RunErrorIntentionAction">
<keyboard-shortcut first-keystroke="alt shift ENTER"/>
</action>
<action id="ExpandAllRegions">
<keyboard-shortcut first-keystroke="control shift ADD"/>
<keyboard-shortcut first-keystroke="control shift EQUALS"/>