private static TextPainter initTextPainter(@NotNull final DocumentEx doc, final @NotNull Project project,
                                             final @NotNull String fileName) {
    final TextPainter[] res = new TextPainter[1];
    ApplicationManager.getApplication().runReadAction(
      () -> {
        res[0] = doInitTextPainter(doc, project, fileName);
      }
    );
    return res[0];
  }
private static TextPainter initTextPainter(@NotNull final DocumentEx doc, final @NotNull Project project,
                                             final @NotNull String fileName)