@Override
  public boolean canNavigate() {
    if (!myNavigateToReference) {
      PsiElement element = getPsiElement();
      return element instanceof Navigatable && ((Navigatable)element).canNavigate();
    }
    if (myReferences.isEmpty()) return false;
    PsiReference firstReference = myReferences.get(0);
    PsiElement callElement = firstReference.getElement().getParent();
    if (callElement == null || !callElement.isValid()) return false;
    if (!(callElement instanceof Navigatable) || !((Navigatable)callElement).canNavigate()) {
      PsiFile psiFile = callElement.getContainingFile();
      return psiFile != null;
    }
    return true;
  }
@Override
  public boolean canNavigate()