private static boolean isAvailable(@NotNull ActionContext context, @NotNull PsiClass aClass) {
    if (!PsiUtil.isAvailable(JavaFeature.SEALED_CLASSES, aClass)) return false;
    int offset = context.offset();
    PsiElement lBrace = aClass.getLBrace();
    if (lBrace == null) return false;
    if (offset >= lBrace.getTextRange().getStartOffset()) return false;
    if (aClass.hasModifierProperty(PsiModifier.SEALED)) return false;
    if (aClass.isAnnotationType()) return false;
    if (aClass.getPermitsList() != null) return false;
    if (aClass.getModifierList() == null) return false;
    if (aClass.hasModifierProperty(PsiModifier.FINAL)) return false;
    if (PsiUtil.isLocalOrAnonymousClass(aClass)) return false;
    if (!(aClass.getContainingFile() instanceof PsiJavaFile)) return false;
    return !aClass.hasAnnotation(CommonClassNames.JAVA_LANG_FUNCTIONAL_INTERFACE);
  }
private static boolean isAvailable(@NotNull ActionContext context, @NotNull PsiClass aClass)