void (@NotNull AnActionEvent e) { Project project = e.getData(CommonDataKeys.PROJECT); Change[] changes = e.getData(VcsDataKeys.CHANGES); JBIterable<FilePath> unversioned = JBIterable.from(e.getData(ChangesListView.UNVERSIONED_FILE_PATHS_DATA_KEY)); List<Change> allChanges = new ArrayList<>(); if (changes != null) ContainerUtil.addAll(allChanges, changes); ContainerUtil.addAll(allChanges, unversioned.map(path -> new Change(null, new CurrentContentRevision(path)))); if (allChanges.isEmpty()) return; String commitMessage = extractCommitMessage(e); project = project == null ? ProjectManager.getInstance().getDefaultProject() : project; PatchBuilder patchBuilder; ShelvedChangeList shelvedChangeList = ContainerUtil.getOnlyItem(ShelvedChangesViewManager.getShelvedLists(e.getDataContext())); if (shelvedChangeList != null) { boolean entireList = ContainerUtil.getOnlyItem(ShelvedChangesViewManager.getExactlySelectedLists(e.getDataContext())) != null; List<String> selectedPaths = entireList ? ContainerUtil.emptyList() : ShelvedChangesViewManager.getSelectedShelvedChangeNames(e.getDataContext()); patchBuilder = new CreatePatchCommitExecutor.ShelfPatchBuilder(project, shelvedChangeList, selectedPaths); } else { patchBuilder = new CreatePatchCommitExecutor.DefaultPatchBuilder(project); } createPatch(project, commitMessage, allChanges, mySilentClipboard, patchBuilder); }