From 72259e1a5be7bec1e5e04d705231f53e977e24ef Mon Sep 17 00:00:00 2001 From: Alexey Kalina Date: Wed, 15 Apr 2020 23:05:01 +0300 Subject: [PATCH] update presentation for dumping features action GitOrigin-RevId: 89e6ac11c36f190d76ce2005a8c31e5b2fb4a151 --- plugins/stats-collector/resources/META-INF/plugin.xml | 4 +++- .../intellij/completion/actions/MLCompletionFeaturesUtil.kt | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/plugins/stats-collector/resources/META-INF/plugin.xml b/plugins/stats-collector/resources/META-INF/plugin.xml index b2f15726db67..f6d7cc362704 100644 --- a/plugins/stats-collector/resources/META-INF/plugin.xml +++ b/plugins/stats-collector/resources/META-INF/plugin.xml @@ -28,8 +28,10 @@ + class="com.intellij.completion.actions.MLCompletionFeaturesUtil$CopyFeaturesToClipboard" + text="Copy ML Completion Features To Clipboard"> + diff --git a/plugins/stats-collector/src/com/intellij/completion/actions/MLCompletionFeaturesUtil.kt b/plugins/stats-collector/src/com/intellij/completion/actions/MLCompletionFeaturesUtil.kt index 97d789abb579..727206b38521 100644 --- a/plugins/stats-collector/src/com/intellij/completion/actions/MLCompletionFeaturesUtil.kt +++ b/plugins/stats-collector/src/com/intellij/completion/actions/MLCompletionFeaturesUtil.kt @@ -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