mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-04 17:20:55 +07:00
[platform] later activation of DialogAppender; getting rid of "force delaying hack"
GitOrigin-RevId: 8a117c299bcda305c92050ffd43728534d8c77ff
This commit is contained in:
committed by
intellij-monorepo-bot
parent
abc2bc14ba
commit
5f1096366f
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||||
package com.intellij.idea;
|
package com.intellij.idea;
|
||||||
|
|
||||||
import org.jetbrains.annotations.ApiStatus;
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
@@ -140,7 +140,7 @@ public final class AppMode {
|
|||||||
"keymap", "update", "inspections", "intentions", "rdserver-headless", "thinClient-headless", "installPlugins", "dumpActions",
|
"keymap", "update", "inspections", "intentions", "rdserver-headless", "thinClient-headless", "installPlugins", "dumpActions",
|
||||||
"cwmHostStatus", "remoteDevStatus", "invalidateCaches", "warmup", "buildEventsScheme", "inspectopedia-generator", "remoteDevShowHelp",
|
"cwmHostStatus", "remoteDevStatus", "invalidateCaches", "warmup", "buildEventsScheme", "inspectopedia-generator", "remoteDevShowHelp",
|
||||||
"installGatewayProtocolHandler", "uninstallGatewayProtocolHandler", "appcodeClangModulesDiff", "appcodeClangModulesPrinter", "exit",
|
"installGatewayProtocolHandler", "uninstallGatewayProtocolHandler", "appcodeClangModulesDiff", "appcodeClangModulesPrinter", "exit",
|
||||||
"qodanaExcludedPlugins");
|
"qodanaExcludedPlugins", "project-with-shared-caches");
|
||||||
return headlessCommands.contains(firstArg) || firstArg.length() < 20 && firstArg.endsWith("inspect");
|
return headlessCommands.contains(firstArg) || firstArg.length() < 20 && firstArg.endsWith("inspect");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,20 +14,10 @@ import java.util.*
|
|||||||
import java.util.logging.Handler
|
import java.util.logging.Handler
|
||||||
import java.util.logging.Level
|
import java.util.logging.Level
|
||||||
import java.util.logging.LogRecord
|
import java.util.logging.LogRecord
|
||||||
import kotlin.concurrent.Volatile
|
|
||||||
|
|
||||||
@ApiStatus.Internal
|
@ApiStatus.Internal
|
||||||
class DialogAppender : Handler() {
|
class DialogAppender : Handler() {
|
||||||
companion object {
|
private val MAX_EARLY_LOGGING_EVENTS = 20
|
||||||
//TODO android update checker accesses project jdk, fix it and remove
|
|
||||||
fun delayPublishingForcibly() {
|
|
||||||
delay = true
|
|
||||||
}
|
|
||||||
|
|
||||||
fun stopForceDelaying() {
|
|
||||||
delay = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private var earlyEventCounter = 0
|
private var earlyEventCounter = 0
|
||||||
private val earlyEvents = ArrayDeque<IdeaLoggingEvent>()
|
private val earlyEvents = ArrayDeque<IdeaLoggingEvent>()
|
||||||
@@ -52,7 +42,7 @@ class DialogAppender : Handler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
synchronized(this) {
|
synchronized(this) {
|
||||||
if (LoadingState.COMPONENTS_LOADED.isOccurred && !delay) {
|
if (LoadingState.APP_READY.isOccurred) {
|
||||||
processEarlyEventsIfNeeded()
|
processEarlyEventsIfNeeded()
|
||||||
queueAppend(ideaEvent)
|
queueAppend(ideaEvent)
|
||||||
}
|
}
|
||||||
@@ -89,34 +79,29 @@ class DialogAppender : Handler() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun flush() {}
|
override fun flush() { }
|
||||||
|
|
||||||
override fun close() {}
|
override fun close() { }
|
||||||
}
|
|
||||||
|
|
||||||
@Volatile
|
private fun extractLoggingEvent(messageObject: Any?, throwable: Throwable): IdeaLoggingEvent {
|
||||||
private var delay = false
|
var message: String? = null
|
||||||
|
val withAttachments = ExceptionUtil.findCauseAndSuppressed(throwable, ExceptionWithAttachments::class.java)
|
||||||
private const val MAX_EARLY_LOGGING_EVENTS = 20
|
(withAttachments.firstOrNull() as? RuntimeExceptionWithAttachments)?.let {
|
||||||
|
message = it.userMessage
|
||||||
private fun extractLoggingEvent(messageObject: Any?, throwable: Throwable): IdeaLoggingEvent {
|
}
|
||||||
var message: String? = null
|
if (message == null && messageObject != null) {
|
||||||
val withAttachments = ExceptionUtil.findCauseAndSuppressed(throwable, ExceptionWithAttachments::class.java)
|
message = messageObject.toString()
|
||||||
(withAttachments.firstOrNull() as? RuntimeExceptionWithAttachments)?.let {
|
}
|
||||||
message = it.userMessage
|
|
||||||
}
|
if (withAttachments.isEmpty()) {
|
||||||
if (message == null && messageObject != null) {
|
return IdeaLoggingEvent(message, throwable)
|
||||||
message = messageObject.toString()
|
}
|
||||||
}
|
else {
|
||||||
|
val list = ArrayList<Attachment>()
|
||||||
if (withAttachments.isEmpty()) {
|
for (e in withAttachments) {
|
||||||
return IdeaLoggingEvent(message, throwable)
|
list.addAll(e.attachments)
|
||||||
}
|
}
|
||||||
else {
|
return LogMessage.eventOf(throwable, message, list)
|
||||||
val list = ArrayList<Attachment>()
|
|
||||||
for (e in withAttachments) {
|
|
||||||
list.addAll(e.attachments)
|
|
||||||
}
|
}
|
||||||
return LogMessage.eventOf(throwable, message, list)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||||
package com.intellij.diagnostic;
|
package com.intellij.diagnostic;
|
||||||
|
|
||||||
import org.jetbrains.annotations.ApiStatus;
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
@@ -15,9 +15,7 @@ public enum LoadingState {
|
|||||||
COMPONENTS_REGISTERED("app component registered"),
|
COMPONENTS_REGISTERED("app component registered"),
|
||||||
CONFIGURATION_STORE_INITIALIZED("app store initialized"),
|
CONFIGURATION_STORE_INITIALIZED("app store initialized"),
|
||||||
COMPONENTS_LOADED("app component loaded"),
|
COMPONENTS_LOADED("app component loaded"),
|
||||||
/**
|
/** Application and LaF are ready, but it's too early for the post-startup activities, still. */
|
||||||
* Application and LaF are ready, but it's too early for the post-startup activities, yet.
|
|
||||||
*/
|
|
||||||
APP_READY("app ready"),
|
APP_READY("app ready"),
|
||||||
APP_STARTED("app started"),
|
APP_STARTED("app started"),
|
||||||
PROJECT_OPENED("project opened");
|
PROJECT_OPENED("project opened");
|
||||||
@@ -85,7 +83,6 @@ public enum LoadingState {
|
|||||||
if (this == obj) {
|
if (this == obj) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj instanceof ThrowableWrapper) {
|
if (obj instanceof ThrowableWrapper) {
|
||||||
Throwable throwable = ((ThrowableWrapper)obj).throwable;
|
Throwable throwable = ((ThrowableWrapper)obj).throwable;
|
||||||
return this.throwable == throwable || fingerprint(this.throwable).equals(fingerprint(throwable));
|
return this.throwable == throwable || fingerprint(this.throwable).equals(fingerprint(throwable));
|
||||||
|
|||||||
Reference in New Issue
Block a user