From 89c0cd140efd3bacdd66a20e0260b9adb0bb6510 Mon Sep 17 00:00:00 2001 From: Nadya Zabrodina Date: Mon, 26 Jun 2017 20:28:17 +0300 Subject: [PATCH] [vcs]: do not use cached changelist value while editing * IDEA-174855 edit changelist looses changes; * IDEA-133289 Set Active Changelist is not working well; * remove useless checks; --- .../vcs/changes/ui/EditChangelistDialog.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/EditChangelistDialog.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/EditChangelistDialog.java index 2175f5f85df3..353ea00adec2 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/EditChangelistDialog.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/EditChangelistDialog.java @@ -19,6 +19,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.util.Comparing; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vcs.VcsBundle; import com.intellij.openapi.vcs.changes.ChangeListManager; import com.intellij.openapi.vcs.changes.LocalChangeList; @@ -69,20 +70,19 @@ public class EditChangelistDialog extends DialogWrapper { return; } - if (!Comparing.equal(oldName, myPanel.getChangeListName(), true) || !Comparing.equal(oldComment, myPanel.getDescription(), true)) { - final ChangeListManager clManager = ChangeListManager.getInstance(myProject); + final ChangeListManager clManager = ChangeListManager.getInstance(myProject); - final String newName = myPanel.getChangeListName(); - if (! myList.getName().equals(newName)) { - clManager.editName(myList.getName(), newName); - } - final String newDescription = myPanel.getDescription(); - if (! myList.getComment().equals(newDescription)) { - clManager.editComment(myList.getName(), newDescription); - } + final String newDescription = myPanel.getDescription(); + if (!StringUtil.equals(oldComment, newDescription)) { + clManager.editComment(oldName, newDescription); + } + + final String newName = myPanel.getChangeListName(); + if (!StringUtil.equals(oldName, newName)) { + clManager.editName(oldName, newName); } if (!myList.isDefault() && myPanel.getMakeActiveCheckBox().isSelected()) { - ChangeListManager.getInstance(myProject).setDefaultChangeList(myList); + clManager.setDefaultChangeList(newName); } myPanel.changelistCreatedOrChanged(myList); super.doOKAction();