inspection view: should not return OpenFileDescriptor when psiElement is requested (EA-97956)

This commit is contained in:
Dmitry Batkovich
2017-03-13 11:56:54 +03:00
parent 06c80aac63
commit 165e5b5c5e
@@ -967,25 +967,24 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren
if (psiElement == null) return null;
final CommonProblemDescriptor problem = refElementNode.getDescriptor();
if (problem != null) {
if (problem instanceof ProblemDescriptor) {
PsiElement elementFromDescriptor = ((ProblemDescriptor)problem).getPsiElement();
if (elementFromDescriptor == null) {
final InspectionTreeNode node = (InspectionTreeNode)refElementNode.getChildAt(0);
if (node.isValid()) {
return InspectionResultsViewUtil.getNavigatableForInvalidNode((ProblemDescriptionNode)node);
}
} else {
psiElement = elementFromDescriptor;
if (problem instanceof ProblemDescriptor) {
PsiElement elementFromDescriptor = ((ProblemDescriptor)problem).getPsiElement();
if (elementFromDescriptor == null && CommonDataKeys.NAVIGATABLE.is(dataId)) {
final InspectionTreeNode node = (InspectionTreeNode)refElementNode.getChildAt(0);
if (node.isValid()) {
return InspectionResultsViewUtil.getNavigatableForInvalidNode((ProblemDescriptionNode)node);
}
}
else {
psiElement = elementFromDescriptor;
}
}
if (CommonDataKeys.NAVIGATABLE.is(dataId)) {
return getSelectedNavigatable(problem, psiElement);
}
else if (CommonDataKeys.PSI_ELEMENT.is(dataId)) {
return psiElement.isValid() ? psiElement : null;
return psiElement != null && psiElement.isValid() ? psiElement : null;
}
}
else if (selectedNode instanceof ProblemDescriptionNode && CommonDataKeys.NAVIGATABLE.is(dataId)) {