private Collection<VirtualFile> promptAboutAddition( SvnVcs vcs, List<VirtualFile> addedVFiles, VcsShowConfirmationOption.Value value, AbstractVcsHelper vcsHelper) { Collection<VirtualFile> filesToProcess; if (value == VcsShowConfirmationOption.Value.DO_ACTION_SILENTLY) { filesToProcess = addedVFiles; } else { final String singleFilePrompt; if (addedVFiles.size() == 1 && addedVFiles.get(0).isDirectory()) { singleFilePrompt = SvnBundle.getString("confirmation.text.add.dir"); } else { singleFilePrompt = SvnBundle.getString("confirmation.text.add.file"); } filesToProcess = vcsHelper.selectFilesToProcess( addedVFiles, SvnBundle.message("confirmation.title.add.multiple.files"), null, SvnBundle.message("confirmation.title.add.file"), singleFilePrompt, vcs.getAddConfirmation()); } return filesToProcess; }
@Override public <S> List<S> filterUniqueRoots( final List<S> in, final Convertor<S, VirtualFile> convertor) { if (in.size() <= 1) return in; final List<MyPair<S>> infos = new ArrayList<MyPair<S>>(in.size()); final SvnFileUrlMappingImpl mapping = (SvnFileUrlMappingImpl) getSvnFileUrlMapping(); final List<S> notMatched = new LinkedList<S>(); for (S s : in) { final VirtualFile vf = convertor.convert(s); if (vf == null) continue; final File ioFile = new File(vf.getPath()); SVNURL url = mapping.getUrlForFile(ioFile); if (url == null) { url = SvnUtil.getUrl(this, ioFile); if (url == null) { notMatched.add(s); continue; } } infos.add(new MyPair<S>(vf, url.toString(), s)); } final List<MyPair<S>> filtered = new ArrayList<MyPair<S>>(infos.size()); ForNestedRootChecker.filterOutSuperfluousChildren(this, infos, filtered); final List<S> converted = ObjectsConvertor.convert( filtered, new Convertor<MyPair<S>, S>() { @Override public S convert(final MyPair<S> o) { return o.getSrc(); } }); if (!notMatched.isEmpty()) { // potential bug is here: order is not kept. but seems it only occurs for cases where result // is sorted after filtering so ok converted.addAll(notMatched); } return converted; }