List<FilePatch> () { List<String> failedMessages = new ArrayList<>(); List<FilePatch> failedPatches = new ArrayList<>(); for (FilePatch patch : myPatches) { CheckPath checker = getChecker(patch); if (!checker.check()) { ContainerUtil.addIfNotNull(failedMessages, checker.getErrorMessage()); failedPatches.add(checker.getPatch()); } } if (!failedMessages.isEmpty()) { PatchApplier.showError(myProject, StringUtil.join(failedMessages, "\n")); } myPatches.removeAll(failedPatches); return failedPatches; }