private static @Nullable PsiSwitchLabelStatementBase findLabelStatement(@NotNull ActionContext context, PsiElement element) {
    PsiStatement statement = PsiTreeUtil.getParentOfType(element, PsiStatement.class);
    if (statement instanceof PsiSwitchLabelStatementBase labelStatement) {
      return labelStatement;
    }
    PsiElement previousElement = getPreviousElement(context, element);
    statement = PsiTreeUtil.getParentOfType(previousElement, PsiStatement.class);
    return ObjectUtils.tryCast(statement, PsiSwitchLabelStatementBase.class);
  }
private static @Nullable PsiSwitchLabelStatementBase findLabelStatement(@NotNull ActionContext context, PsiElement element)