IDEA-374719 [debugger] Rearrange call chains in XStackFrame's default implementations

Both new methods should delegate to the old customizePresentation by default. Otherwise, "Copy Stack" functionality regresses in every implementation that provides custom customizePresentation but not customizeTextPresentation.


(cherry picked from commit 1a9ebc65b694d445ca67c650da0f0a14f8ce94b7)

IJ-CR-166739

GitOrigin-RevId: 8245fabe744417ac192373a3ebc74073d336339d
This commit is contained in:
Alexander Kuznetsov
2025-06-23 15:05:21 +02:00
committed by intellij-monorepo-bot
parent 6aa967f704
commit 982416687e

View File

@@ -69,7 +69,15 @@ public abstract class XStackFrame extends XValueContainer {
* Otherwise, override {@link #customizePresentation()} to provide (asynchronous) presentation update.
*/
public void customizePresentation(@NotNull ColoredTextContainer component) {
customizeTextPresentation(component);
XSourcePosition position = getSourcePosition();
if (position != null) {
component.append(position.getFile().getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
component.append(":" + (position.getLine() + 1), SimpleTextAttributes.REGULAR_ATTRIBUTES);
component.setIcon(AllIcons.Debugger.Frame);
}
else {
component.append(XDebuggerBundle.message("invalid.frame"), SimpleTextAttributes.ERROR_ATTRIBUTES);
}
}
/**
@@ -96,14 +104,6 @@ public abstract class XStackFrame extends XValueContainer {
* not as a visible UI component. "Copy Stack" is one of the prominent examples.
*/
public void customizeTextPresentation(@NotNull ColoredTextContainer component) {
XSourcePosition position = getSourcePosition();
if (position != null) {
component.append(position.getFile().getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
component.append(":" + (position.getLine() + 1), SimpleTextAttributes.REGULAR_ATTRIBUTES);
component.setIcon(AllIcons.Debugger.Frame);
}
else {
component.append(XDebuggerBundle.message("invalid.frame"), SimpleTextAttributes.ERROR_ATTRIBUTES);
}
customizePresentation(component);
}
}