From 502fc37b7e398d9e444d9584166708eaf2beaa95 Mon Sep 17 00:00:00 2001 From: Dmitry Batkovich Date: Fri, 8 Apr 2016 16:48:11 +0300 Subject: [PATCH] inspection tool window: navigate to source fixed for applied fixes in valid ref-entities --- .../ui/InspectionResultsView.java | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java index 4e282a89cceb..3d9eca458109 100644 --- a/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java +++ b/platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java @@ -56,7 +56,10 @@ import com.intellij.openapi.wm.ToolWindowId; import com.intellij.openapi.wm.ToolWindowManager; import com.intellij.pom.Navigatable; import com.intellij.profile.codeInspection.InspectionProjectProfileManager; -import com.intellij.psi.*; +import com.intellij.psi.PsiDirectory; +import com.intellij.psi.PsiDocumentManager; +import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiFile; import com.intellij.psi.util.PsiUtilCore; import com.intellij.ui.*; import com.intellij.ui.components.JBLabel; @@ -798,6 +801,10 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren InspectionTreeNode selectedNode = (InspectionTreeNode)path.getLastPathComponent(); + if (!CommonDataKeys.NAVIGATABLE.is(dataId) && !CommonDataKeys.PSI_ELEMENT.is(dataId)) { + return null; + } + if (selectedNode instanceof RefElementNode) { final RefElementNode refElementNode = (RefElementNode)selectedNode; RefEntity refElement = refElementNode.getElement(); @@ -812,8 +819,15 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren final CommonProblemDescriptor problem = refElementNode.getProblem(); if (problem != null) { if (problem instanceof ProblemDescriptor) { - psiElement = ((ProblemDescriptor)problem).getPsiElement(); - if (psiElement == null) return null; + PsiElement elementFromDescriptor = ((ProblemDescriptor)problem).getPsiElement(); + if (elementFromDescriptor == null) { + final InspectionTreeNode node = (InspectionTreeNode)refElementNode.getChildAt(0); + if (node.isValid()) { + return null; + } + } else { + psiElement = elementFromDescriptor; + } } else { return null;