Navigatable (@NotNull HierarchyNodeDescriptor descriptor) { if (descriptor instanceof Navigatable && descriptor.isValid()) { return (Navigatable)descriptor; } PsiElement element = getElementFromDescriptor(descriptor); if (element instanceof NavigatablePsiElement && element.isValid()) { return (NavigatablePsiElement)element; } return null; }