private static @NotNull Collection<IntentionAction> createClassActions(@NotNull PsiJavaCodeReferenceElement ref) {
    Collection<IntentionAction> result = new ArrayList<>();
    PsiElement refParent = ref.getParent();
    if (refParent != null && refParent.getParent() instanceof PsiDeconstructionPattern) {
      result.add(new CreateClassFromUsageFix(ref, CreateClassKind.RECORD));
      result.add(new CreateInnerClassFromUsageFix(ref, CreateClassKind.RECORD));
    }
    else {
      PsiElement parent = PsiTreeUtil.getParentOfType(ref, PsiNewExpression.class, PsiMethod.class);
      PsiExpressionList expressionList = PsiTreeUtil.getParentOfType(ref, PsiExpressionList.class);

      boolean isNewExpression =
        parent instanceof PsiNewExpression &&
        !(refParent instanceof PsiTypeElement) &&
        (expressionList == null || !PsiTreeUtil.isAncestor(parent, expressionList, false));

      if (isNewExpression) {
        result.add(new CreateClassFromNewFix((PsiNewExpression)parent));
      }
      else {
        result.add(new CreateClassFromUsageFix(ref, CreateClassKind.CLASS));
      }

      result.add(new CreateClassFromUsageFix(ref, CreateClassKind.INTERFACE));
      if (PsiUtil.isAvailable(JavaFeature.ENUMS, ref)) {
        result.add(new CreateClassFromUsageFix(ref, CreateClassKind.ENUM));
      }
      if (PsiUtil.isAvailable(JavaFeature.ANNOTATIONS, ref)) {
        result.add(new CreateClassFromUsageFix(ref, CreateClassKind.ANNOTATION));
      }
      if (PsiUtil.isAvailable(JavaFeature.RECORDS, ref)) {
        if (isNewExpression) {
          result.add(new CreateRecordFromNewFix((PsiNewExpression)parent));
        }
        else {
          result.add(new CreateClassFromUsageFix(ref, CreateClassKind.RECORD));
        }
      }

      if (isNewExpression) {
        result.add(new CreateInnerClassFromNewFix((PsiNewExpression)parent));
        if (PsiUtil.isAvailable(JavaFeature.RECORDS, ref) && ((PsiNewExpression)parent).getQualifier() == null) {
          result.add(new CreateInnerRecordFromNewFix((PsiNewExpression)parent));
        }
      }
      else {
        result.add(new CreateInnerClassFromUsageFix(ref, CreateClassKind.CLASS));
      }
    }
    return result;
  }
private static @NotNull Collection<IntentionAction> createClassActions(@NotNull PsiJavaCodeReferenceElement ref)