EA-840941 - T: ClassObjectRenderer$0.lambda$evaluate$0

GitOrigin-RevId: 54fb419838601ef89011f0d8638febbd84c8a6ff
This commit is contained in:
Egor Ushakov
2024-07-01 18:39:05 +02:00
committed by intellij-monorepo-bot
parent 58d8eddeb8
commit 0b26408673

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 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-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.debugger.ui.tree.render;
import com.intellij.debugger.JavaDebuggerBundle;
@@ -10,6 +10,8 @@ import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
import com.intellij.util.PsiNavigateUtil;
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
import com.sun.jdi.*;
import org.jetbrains.annotations.NotNull;
@@ -49,13 +51,12 @@ final class ClassObjectRenderer extends CompoundRendererProvider {
Value res = process.invokeMethod(evaluationContext, (ObjectReference)value, nameMethod, Collections.emptyList());
if (res instanceof StringReference) {
callback.evaluated("");
final String line = ((StringReference)res).value();
String className = ((StringReference)res).value();
ApplicationManager.getApplication().runReadAction(() -> {
final PsiClass psiClass = DebuggerUtils.findClass(line,
valueDescriptor.getProject(),
process.getSearchScope());
PsiClass psiClass = DebuggerUtils.findClass(className, valueDescriptor.getProject(), process.getSearchScope());
if (psiClass != null) {
DebuggerUIUtil.invokeLater(() -> psiClass.navigate(true));
PsiElement element = psiClass.getNavigationElement(); // do not do this in EDT
DebuggerUIUtil.invokeLater(() -> PsiNavigateUtil.navigate(element));
}
});
}