void (@NotNull CommonProblemDescriptor description, int i, @NotNull StringBuilder buf, @NotNull RefEntity refElement) { PsiElement expression = description instanceof ProblemDescriptor ? ((ProblemDescriptor)description).getPsiElement() : null; StringBuilder anchor = new StringBuilder(); VirtualFile vFile = null; if (expression != null) { vFile = (expression instanceof PsiFileSystemItem ? (PsiFileSystemItem) expression : expression.getContainingFile()).getVirtualFile(); if (vFile instanceof VirtualFileWindow) vFile = ((VirtualFileWindow)vFile).getDelegate(); anchor.append("<a HREF=\""); anchor.append(appendURL(vFile, "descr:" + i)); anchor.append("\">"); anchor.append(ProblemDescriptorUtil.extractHighlightedText(description, expression).replaceAll("\\$", "\\\\\\$")); anchor.append("</a>"); } else { anchor.append("<font style=\"font-weight:bold; color:#FF0000\";>"); anchor.append(AnalysisBundle.message("inspection.export.results.invalidated.item")); anchor.append("</font>"); } String descriptionTemplate = description.getDescriptionTemplate(); if (XmlStringUtil.isWrappedInHtml(descriptionTemplate)) { descriptionTemplate = XmlStringUtil.stripHtml(descriptionTemplate); } else { descriptionTemplate = StringUtil.replace(descriptionTemplate, "<code>", "'"); descriptionTemplate = StringUtil.replace(descriptionTemplate, "</code>", "'"); descriptionTemplate = XmlStringUtil.escapeString(descriptionTemplate); } final String reference = "#ref"; String res = descriptionTemplate.replaceAll(reference, anchor.toString()); int lineNumber = description instanceof ProblemDescriptor ? ((ProblemDescriptor)description).getLineNumber() : -1; StringBuilder lineAnchor = new StringBuilder(); if (expression != null && lineNumber >= 0) { Document doc = FileDocumentManager.getInstance().getDocument(vFile); if (doc != null && lineNumber < doc.getLineCount()) { lineNumber = Math.min(lineNumber, doc.getLineCount() - 1); lineAnchor.append(AnalysisBundle.message("inspection.export.results.at.line")).append(" "); lineAnchor.append("<a HREF=\""); int offset = doc.getLineStartOffset(lineNumber); offset = CharArrayUtil.shiftForward(doc.getCharsSequence(), offset, " \t"); lineAnchor.append(appendURL(vFile, String.valueOf(offset))); lineAnchor.append("\">"); lineAnchor.append((lineNumber + 1)); lineAnchor.append("</a>"); final String location = "#loc"; if (!res.contains(location)) { res += " (" + location + ")"; } res = res.replaceAll(location, lineAnchor.toString()); } } buf.append(res.replace("#end", "").replace("#treeend","")); buf.append(BR).append(BR); composeAdditionalDescription(buf, refElement); }