JComponent (@NotNull RefEntity entity) { final Project project = entity.getRefManager().getProject(); DescriptionEditorPane htmlView = new DescriptionEditorPane() { @Override public String getToolTipText(MouseEvent evt) { int pos = viewToModel(evt.getPoint()); if (pos >= 0) { HTMLDocument hdoc = (HTMLDocument) getDocument(); javax.swing.text.Element e = hdoc.getCharacterElement(pos); AttributeSet a = e.getAttributes(); SimpleAttributeSet value = (SimpleAttributeSet) a.getAttribute(HTML.Tag.A); if (value != null) { String objectPackage = (String) value.getAttribute("qualifiedname"); if (objectPackage != null) { return objectPackage; } } } return null; } }; htmlView.addHyperlinkListener(new HyperlinkAdapter() { @Override protected void hyperlinkActivated(@NotNull HyperlinkEvent e) { URL url = e.getURL(); if (url == null) { return; } @NonNls String ref = url.getRef(); int offset = Integer.parseInt(ref); String fileURL = url.toExternalForm(); fileURL = fileURL.substring(0, fileURL.indexOf('#')); VirtualFile vFile = VirtualFileManager.getInstance().findFileByUrl(fileURL); if (vFile == null) { vFile = VfsUtil.findFileByURL(url); } if (vFile != null) { Navigatable descriptor = PsiNavigationSupport.getInstance().createNavigatable(project, vFile, offset); descriptor.navigate(true); } } }); final StyleSheet css = ((HTMLEditorKit)htmlView.getEditorKit()).getStyleSheet(); css.addRule("p.problem-description-group {text-indent: " + JBUIScale.scale(9) + "px;font-weight:bold;}"); css.addRule("div.problem-description {margin-left: " + JBUIScale.scale(9) + "px;}"); css.addRule("ul {margin-left:" + JBUIScale.scale(10) + "px;text-indent: 0}"); css.addRule("code {font-family:" + StartupUiUtil.getLabelFont().getFamily() + "}"); final @Nls StringBuilder buf = new StringBuilder(); getComposer().compose(buf, entity, false); final String text = buf.toString(); DescriptionEditorPaneKt.readHTML(htmlView, text); return ScrollPaneFactory.createScrollPane(htmlView, true); }