@Nullable
  public static PsiElement getSelectedElement(@NotNull AnActionEvent e) {
    PsiElement element = e.getData(CommonDataKeys.PSI_ELEMENT);
    if (element != null) {
      return element;
    }
    RefEntity[] entities = getSelectedRefElements(e);
    RefEntity refEntity = ContainerUtil.find(entities, entity -> entity instanceof RefElement);
    return refEntity != null ? ((RefElement)refEntity).getPsiElement() : null;
  }
@Nullable
  public static PsiElement getSelectedElement(@NotNull AnActionEvent e)