From 5d5e35cae6338ff62b53a4e39186041ebd81677e Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Wed, 4 Apr 2018 14:07:29 +0300 Subject: [PATCH] vcs: commit action text should not depend on order of affected vcses * fix case, when one of affected vcses doesn't have a CheckinEnvironment --- .../vcs/changes/ui/CommitChangeListDialog.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java index 7caf73c09b36..e647d68c5d2a 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/CommitChangeListDialog.java @@ -761,17 +761,14 @@ public class CommitChangeListDialog extends DialogWrapper implements CheckinProj @NotNull private static String getCommitActionName(@NotNull Collection affectedVcses) { - String name = null; - for (AbstractVcs vcs : affectedVcses) { + Set names = map2SetNotNull(affectedVcses, vcs -> { CheckinEnvironment checkinEnvironment = vcs.getCheckinEnvironment(); - if (name == null && checkinEnvironment != null) { - name = checkinEnvironment.getCheckinOperationName(); - } - else { - name = VcsBundle.getString("commit.dialog.default.commit.operation.name"); - } + return checkinEnvironment != null ? checkinEnvironment.getCheckinOperationName() : null; + }); + if (names.size() == 1) { + return notNull(ContainerUtil.getFirstItem(names)); } - return name != null ? name : VcsBundle.getString("commit.dialog.default.commit.operation.name"); + return VcsBundle.getString("commit.dialog.default.commit.operation.name"); } private boolean checkComment() {