From c6ecb4c5d2d4219e9b57f3d4c2e183d4c25af61c Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Mon, 19 Jul 2021 10:31:33 +0200 Subject: [PATCH] [java decompiler] background-updateable `ShowDecompiledClassAction` (EA-264197) GitOrigin-RevId: ed9876b9eae08c52d18e7a46736859f61e32c37f --- .../jetbrains/java/decompiler/ShowDecompiledClassAction.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/java-decompiler/plugin/src/org/jetbrains/java/decompiler/ShowDecompiledClassAction.kt b/plugins/java-decompiler/plugin/src/org/jetbrains/java/decompiler/ShowDecompiledClassAction.kt index 8eeb25151b2e..57e75af2f697 100644 --- a/plugins/java-decompiler/plugin/src/org/jetbrains/java/decompiler/ShowDecompiledClassAction.kt +++ b/plugins/java-decompiler/plugin/src/org/jetbrains/java/decompiler/ShowDecompiledClassAction.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.java.decompiler import com.intellij.ide.highlighter.JavaClassFileType @@ -6,6 +6,7 @@ import com.intellij.ide.util.PsiNavigationSupport import com.intellij.openapi.actionSystem.AnAction import com.intellij.openapi.actionSystem.AnActionEvent import com.intellij.openapi.actionSystem.CommonDataKeys +import com.intellij.openapi.actionSystem.UpdateInBackground import com.intellij.openapi.vfs.VirtualFile import com.intellij.psi.PsiClass import com.intellij.psi.PsiClassOwner @@ -13,7 +14,7 @@ import com.intellij.psi.PsiElement import com.intellij.psi.util.PsiTreeUtil import com.intellij.psi.util.PsiUtilBase -class ShowDecompiledClassAction : AnAction(IdeaDecompilerBundle.message("action.show.decompiled.name")) { +class ShowDecompiledClassAction : AnAction(IdeaDecompilerBundle.message("action.show.decompiled.name")), UpdateInBackground { override fun update(e: AnActionEvent) { val psiElement = getPsiElement(e) val visible = psiElement?.containingFile is PsiClassOwner @@ -42,4 +43,4 @@ class ShowDecompiledClassAction : AnAction(IdeaDecompilerBundle.message("action. val file = psiClass?.originalElement?.containingFile?.virtualFile return if (file != null && file.fileType == JavaClassFileType.INSTANCE) file else null } -} \ No newline at end of file +}