public void rollbackMissingFileDeletion()

in src/org/jetbrains/tfsIntegration/core/TFSRollbackEnvironment.java [66:169]


  public void rollbackMissingFileDeletion(final List<FilePath> files,
                                          final List<VcsException> errors,
                                          final RollbackProgressListener listener) {
    try {
      WorkstationHelper.processByWorkspaces(files, false, myProject, new WorkstationHelper.VoidProcessDelegate() {
        @Override
        public void executeRequest(final WorkspaceInfo workspace, final List<ItemPath> paths) throws TfsException {
          final List<VersionControlServer.GetRequestParams> download = new ArrayList<>();
          final Collection<String> undo = new ArrayList<>();
          StatusProvider.visitByStatus(workspace, paths, false, null, new StatusVisitor() {

            @Override
            public void unversioned(final @NotNull FilePath localPath,
                                    final boolean localItemExists,
                                    final @NotNull ServerStatus serverStatus) throws TfsException {
              TFSVcs.error("Server returned status Unversioned when rolling back missing file deletion: " + localPath.getPresentableUrl());
            }

            @Override
            public void checkedOutForEdit(final @NotNull FilePath localPath,
                                          final boolean localItemExists,
                                          final @NotNull ServerStatus serverStatus) {
              undo.add(serverStatus.targetItem);
            }

            @Override
            public void scheduledForAddition(final @NotNull FilePath localPath,
                                             final boolean localItemExists,
                                             final @NotNull ServerStatus serverStatus) {
              undo.add(serverStatus.targetItem);
            }

            @Override
            public void scheduledForDeletion(final @NotNull FilePath localPath,
                                             final boolean localItemExists,
                                             final @NotNull ServerStatus serverStatus) {
              TFSVcs.error(
                "Server returned status ScheduledForDeletion when rolling back missing file deletion: " + localPath.getPresentableUrl());
            }

            @Override
            public void outOfDate(final @NotNull FilePath localPath,
                                  final boolean localItemExists,
                                  final @NotNull ServerStatus serverStatus) throws TfsException {
              addForDownload(serverStatus);
            }

            @Override
            public void deleted(final @NotNull FilePath localPath,
                                final boolean localItemExists,
                                final @NotNull ServerStatus serverStatus) {
              TFSVcs.error("Server returned status Deleted when rolling back missing file deletion: " + localPath.getPath());
            }

            @Override
            public void upToDate(final @NotNull FilePath localPath, final boolean localItemExists, final @NotNull ServerStatus serverStatus)
              throws TfsException {
              addForDownload(serverStatus);
            }

            @Override
            public void renamed(final @NotNull FilePath localPath, final boolean localItemExists, final @NotNull ServerStatus serverStatus)
              throws TfsException {
              undo.add(serverStatus.targetItem);
            }

            @Override
            public void renamedCheckedOut(final @NotNull FilePath localPath,
                                          final boolean localItemExists,
                                          final @NotNull ServerStatus serverStatus) throws TfsException {
              undo.add(serverStatus.targetItem);
            }

            @Override
            public void undeleted(final @NotNull FilePath localPath,
                                  final boolean localItemExists,
                                  final @NotNull ServerStatus serverStatus) throws TfsException {
              addForDownload(serverStatus);
            }

            private void addForDownload(final @NotNull ServerStatus serverStatus) {
              download.add(new VersionControlServer.GetRequestParams(serverStatus.targetItem, RecursionType.None,
                                                                     new ChangesetVersionSpec(serverStatus.localVer)));
            }


          }, myProject);

          List<GetOperation> operations = workspace.getServer().getVCS()
            .get(workspace.getName(), workspace.getOwnerName(), download, myProject, TFSBundle.message("preparing.for.download"));
          final Collection<VcsException> downloadErrors =
            ApplyGetOperations.execute(myProject, workspace, operations, ApplyProgress.EMPTY, null, ApplyGetOperations.DownloadMode.FORCE);
          errors.addAll(downloadErrors);

          final UndoPendingChanges.UndoPendingChangesResult undoResult =
            UndoPendingChanges.execute(myProject, workspace, undo, false, new ApplyProgress.RollbackProgressWrapper(listener), false);
          errors.addAll(undoResult.errors);
        }
      });
    }
    catch (TfsException e) {
      errors.add(new VcsException(e.getMessage(), e));
    }
  }