private static @Nullable FileContent getFileContent(@NotNull VirtualFile file, @Nullable Project project, boolean withBinary) {
    if (withBinary && file.getFileType().isBinary()) {
      try {
        return FileContentImpl.createByFile(file, project);
      }
      catch (IOException e) {
        return null;
      }
    }
    else {
      Document document = FileDocumentManager.getInstance().getCachedDocument(file);
      CharSequence s = document != null ? document.getCharsSequence() : LoadTextUtil.loadText(file, -1);
      return FileContentImpl.createByText(file, s, project);
    }
  }
private static @Nullable FileContent getFileContent(@NotNull VirtualFile file, @Nullable Project project, boolean withBinary)