Navigatable (ProblemDescriptionNode node) { RefEntity element = node.getElement(); while (element != null && !element.isValid()) { element = element.getOwner(); } if (!(element instanceof RefElement)) return null; PsiElement containingElement = ((RefElement)element).getPsiElement(); if (!(containingElement instanceof NavigatablePsiElement) || !containingElement.isValid()) return null; final int lineNumber = node.getLineNumber(); if (lineNumber != -1) { final PsiFile containingFile = containingElement.getContainingFile(); if (containingFile != null) { final VirtualFile file = containingFile.getVirtualFile(); final Document document = FileDocumentManager.getInstance().getDocument(file); if (document != null && document.getLineCount() > lineNumber) { return new OpenFileDescriptor(containingElement.getProject(), file, lineNumber, 0); } } } return (Navigatable)containingElement; }