Collection<VirtualFile> (List<? extends VirtualFile> files, String title, @Nullable String prompt, @Nullable String singleFileTitle, @Nullable String singleFilePromptTemplate, @NotNull VcsShowConfirmationOption confirmationOption) { if (files == null || files.isEmpty()) { return null; } final String okActionName = CommonBundle.getAddButtonText(); final String cancelActionName = CommonBundle.getCancelButtonText(); if (files.size() == 1 && singleFileTitle != null && singleFilePromptTemplate != null) { String filePrompt = format(singleFilePromptTemplate, FileUtil.getLocationRelativeToUserHome(files.get(0).getPresentableUrl())); if (requestForConfirmation(confirmationOption, myProject, filePrompt, singleFileTitle, getQuestionIcon(), okActionName, cancelActionName)) { return new ArrayList<>(files); } return null; } SelectFilesDialog dlg = SelectFilesDialog.init(myProject, files, prompt, confirmationOption, true, false, okActionName, cancelActionName); dlg.setTitle(title); if (dlg.showAndGet()) { final Collection<VirtualFile> selection = dlg.getSelectedFiles(); // return items in the same order as they were passed to us final List<VirtualFile> result = new ArrayList<>(); for (VirtualFile file : files) { if (selection.contains(file)) { result.add(file); } } return result; } return null; }