private void execute()

in src/org/jetbrains/tfsIntegration/core/tfs/operations/ApplyGetOperations.java [110:179]


  private void execute() {
    if (myOperations.isEmpty()) {
      return;
    }

    // parent folders modificating operations should be processed before children to update affected child paths correctly
    List<GetOperation> sortedOperations = new ArrayList<>(myOperations);//GetOperationsUtil.sortGetOperations(myOperations);
    // TODO do we need to sort them or they come in apply order?

    try {
      for (int i = 0; i < sortedOperations.size(); i++) {
        if (myProgress.isCancelled()) {
          throw new ProcessCanceledException();
        }

        GetOperation operationToExecute = sortedOperations.get(i);

        String currentPath = VersionControlPath.localPathFromTfsRepresentation(
          operationToExecute.getTlocal() != null ? operationToExecute.getTlocal() : operationToExecute.getSlocal());
        if (currentPath == null) {
          FilePath unexistingPath = myWorkspace
            .findLocalPathByServerPath(operationToExecute.getTitem(), operationToExecute.getType() == ItemType.Folder, myProject);
          currentPath = unexistingPath.getPresentableUrl();
        }
        myProgress.setFraction(i / sortedOperations.size());
        myProgress.setText(currentPath);

        if (operationToExecute.getCnflct()) {
          // TODO can be confict on undo?
          // conflict will be resolved later
          processConflict(operationToExecute);
        }
        else if (operationToExecute.getSlocal() == null && operationToExecute.getTlocal() == null) {
          updateLocalVersion(operationToExecute);
        }
        else if (operationToExecute.getTlocal() == null) {
          if (operationToExecute.getType() == ItemType.File) {
            processDeleteFile(operationToExecute);
          }
          else {
            processDeleteFolder(operationToExecute);
          }
        }
        else if (operationToExecute.getSlocal() == null) {
          if (operationToExecute.getType() == ItemType.File) {
            processCreateFile(operationToExecute);
          }
          else {
            processCreateFolder(operationToExecute);
          }
        }
        else if (operationToExecute.getType() == ItemType.File) {
          processFileChange(operationToExecute);
        }
        else {
          processFolderChange(operationToExecute);
          if (!operationToExecute.getSlocal().equals(operationToExecute.getTlocal())) {
            GetOperationsUtil.updateSourcePaths(sortedOperations, i, operationToExecute);
          }
        }
      }

      myWorkspace.getServer().getVCS()
        .updateLocalVersions(myWorkspace.getName(), myWorkspace.getOwnerName(), myUpdateLocalVersions, myProject,
                             TFSBundle.message("updating.local.version"));
    }
    catch (TfsException e) {
      myErrors.add(new VcsException(e));
    }
  }