boolean (@NotNull Project project, @NotNull Path file) { if (Files.exists(file)) { int[] result = new int[1]; WaitForProgressToShow.runOrInvokeAndWaitAboveProgress(() -> { result[0] = Messages.showYesNoDialog(project, VcsBundle.message("patch.apply.already.exists.overwrite.prompt", file.getFileName().toString(), file.getParent()), VcsBundle.message("patch.creation.save.patch.file.title"), CommonBundle.message("button.overwrite"), CommonBundle.message("button.cancel"), Messages.getWarningIcon()); }); if (Messages.NO == result[0]) { return false; } } if (file.getParent() == null) { WaitForProgressToShow.runOrInvokeLaterAboveProgress(() -> { Messages.showErrorDialog(project, VcsBundle .message("create.patch.error.title", VcsBundle.message("patch.creation.can.not.write.patch.error", file.toString())), CommonBundle.getErrorTitle()); }, ModalityState.nonModal(), project); return false; } return true; }