diff --git a/java/java-impl/src/com/intellij/refactoring/ui/MethodCellRenderer.java b/java/java-impl/src/com/intellij/refactoring/ui/MethodCellRenderer.java index 38ae239de730..2f54e293872b 100644 --- a/java/java-impl/src/com/intellij/refactoring/ui/MethodCellRenderer.java +++ b/java/java-impl/src/com/intellij/refactoring/ui/MethodCellRenderer.java @@ -1,6 +1,7 @@ // Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.refactoring.ui; +import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.util.Iconable; import com.intellij.psi.PsiMethod; import com.intellij.psi.PsiSubstitutor; @@ -22,10 +23,12 @@ public class MethodCellRenderer extends DefaultListCellRenderer { PsiMethod method = (PsiMethod) value; - final String text = PsiFormatUtil.formatMethod(method, PsiSubstitutor.EMPTY, - PsiFormatUtilBase.SHOW_CONTAINING_CLASS | PsiFormatUtilBase.SHOW_NAME | - PsiFormatUtilBase.SHOW_PARAMETERS, - PsiFormatUtilBase.SHOW_TYPE); + final String text = ReadAction.compute(() -> + PsiFormatUtil.formatMethod(method, PsiSubstitutor.EMPTY, + PsiFormatUtilBase.SHOW_CONTAINING_CLASS | PsiFormatUtilBase.SHOW_NAME | + PsiFormatUtilBase.SHOW_PARAMETERS, + PsiFormatUtilBase.SHOW_TYPE)); + setText(text); Icon icon = method.getIcon(Iconable.ICON_FLAG_VISIBILITY);