DeleteRemoteBranchDecision (@NotNull List<String> branchNames, @NotNull Collection<@NlsSafe String> trackingBranches, @NotNull Collection<GitRepository> repositories) { boolean deleteMultipleBranches = branchNames.size() > 1; String title = GitBundle.message("branch.ui.handler.delete.remote.branches", branchNames.size()); String remoteBranches = deleteMultipleBranches ? StringUtil.join(branchNames, ", ") : branchNames.iterator().next(); String message = GitBundle.message("branch.ui.handler.delete.remote.branches.question", branchNames.size(), remoteBranches); String deleteButtonText = deleteMultipleBranches ? GitBundle.message("branch.ui.handler.delete.all") : message("button.delete"); if (trackingBranches.isEmpty()) { return YES == DialogManager .showOkCancelDialog(myProject, message, title, deleteButtonText, getCancelButtonText(), getQuestionIcon()) ? DELETE : CANCEL; } String forBranch = GitBundle.message("branch.ui.handler.delete.tracking.local.branch.as.well", trackingBranches.iterator().next()); String forBranches = new HtmlBuilder().append(GitBundle.message("branch.ui.handler.delete.tracking.local.branches")).br() .appendWithSeparators(HtmlChunk.raw(", " + HtmlChunk.br()), ContainerUtil.map(trackingBranches, it -> HtmlChunk.text(it))) .wrapWith(HtmlChunk.html()).toString(); String checkboxMessage = trackingBranches.size() == 1 ? forBranch : forBranches; Ref<Boolean> deleteChoice = Ref.create(false); boolean delete = MessageDialogBuilder.yesNo(title, message).yesText(deleteButtonText).noText(getCancelButtonText()) .doNotAsk(new DoNotAskOption.Adapter() { @Override public void rememberChoice(boolean isSelected, int exitCode) { deleteChoice.set(isSelected); } @Override public @NotNull String getDoNotShowMessage() { return checkboxMessage; } }) .ask(myProject); boolean deleteTracking = deleteChoice.get(); return delete ? deleteTracking ? DeleteRemoteBranchDecision.DELETE_WITH_TRACKING : DELETE : CANCEL; }