void (@NotNull final JTree tree, final Object value, final boolean selected, final boolean expanded, final boolean leaf, final int row, final boolean hasFocus) { final Object userObject = ((DefaultMutableTreeNode)value).getUserObject(); if (!(userObject instanceof MigrationNode)) return; final TypeMigrationUsageInfo usageInfo = ((MigrationNode)userObject).getInfo(); if (usageInfo != null) { final PsiElement element = usageInfo.getElement(); if (element != null) { PsiElement typeElement = null; if (element instanceof PsiVariable var) { typeElement = var.getTypeElement(); } else if (element instanceof PsiMethod method) { typeElement = method.getReturnTypeElement(); } if (typeElement == null) typeElement = element; final UsagePresentation presentation = UsageInfoToUsageConverter.convert(new PsiElement[]{typeElement}, new UsageInfo(typeElement)).getPresentation(); boolean isPrefix = true; //skip usage position for (TextChunk chunk : presentation.getText()) { if (!isPrefix) append(chunk.getText(), patchAttrs(usageInfo, chunk.getSimpleAttributesIgnoreBackground())); isPrefix = false; } setIcon(presentation.getIcon()); String location; if (element instanceof PsiMember) { location = SymbolPresentationUtil.getSymbolContainerText(element); } else { final PsiMember member = PsiTreeUtil.getParentOfType(element, PsiMember.class); if (member instanceof PsiField field) { location = PsiFormatUtil.formatVariable(field, PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_CONTAINING_CLASS | PsiFormatUtilBase.SHOW_FQ_NAME, PsiSubstitutor.EMPTY); } else if (member instanceof PsiMethod method) { location = PsiFormatUtil.formatMethod(method, PsiSubstitutor.EMPTY, PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_CONTAINING_CLASS | PsiFormatUtilBase.SHOW_FQ_NAME, PsiFormatUtilBase.SHOW_TYPE); } else if (member instanceof PsiClass psiClass) { location = PsiFormatUtil.formatClass(psiClass, PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_FQ_NAME); } else { location = null; } if (location != null) location = JavaPsiBundle.message("aux.context.display", location); } if (location != null) { append(location, SimpleTextAttributes.GRAYED_ATTRIBUTES); } } else { append(UsageViewBundle.message("node.invalid"), SimpleTextAttributes.ERROR_ATTRIBUTES); } } }