mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
[java decompiler] background-updateable ShowDecompiledClassAction (EA-264197)
GitOrigin-RevId: ed9876b9eae08c52d18e7a46736859f61e32c37f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
bd90081f13
commit
c6ecb4c5d2
@@ -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
|
package org.jetbrains.java.decompiler
|
||||||
|
|
||||||
import com.intellij.ide.highlighter.JavaClassFileType
|
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.AnAction
|
||||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||||
import com.intellij.openapi.actionSystem.CommonDataKeys
|
import com.intellij.openapi.actionSystem.CommonDataKeys
|
||||||
|
import com.intellij.openapi.actionSystem.UpdateInBackground
|
||||||
import com.intellij.openapi.vfs.VirtualFile
|
import com.intellij.openapi.vfs.VirtualFile
|
||||||
import com.intellij.psi.PsiClass
|
import com.intellij.psi.PsiClass
|
||||||
import com.intellij.psi.PsiClassOwner
|
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.PsiTreeUtil
|
||||||
import com.intellij.psi.util.PsiUtilBase
|
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) {
|
override fun update(e: AnActionEvent) {
|
||||||
val psiElement = getPsiElement(e)
|
val psiElement = getPsiElement(e)
|
||||||
val visible = psiElement?.containingFile is PsiClassOwner
|
val visible = psiElement?.containingFile is PsiClassOwner
|
||||||
@@ -42,4 +43,4 @@ class ShowDecompiledClassAction : AnAction(IdeaDecompilerBundle.message("action.
|
|||||||
val file = psiClass?.originalElement?.containingFile?.virtualFile
|
val file = psiClass?.originalElement?.containingFile?.virtualFile
|
||||||
return if (file != null && file.fileType == JavaClassFileType.INSTANCE) file else null
|
return if (file != null && file.fileType == JavaClassFileType.INSTANCE) file else null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user