inspection toolwindow: presentation detection fixed for html importing IDEA-157020
authorDmitry Batkovich <dmitry.batkovich@jetbrains.com>
Mon, 6 Jun 2016 12:21:05 +0000 (15:21 +0300)
committerDmitry Batkovich <dmitry.batkovich@jetbrains.com>
Mon, 6 Jun 2016 12:21:05 +0000 (15:21 +0300)
platform/lang-impl/src/com/intellij/codeInspection/export/InspectionTreeHtmlWriter.java
platform/lang-impl/src/com/intellij/codeInspection/ui/ProblemDescriptionNode.java
platform/lang-impl/src/com/intellij/codeInspection/ui/RefElementAndDescriptorAware.java
platform/lang-impl/src/com/intellij/codeInspection/ui/SuppressableInspectionTreeNode.java

index 213ec7b9cd817828b0355c09a3c3d4b3cf4d9aff..9af084f202de8abf8394fa267896d5b027923f60 100644 (file)
@@ -20,7 +20,6 @@ import com.intellij.codeInsight.daemon.HighlightDisplayKey;
 import com.intellij.codeInspection.CommonProblemDescriptor;
 import com.intellij.codeInspection.InspectionProfile;
 import com.intellij.codeInspection.ProblemDescriptorBase;
-import com.intellij.codeInspection.ex.HTMLComposerImpl;
 import com.intellij.codeInspection.ex.InspectionToolWrapper;
 import com.intellij.codeInspection.reference.RefEntity;
 import com.intellij.codeInspection.reference.RefManager;
@@ -73,7 +72,6 @@ public class InspectionTreeHtmlWriter {
   private void serializeTreeToHtml() {
     appendHeader();
     appendTree((builder) -> {
-      final HTMLComposerImpl[] exporter = new HTMLComposerImpl[] {null};
       final InspectionTreeTailRenderer tailRenderer = new InspectionTreeTailRenderer(myTree.getContext()) {
         @Override
         protected void appendText(String text, SimpleTextAttributes attributes) {
@@ -99,22 +97,17 @@ public class InspectionTreeHtmlWriter {
                                if (n instanceof InspectionRootNode) {
                                  builder.append("checked");
                                }
-                               if (n instanceof InspectionNode) {
-                                 exporter[0] = myTree.getContext().getPresentation(((InspectionNode)n).getToolWrapper()).getComposer();
-                               }
                                builder.append(" onclick=\"navigate(").append(nodeId).append(")\" ");
                                builder.append(" id=\"").append(nodeId).append("\" />");
                                if (n instanceof RefElementAndDescriptorAware) {
                                  RefEntity e = ((RefElementAndDescriptorAware)n).getElement();
                                  if (e != null) {
-                                   if (exporter[0] != null) {
-                                     builder
-                                       .append("<div id=\"d")
-                                       .append(nodeId)
-                                       .append("\" style=\"display:none\">");
-                                     exporter[0].compose(builder, e);
-                                     builder.append("</div>");
-                                   }
+                                   builder
+                                     .append("<div id=\"d")
+                                     .append(nodeId)
+                                     .append("\" style=\"display:none\">");
+                                   ((RefElementAndDescriptorAware)n).getPresentation().getComposer().compose(builder, e);
+                                   builder.append("</div>");
                                  }
                                }
                                builder.append("<ol class=\"tree\">");
index d7a43cfc47a9626bbec4b27cd1e195645867194a..5797524aaa6e351d2ad63258bddee5cc8a539445 100644 (file)
@@ -139,8 +139,9 @@ public class ProblemDescriptionNode extends SuppressableInspectionTreeNode {
     super.amnestyElement(manager);
   }
 
+  @Override
   @NotNull
-  private InspectionToolPresentation getPresentation() {
+  public InspectionToolPresentation getPresentation() {
     return myPresentation;
   }
 
index d46732cfb1ccc5bf342bd2611e3da3b1b787af90..d6a317b27580f7f1bfd5f368b18a1f05c68a56b1 100644 (file)
@@ -17,6 +17,7 @@ package com.intellij.codeInspection.ui;
 
 import com.intellij.codeInspection.CommonProblemDescriptor;
 import com.intellij.codeInspection.reference.RefEntity;
+import org.jetbrains.annotations.NotNull;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -28,4 +29,7 @@ public interface RefElementAndDescriptorAware {
 
   @Nullable
   CommonProblemDescriptor getDescriptor();
+
+  @NotNull
+  InspectionToolPresentation getPresentation();
 }
index fd7cdad70989bcae746375680889aa458eef620d..720620696f42c417a29e92070467a965b283145c 100644 (file)
@@ -47,6 +47,11 @@ public abstract class SuppressableInspectionTreeNode extends CachedInspectionTre
     myPresentation = presentation;
   }
 
+  @NotNull
+  public InspectionToolPresentation getPresentation() {
+    return myPresentation;
+  }
+
   public boolean canSuppress() {
     return isLeaf();
   }