private static int[] getCaretOffsets(CaretModel caretModel) {
    int[] caretOffsets = new int[caretModel.getCaretCount()];
    int i = 0;
    for (Caret caret : caretModel.getAllCarets()) {
      caretOffsets[i++] = caret.getOffset();
    }
    return caretOffsets;
  }
private static int[] getCaretOffsets(CaretModel caretModel)