private static boolean isCollapseBlock(@NotNull ASTNode node) {
    IElementType type = node.getElementType();
    JavaCodeFoldingSettings settings = JavaCodeFoldingSettings.getInstance();
    if ((type instanceof GrBlockElementType ||
         type == GroovyElementTypes.CONSTRUCTOR_BODY) && node.getTreeParent().getElementType() == GroovyStubElementTypes.METHOD) {
      return settings.isCollapseMethods();
    }

    if (type == GroovyElementTypes.CLOSABLE_BLOCK) {
      return settings.isCollapseAnonymousClasses();
    }

    if (type == GroovyEmptyStubElementTypes.CLASS_BODY) {
      final PsiElement parent = node.getPsi().getParent();
      if (parent instanceof PsiClass) {
        if (parent instanceof PsiAnonymousClass) {
          return settings.isCollapseAnonymousClasses();
        }
        if (((PsiClass)parent).getContainingClass() != null) {
          return settings.isCollapseInnerClasses();
        }
      }
    }

    return false;
  }
private static boolean isCollapseBlock(@NotNull ASTNode node)