update presentation for dumping features action

GitOrigin-RevId: 89e6ac11c36f190d76ce2005a8c31e5b2fb4a151
This commit is contained in:
Alexey Kalina
2020-04-15 21:31:10 +00:00
committed by intellij-monorepo-bot
parent 86035a3cbf
commit 72259e1a5b
2 changed files with 8 additions and 1 deletions
@@ -28,8 +28,10 @@
<actions>
<action id="DumpMLCompletionFeatures"
class="com.intellij.completion.actions.MLCompletionFeaturesUtil$CopyFeaturesToClipboard">
class="com.intellij.completion.actions.MLCompletionFeaturesUtil$CopyFeaturesToClipboard"
text="Copy ML Completion Features To Clipboard">
<keyboard-shortcut keymap="$default" first-keystroke="ctrl shift alt 0"/>
<add-to-group group-id="MaintenanceGroup" anchor="before" relative-to-action="DumpLookupElementWeights"/>
</action>
</actions>
@@ -42,6 +42,11 @@ object MLCompletionFeaturesUtil {
private val gson: Gson = GsonBuilder().setPrettyPrinting().create()
}
override fun update(e: AnActionEvent) {
val editor = e.getData(CommonDataKeys.EDITOR)
e.presentation.isEnabled = editor != null && LookupManager.getActiveLookup(editor) != null
}
override fun actionPerformed(e: AnActionEvent) {
val editor = e.getData(CommonDataKeys.EDITOR)
val lookup = LookupManager.getActiveLookup(editor) as? LookupImpl ?: return