public void editFiles()

in src/org/jetbrains/tfsIntegration/core/TFSEditFileProvider.java [41:84]


  public void editFiles(final VirtualFile[] files) throws VcsException {
    final Collection<VcsException> errors = new ArrayList<>();
    try {
      Collection<FilePath> orphans =
        WorkstationHelper.processByWorkspaces(TfsFileUtil.getFilePaths(files), false, myProject,
                                              new WorkstationHelper.VoidProcessDelegate() {
          @Override
          public void executeRequest(final WorkspaceInfo workspace, final List<ItemPath> paths) throws TfsException {
            final ResultWithFailures<GetOperation> processResult =
              workspace.getServer().getVCS()
                .checkoutForEdit(workspace.getName(), workspace.getOwnerName(), paths, myProject, TFSBundle.message("checking.out"));
            Collection<VirtualFile> makeWritable = new ArrayList<>();
            for (GetOperation getOperation : processResult.getResult()) {
              TFSVcs.assertTrue(getOperation.getSlocal().equals(getOperation.getTlocal()));
              VirtualFile file = VersionControlPath.getVirtualFile(getOperation.getSlocal());
              if (file != null && file.isValid() && !file.isDirectory()) {
                makeWritable.add(file);
              }
            }
            try {
              TfsFileUtil.setReadOnly(makeWritable, false);
            }
            catch (IOException e) {
              errors.add(new VcsException(e));
            }
            errors.addAll(TfsUtil.getVcsExceptions(processResult.getFailures()));
          }
        });

      if (!orphans.isEmpty()) {
        StringBuilder s = new StringBuilder("Mappings not found for files:\n");
        for (FilePath path : orphans) {
          s.append(path.getPresentableUrl()).append("\n");
        }
        throw new VcsException(s.toString());
      }
    }
    catch (TfsException e) {
      throw new VcsException(e);
    }
    if (!errors.isEmpty()) {
      throw TfsUtil.collectExceptions(errors);
    }
  }