void (@NotNull Collection<? extends Change> changes, @Nullable String commitMessage) { PropertiesComponent.getInstance(myProject).setValue(VCS_PATCH_TO_CLIPBOARD, myPanel.isToClipboard()); try { Path baseDir = Paths.get(myPanel.getBaseDirName()); boolean isReverse = myPanel.isReversePatch(); String fileName = myPanel.getFileName(); Charset encoding = myPanel.getEncoding(); if (myPanel.isToClipboard()) { writePatchToClipboard(myProject, baseDir, changes, commitMessage, isReverse, true, myPatchBuilder, myCommitContext); } else { validateAndWritePatchToFile(myProject, baseDir, changes, commitMessage, isReverse, Paths.get(fileName), encoding, myPatchBuilder, myCommitContext); } } catch (IOException | VcsException ex) { LOG.info(ex); WaitForProgressToShow.runOrInvokeLaterAboveProgress(() -> { Messages.showErrorDialog(myProject, VcsBundle.message("create.patch.error.title", ex.getMessage()), CommonBundle.getErrorTitle()); }, null, myProject); } }