inspection tool window: update nodes when fix action is invoked (IDEA-152226)
[idea/community.git] / platform / lang-impl / src / com / intellij / codeInspection / ex / QuickFixAction.java
index abd82c1a8789814c921c9e6a8bfa57e32a675ee5..1b75f63bcb8359d6cb2f3e5f205fe673e2619dd5 100644 (file)
@@ -46,6 +46,9 @@ import gnu.trove.THashSet;
 import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreeNode;
+import javax.swing.tree.TreePath;
 import java.util.*;
 
 /**
@@ -170,6 +173,15 @@ public class QuickFixAction extends AnAction {
       }, templatePresentationText, null);
 
       refreshViews(project, ignoredElements, myToolWrapper);
+      final InspectionTree tree = context.getView().getTree();
+      final TreePath[] selected = tree.getSelectionPaths();
+      if (selected != null) {
+        for (TreePath path : selected) {
+          path.getLastPathComponent();
+          ((DefaultTreeModel) tree.getModel()).reload((TreeNode)path.getLastPathComponent());
+        }
+      }
+      tree.restoreExpansionAndSelection();
     }
     finally { //to make offline view lazy
       if (initial) refManager.inspectionReadActionStarted();