Allow to throw plugin exception when plugin version is patched

This commit is contained in:
Nikolay Krasko
2019-03-07 13:08:14 +03:00
parent ddc9d0eba1
commit 7f07782095
2 changed files with 11 additions and 3 deletions
+3 -3
View File
@@ -136,9 +136,6 @@
<action id="StoredExceptionsThrowToggleAction" class="org.jetbrains.kotlin.idea.actions.internal.StoredExceptionsThrowToggleAction"
text="Throw cached PCE"/>
<action id="KotlinThrowException" class="org.jetbrains.kotlin.idea.actions.internal.KotlinThrowExceptionAction"
text="Throw Kotlin Plugin Exception"/>
<action id="CopyAsDiagnosticTest" class="org.jetbrains.kotlin.idea.actions.internal.CopyAsDiagnosticTestAction"
text="Copy Current File As Diagnostic Test"/>
@@ -153,6 +150,9 @@
<add-to-group group-id="Internal" anchor="last"/>
</group>
<action id="KotlinThrowException" class="org.jetbrains.kotlin.idea.actions.internal.KotlinThrowExceptionAction"
text="Throw Kotlin Plugin Exception"/>
<action id="ExtractFunctionToScope" class="org.jetbrains.kotlin.idea.refactoring.introduce.extractFunction.ExtractFunctionToScopeAction"
text="Function to _Scope...">
<keyboard-shortcut keymap="$default" first-keystroke="control alt shift M"/>
@@ -7,8 +7,16 @@ package org.jetbrains.kotlin.idea.actions.internal
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.application.ApplicationManager
import org.jetbrains.kotlin.idea.KotlinPluginUtil
class KotlinThrowExceptionAction : AnAction() {
override fun update(e: AnActionEvent) {
super.update(e)
e.presentation.isEnabledAndVisible = KotlinPluginUtil.isPatched() || ApplicationManager.getApplication().isInternal
}
override fun actionPerformed(e: AnActionEvent) {
throw IllegalStateException("Kotlin Test Exception")
}