HtmlChunk (@NotNull PyClass pyClass, boolean preferQualifiedName) { final String qualifiedName = pyClass.getQualifiedName(); final String shortName = pyClass.getName(); final String linkText = preferQualifiedName && qualifiedName != null ? qualifiedName : shortName; if (linkText == null) { return null; } if (qualifiedName != null) { return PyDocumentationLink.toClass(pyClass, linkText); } else if (PsiTreeUtil.getParentOfType(myElement, PyClass.class, false) == pyClass) { return PyDocumentationLink.toContainingClass(linkText); } return HtmlChunk.raw(linkText); }