public static boolean isElseIf(PsiIfStatement ifStatement) {
    PsiElement parent = ifStatement.getParent();
    if (parent instanceof PsiCodeBlock block &&
        block.getStatementCount() == 1 &&
        parent.getParent() instanceof PsiBlockStatement bs) {
      parent = bs.getParent();
    }
    if (!(parent instanceof PsiIfStatement parentStatement)) {
      return false;
    }
    final PsiStatement elseBranch = parentStatement.getElseBranch();
    return ifStatement.equals(elseBranch);
  }
public static boolean isElseIf(PsiIfStatement ifStatement)