[java decompiler] background-updateable ShowDecompiledClassAction (EA-264197)

GitOrigin-RevId: ed9876b9eae08c52d18e7a46736859f61e32c37f
This commit is contained in:
Roman Shevchenko
2021-07-19 10:31:33 +02:00
committed by intellij-monorepo-bot
parent bd90081f13
commit c6ecb4c5d2

View File

@@ -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
}
}
}