void (@NotNull AnActionEvent e) { CompareBranchesDiffPanel panel = e.getRequiredData(DATA_KEY); Project project = panel.myProject; List<Change> changes = panel.myChangesBrowser.getSelectedChanges(); boolean swapSides = panel.myVcsSettings.shouldSwapSidesInCompareBranches(); CommitCompareInfo compareInfo = panel.myCompareInfo; String title = DvcsBundle.message("compare.branches.diff.panel.get.from.branch.title", panel.myBranchName); ReplaceFileConfirmationDialog confirmationDialog = new ReplaceFileConfirmationDialog(project, title); if (!confirmationDialog.confirmFor(ChangesUtil.getFilesFromChanges(changes))) return; FileDocumentManager.getInstance().saveAllDocuments(); LocalHistoryAction action = LocalHistory.getInstance().startAction(title); new Task.Modal(project, DvcsBundle.message("compare.branches.diff.panel.loading.content.from.branch.process"), false) { @Override public void run(@NotNull ProgressIndicator indicator) { try { if (compareInfo != null) { ((LocalCommitCompareInfo)compareInfo).copyChangesFromBranch(changes, swapSides); } } catch (VcsException err) { ApplicationManager.getApplication().invokeLater(() -> Messages.showErrorDialog(myProject, err.getMessage(), DvcsBundle .message("compare.branches.diff.panel.can.not.copy.changes.error"))); } } @Override public void onFinished() { action.finish(); panel.refreshView(false); } }.queue(); }