WEB-17222 File watcher is shown with a new name only after re-open Settings appcode/142.3250 clion/142.3243 dbe/142.3241 idea/142.3247 phpstorm/142.3249 pycharm/142.3244 rubymine/142.3248 webstorm/142.3240
authorSergey Simonchik <sergey.simonchik@jetbrains.com>
Tue, 14 Jul 2015 22:06:31 +0000 (01:06 +0300)
committerSergey Simonchik <sergey.simonchik@jetbrains.com>
Tue, 14 Jul 2015 22:06:31 +0000 (01:06 +0300)
platform/platform-api/src/com/intellij/ui/CheckBoxList.java
platform/platform-impl/src/com/intellij/util/ui/CheckBoxListModelEditor.java

index 2df4a3d6f8125a28c0a4f9f03de441e6a51e73e7..bdfa4049b3936836eccaeb55705b35272b2a6171 100644 (file)
@@ -109,9 +109,15 @@ public class CheckBoxList<T> extends JBList {
     ((DefaultListModel) getModel()).addElement(checkBox);
   }
 
-  public void updateItem(@NotNull T oldItem, @NotNull T newItem) {
+  public void updateItem(@NotNull T oldItem, @NotNull T newItem, @NotNull String newText) {
     JCheckBox checkBox = myItemMap.remove(oldItem);
     myItemMap.put(newItem, checkBox);
+    checkBox.setText(newText);
+    DefaultListModel model = (DefaultListModel)getModel();
+    int ind = model.indexOf(checkBox);
+    if (ind >= 0) {
+      model.set(ind, checkBox); // to fire contentsChanged event
+    }
   }
 
   @Nullable
index a1a2b647b34377d17f324153283cc502f69d6d23..8ed38dca15d038593acd5210ba4de77e236d24c9 100644 (file)
@@ -18,6 +18,7 @@ package com.intellij.util.ui;
 import com.intellij.ide.IdeBundle;
 import com.intellij.openapi.actionSystem.AnActionEvent;
 import com.intellij.openapi.util.Pair;
+import com.intellij.openapi.util.text.StringUtil;
 import com.intellij.ui.AnActionButton;
 import com.intellij.ui.AnActionButtonRunnable;
 import com.intellij.ui.CheckBoxList;
@@ -56,9 +57,8 @@ public class CheckBoxListModelEditor<T> {
         if (item != null) {
           T newItem = consumer.fun(item);
           if (newItem != null) {
-            list.updateItem(item, newItem);
+            list.updateItem(item, newItem, StringUtil.notNullize(toNameConverter.fun(newItem)));
           }
-          list.repaint();
           list.requestFocus();
         }
       }