mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
java: generating a bit nicer html when exporting inspection results
GitOrigin-RevId: 005a2fc6ba99418297f4ab700b5282a7db56e850
This commit is contained in:
committed by
intellij-monorepo-bot
parent
68ea732817
commit
160233e5fc
@@ -24,8 +24,6 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class HTMLComposerImpl extends HTMLComposer {
|
||||
private final int[] myListStack;
|
||||
private int myListStackTop;
|
||||
private final Map<Key, HTMLComposerExtension> myExtensions = new HashMap<>();
|
||||
private final Map<Language, HTMLComposerExtension> myLanguageExtensions = new HashMap<>();
|
||||
protected static final @NonNls String BR = "<br>";
|
||||
@@ -40,8 +38,6 @@ public abstract class HTMLComposerImpl extends HTMLComposer {
|
||||
public static final @NonNls String A_CLOSING = "</a>";
|
||||
|
||||
protected HTMLComposerImpl() {
|
||||
myListStack = new int[5];
|
||||
myListStackTop = -1;
|
||||
for (InspectionExtensionsFactory factory : InspectionExtensionsFactory.EP_NAME.getExtensionList()) {
|
||||
final HTMLComposerExtension<?> extension = factory.createHTMLComposerExtension(this);
|
||||
if (extension != null) {
|
||||
@@ -179,11 +175,8 @@ public abstract class HTMLComposerImpl extends HTMLComposer {
|
||||
if (extension != null) {
|
||||
extension.appendReferencePresentation(refElement, buf, isPackageIncluded);
|
||||
} else if (refElement instanceof RefFile || refElement instanceof RefDirectory) {
|
||||
buf.append(A_HREF_OPENING);
|
||||
buf.append(A_HREF_OPENING).append(((RefElementImpl)refElement).getURL()).append("\">");
|
||||
|
||||
buf.append(((RefElementImpl)refElement).getURL());
|
||||
|
||||
buf.append("\">");
|
||||
String refElementName = refElement.getName();
|
||||
final PsiElement element = refElement.getPsiElement();
|
||||
if (element != null) {
|
||||
@@ -215,7 +208,7 @@ public abstract class HTMLComposerImpl extends HTMLComposer {
|
||||
|
||||
@Override
|
||||
public void appendElementInReferences(@NotNull StringBuilder buf, RefElement refElement) {
|
||||
if (refElement.getInReferences().size() > 0) {
|
||||
if (!refElement.getInReferences().isEmpty()) {
|
||||
appendHeading(buf, AnalysisBundle.message("inspection.export.results.used.from"));
|
||||
startList(buf);
|
||||
for (RefElement refCaller : refElement.getInReferences()) {
|
||||
@@ -227,7 +220,7 @@ public abstract class HTMLComposerImpl extends HTMLComposer {
|
||||
|
||||
@Override
|
||||
public void appendElementOutReferences(@NotNull StringBuilder buf, RefElement refElement) {
|
||||
if (refElement.getOutReferences().size() > 0) {
|
||||
if (!refElement.getOutReferences().isEmpty()) {
|
||||
appendHeading(buf, AnalysisBundle.message("inspection.export.results.uses"));
|
||||
startList(buf);
|
||||
for (RefElement refCallee : refElement.getOutReferences()) {
|
||||
@@ -271,38 +264,22 @@ public abstract class HTMLComposerImpl extends HTMLComposer {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void startList(@NotNull StringBuilder buf) {
|
||||
if (myListStackTop == -1) {
|
||||
buf.append("<div class=\"problem-description\">");
|
||||
}
|
||||
buf.append("<ul>");
|
||||
myListStackTop++;
|
||||
myListStack[myListStackTop] = 0;
|
||||
buf.append("\n<ul>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doneList(@NotNull StringBuilder buf) {
|
||||
buf.append("</ul>");
|
||||
if (myListStack[myListStackTop] != 0) {
|
||||
buf.append("<table cellpadding=\"0\" border=\"0\" cellspacing=\"0\"><tr><td> </td></tr></table>");
|
||||
}
|
||||
if (myListStackTop == 0) {
|
||||
buf.append("</div>");
|
||||
}
|
||||
myListStackTop--;
|
||||
buf.append("\n</ul>");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startListItem(@NotNull StringBuilder buf) {
|
||||
myListStack[myListStackTop]++;
|
||||
buf.append("<li>");
|
||||
buf.append("\n<li>");
|
||||
}
|
||||
|
||||
public static void doneListItem(@NotNull StringBuilder buf) {
|
||||
buf.append("</li>");
|
||||
}
|
||||
public static void doneListItem(@NotNull StringBuilder buf) {}
|
||||
|
||||
@Override
|
||||
public void appendNoProblems(@NotNull StringBuilder buf) {
|
||||
|
||||
@@ -44,12 +44,14 @@ public final class DescriptorComposer extends HTMLComposerImpl {
|
||||
|
||||
LOG.assertTrue(descriptions != null);
|
||||
|
||||
buf.append("\n<ul>");
|
||||
startList(buf);
|
||||
for (int i = 0; i < descriptions.length; i++) {
|
||||
buf.append("\n<li>");
|
||||
startListItem(buf);
|
||||
composeDescription(descriptions[i], i, buf, refEntity);
|
||||
doneListItem(buf);
|
||||
}
|
||||
buf.append("\n</ul>\n</div>");
|
||||
doneList(buf);
|
||||
buf.append("\n</div>");
|
||||
|
||||
appendResolution(buf, refEntity, quickFixTexts(refEntity, myTool));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user