void () { try { if (!myModel.canPerformCreatePatch()) { showError(message("message.cannot.create.patch.because.of.unavailable.content")); return; } CreatePatchConfigurationPanel p = new CreatePatchConfigurationPanel(myProject); p.setFileName(getDefaultPatchFile()); p.setCommonParentPath(ChangesUtil.findCommonAncestor(myModel.getChanges())); if (!showAsDialog(p)) return; Path base = Paths.get(p.getBaseDirName()); List<FilePatch> patches = IdeaTextPatchBuilder.buildPatch(myProject, myModel.getChanges(), base, p.isReversePatch(), false); if (p.isToClipboard()) { writeAsPatchToClipboard(myProject, patches, base, new CommitContext()); showNotification(message("message.patch.copied.to.clipboard")); } else { Path file = Paths.get(p.getFileName()); PatchWriter.writePatches(myProject, file, base, patches, null, p.getEncoding()); showNotification(message("message.patch.created")); RevealFileAction.openFile(file); } } catch (VcsException | IOException e) { showError(message("message.error.during.create.patch", e)); } }