mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
IDEA-338011 Access is allowed from Event Dispatch Thread (EDT) only at com.intellij.codeInsight.codeVision.settings.CodeVisionSettingsLiveModel$isRegistryEnabled$1$1.afterValueChanged(CodeVisionSettingsLiveModel.kt:21)
GitOrigin-RevId: 648d4505d4fc82d22f47e1a28164ba40ea653eae
This commit is contained in:
committed by
intellij-monorepo-bot
parent
378e147165
commit
1c17772693
@@ -17,7 +17,9 @@
|
||||
|
||||
<applicationListeners>
|
||||
<listener class="org.jetbrains.java.decompiler.IdeaDecompiler$LegalBurden"
|
||||
topic="com.intellij.openapi.fileEditor.FileEditorManagerListener$Before"/>
|
||||
topic="com.intellij.openapi.fileEditor.FileEditorManagerListener$Before"
|
||||
activeInHeadlessMode="false"
|
||||
activeInTestMode="false"/>
|
||||
</applicationListeners>
|
||||
|
||||
<actions>
|
||||
|
||||
@@ -42,11 +42,23 @@ import java.util.jar.Manifest
|
||||
const val IDEA_DECOMPILER_BANNER: String = "//\n// Source code recreated from a .class file by IntelliJ IDEA\n// (powered by FernFlower decompiler)\n//\n\n"
|
||||
|
||||
class IdeaDecompiler : ClassFileDecompilers.Light() {
|
||||
class LegalBurden : FileEditorManagerListener.Before {
|
||||
private var showNotice = !canWork()
|
||||
internal class LegalBurden : FileEditorManagerListener.Before {
|
||||
private var showNotice: Boolean? = null
|
||||
|
||||
override fun beforeFileOpened(source: FileEditorManager, file: VirtualFile) {
|
||||
if (!showNotice || file.fileType !== JavaClassFileType.INSTANCE) {
|
||||
showNotice?.let {
|
||||
if (!it) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// fileType is cached per file, it is a cheap call, so, check before PropertiesComponent
|
||||
if (file.fileType !== JavaClassFileType.INSTANCE) {
|
||||
return
|
||||
}
|
||||
|
||||
if (PropertiesComponent.getInstance().isValueSet(LEGAL_NOTICE_KEY)) {
|
||||
showNotice = false
|
||||
return
|
||||
}
|
||||
|
||||
@@ -98,7 +110,7 @@ class IdeaDecompiler : ClassFileDecompilers.Light() {
|
||||
override fun accepts(file: VirtualFile): Boolean = true
|
||||
|
||||
override fun getText(file: VirtualFile): CharSequence {
|
||||
if (canWork()) {
|
||||
if (ApplicationManager.getApplication().isUnitTestMode || PropertiesComponent.getInstance().isValueSet(LEGAL_NOTICE_KEY)) {
|
||||
val previous = TASK_KEY.pop(file)?.get()
|
||||
if (previous != null) {
|
||||
return previous
|
||||
@@ -233,8 +245,4 @@ private fun getOptions(): Map<String, Any> {
|
||||
IFernflowerPreferences.VERIFY_ANONYMOUS_CLASSES to "1",
|
||||
//IFernflowerPreferences.UNIT_TEST_MODE to if (ApplicationManager.getApplication().isUnitTestMode) "1" else "0"
|
||||
)
|
||||
}
|
||||
|
||||
private fun canWork(): Boolean {
|
||||
return ApplicationManager.getApplication().isUnitTestMode || PropertiesComponent.getInstance().isValueSet(LEGAL_NOTICE_KEY)
|
||||
}
|
||||
Reference in New Issue
Block a user