private static @Nullable AbstractFilePatchInProgress<?> createPatchInProgress(@NotNull FilePatch patch, @NotNull VirtualFile dir) {
    if (patch instanceof TextFilePatch) {
      return new TextFilePatchInProgress((TextFilePatch)patch, null, dir);
    }
    if (patch instanceof ShelvedBinaryFilePatch) {
      return new ShelvedBinaryFilePatchInProgress((ShelvedBinaryFilePatch)patch, null, dir);
    }
    if (patch instanceof BinaryFilePatch) {
      return new BinaryFilePatchInProgress((BinaryFilePatch)patch, null, dir);
    }
    return null;
  }
private static @Nullable AbstractFilePatchInProgress<?> createPatchInProgress(@NotNull FilePatch patch, @NotNull VirtualFile dir)