private void processDeletedFiles(Project project) { final List<Pair<FilePath, WorkingCopyFormat>> deletedFiles = new ArrayList<Pair<FilePath, WorkingCopyFormat>>(); final Collection<FilePath> filesToProcess = new ArrayList<FilePath>(); List<VcsException> exceptions = new ArrayList<VcsException>(); final AbstractVcsHelper vcsHelper = AbstractVcsHelper.getInstance(project); try { fillDeletedFiles(project, deletedFiles, filesToProcess); if (deletedFiles.isEmpty() && filesToProcess.isEmpty() || myUndoingMove) return; SvnVcs vcs = SvnVcs.getInstance(project); final VcsShowConfirmationOption.Value value = vcs.getDeleteConfirmation().getValue(); if (value != VcsShowConfirmationOption.Value.DO_NOTHING_SILENTLY) { if (!deletedFiles.isEmpty()) { final Collection<FilePath> confirmed = promptAboutDeletion(deletedFiles, vcs, value, vcsHelper); if (confirmed != null) { filesToProcess.addAll(confirmed); } } if (filesToProcess != null && !filesToProcess.isEmpty()) { runInBackground( project, "Deleting files from Subversion", createDeleteRunnable(project, vcs, filesToProcess, exceptions)); } final List<FilePath> deletedFilesFiles = ObjectsConvertor.convert( deletedFiles, new Convertor<Pair<FilePath, WorkingCopyFormat>, FilePath>() { @Override public FilePath convert(Pair<FilePath, WorkingCopyFormat> o) { return o.getFirst(); } }); for (FilePath file : deletedFilesFiles) { final FilePath parent = file.getParentPath(); if (parent != null) { myFilesToRefresh.add(parent.getVirtualFile()); } } if (filesToProcess != null) { deletedFilesFiles.removeAll(filesToProcess); } for (FilePath file : deletedFilesFiles) { FileUtil.delete(file.getIOFile()); } } } catch (SVNException e) { exceptions.add(new VcsException(e)); } if (!exceptions.isEmpty()) { vcsHelper.showErrors(exceptions, SvnBundle.message("delete.files.errors.title")); } }
void commandFinished(final Project project) { checkOverwrites(project); if (myAddedFiles.containsKey(project)) { processAddedFiles(project); } processMovedFiles(project); if (myDeletedFiles.containsKey(project)) { processDeletedFiles(project); } final List<VcsException> exceptionList = myMoveExceptions.get(project); if (exceptionList != null && !exceptionList.isEmpty()) { AbstractVcsHelper.getInstance(project) .showErrors(exceptionList, SvnBundle.message("move.files.errors.title")); } if (!myFilesToRefresh.isEmpty()) { refreshFiles(project); } }
private void processAddedFiles(Project project) { SvnVcs vcs = SvnVcs.getInstance(project); List<VirtualFile> addedVFiles = new ArrayList<VirtualFile>(); Map<VirtualFile, File> copyFromMap = new HashMap<VirtualFile, File>(); final Set<VirtualFile> recursiveItems = new HashSet<VirtualFile>(); fillAddedFiles(project, vcs, addedVFiles, copyFromMap, recursiveItems); if (addedVFiles.isEmpty()) return; final VcsShowConfirmationOption.Value value = vcs.getAddConfirmation().getValue(); if (value != VcsShowConfirmationOption.Value.DO_NOTHING_SILENTLY) { final AbstractVcsHelper vcsHelper = AbstractVcsHelper.getInstance(project); final Collection<VirtualFile> filesToProcess = promptAboutAddition(vcs, addedVFiles, value, vcsHelper); if (filesToProcess != null && !filesToProcess.isEmpty()) { final List<VcsException> exceptions = new ArrayList<VcsException>(); runInBackground( project, "Adding files to Subversion", createAdditionRunnable(project, vcs, copyFromMap, filesToProcess, exceptions)); if (!exceptions.isEmpty()) { vcsHelper.showErrors(exceptions, SvnBundle.message("add.files.errors.title")); } } } }