public static boolean isEnabled(@NotNull Editor editor) {
    if (!(editor instanceof EditorImpl) || editor.getProject() == null) {
      return false;
    }
    FoldRegion region = editor.getFoldingModel().getCollapsedRegionAtOffset(editor.getCaretModel().getOffset());
    if (region == null) return false;
    return getEditableElement(region) != null;
  }
public static boolean isEnabled(@NotNull Editor editor)