public static void collapse(@NotNull final Editor editor, @NotNull final String placeholder) {
    final FoldingModel foldingModel = editor.getFoldingModel();
    foldingModel.runBatchFoldingOperation(() -> {
      for (FoldRegion region : foldingModel.getAllFoldRegions()) {
        foldingModel.removeFoldRegion(region);
      }
      FoldRegion region = foldingModel.addFoldRegion(0, editor.getDocument().getTextLength(), placeholder);
      if (region != null) {
        region.setExpanded(false);
      }
    });
  }
public static void collapse(@NotNull final Editor editor, @NotNull final String placeholder)