public static void navigate(final @Nullable PsiElement psiElement, boolean requestFocus) {
    if (psiElement != null && psiElement.isValid()) {
      final PsiElement navigationElement = psiElement.getNavigationElement();
      final int offset = navigationElement instanceof PsiFile ? -1 : navigationElement.getTextOffset();

      VirtualFile virtualFile = PsiUtilCore.getVirtualFile(psiElement);
      Navigatable navigatable;
      if (virtualFile != null && virtualFile.isValid()) {
        navigatable = PsiNavigationSupport.getInstance().createNavigatable(navigationElement.getProject(), virtualFile, offset);
      }
      else if (navigationElement instanceof Navigatable) {
        navigatable = (Navigatable)navigationElement;
      }
      else {
        return;
      }
      navigatable.navigate(requestFocus);
    }
  }
public static void navigate(final @Nullable PsiElement psiElement, boolean requestFocus)