Add fallback messages for stack descriptions if the computation failed

GitOrigin-RevId: 1b7ce62e3e842b04f40a2b24e9a8e87d2e6ccfaa
This commit is contained in:
Arseny Chernyaev
2025-02-03 17:47:33 +00:00
committed by intellij-monorepo-bot
parent e08ebd59a6
commit 35d82f3e41
2 changed files with 20 additions and 5 deletions
@@ -352,3 +352,5 @@ xdebugger.intention.control.exception.breakpoint.family=Create exception breakpo
xdebugger.intention.control.exception.breakpoint.create.text=Create exception breakpoint on {0}
xdebugger.intention.control.exception.breakpoint.enable.text=Enable exception breakpoint on {0}
xdebugger.intention.control.exception.breakpoint.disable.text=Disable exception breakpoint on {0}
xdebugger.execution.stack.description.not.available.message=Description is not available
@@ -9,6 +9,7 @@ import com.intellij.ide.ui.text.parts.RegularTextPart
import com.intellij.openapi.Disposable
import com.intellij.openapi.actionSystem.ActionGroup
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.application.EDT
import com.intellij.openapi.components.service
import com.intellij.openapi.diagnostic.Logger
@@ -26,6 +27,7 @@ import com.intellij.util.ui.TextTransferable
import com.intellij.util.ui.UIUtil
import com.intellij.xdebugger.XDebugSession
import com.intellij.xdebugger.XDebugSessionListener
import com.intellij.xdebugger.XDebuggerBundle
import com.intellij.xdebugger.frame.XExecutionStack
import com.intellij.xdebugger.frame.XStackFrame
import com.intellij.xdebugger.frame.XSuspendContext
@@ -65,6 +67,8 @@ import javax.swing.event.ListDataListener
import javax.swing.text.StyleConstants
import kotlin.time.toKotlinDuration
private val logger = Logger.getInstance(XThreadsFramesView::class.java)
@Internal
class XThreadsFramesView(val debugTab: XDebugSessionTab3) : XDebugView() {
private val myPauseDisposables = SequentialDisposables(this)
@@ -164,7 +168,11 @@ class XThreadsFramesView(val debugTab: XDebugSessionTab3) : XDebugView() {
false,
SPLITTER_PROPORTION_KEY,
SPLITTER_PROPORTION_DEFAULT_VALUE,
debugTab, debugTab.project), OccurenceNavigator by myFramesList {}
debugTab, debugTab.project), OccurenceNavigator by myFramesList {
override fun getActionUpdateThread(): ActionUpdateThread {
return super.getActionUpdateThread()
}
}
val minimumDimension = Dimension(JBUI.scale(26), 0)
val threadsScrollPane = myThreadsList.withSpeedSearch().toScrollPane()
@@ -353,7 +361,14 @@ class XThreadsFramesView(val debugTab: XDebugSessionTab3) : XDebugView() {
setActiveThreadDescription(IdeBundle.message("progress.text.loading"))
stackInfoDescriptionRequester?.requestDescription(this) { description, exception ->
description?.let { setActiveThreadDescription(it.longDescription) }
if (exception != null) {
logger.error(exception)
}
@Nls
val longDescription = description?.longDescription ?: XDebuggerBundle.message("xdebugger.execution.stack.description.not.available.message")
setActiveThreadDescription(longDescription)
}
val currentFrame = myFramesManager.tryGetCurrentFrame(this) ?: return
@@ -673,9 +688,7 @@ internal class StackInfoDescriptionRequester(
if (exception != null) {
logger.error(exception)
}
if (result != null) {
stackInfo.description = result.shortDescription
}
stackInfo.description = result?.shortDescription ?: XDebuggerBundle.message("xdebugger.execution.stack.description.not.available.message")
}
}