Get rid of toolbar popup blinking (popup appears with empty text)
authorVassiliy.Kudryashov <Vassiliy.Kudryashov@jetbrains.com>
Wed, 3 Dec 2014 12:58:30 +0000 (15:58 +0300)
committerVassiliy.Kudryashov <Vassiliy.Kudryashov@jetbrains.com>
Wed, 3 Dec 2014 12:59:52 +0000 (15:59 +0300)
platform/platform-api/src/com/intellij/openapi/actionSystem/ex/CheckboxAction.java

index 3e52f26d0b87f2e22e78254f9479f6f30b790d2a..0347ee2b5c468a8bf6ca6a9c5103f5a7eb415188 100644 (file)
@@ -58,7 +58,7 @@ public abstract class CheckboxAction extends ToggleAction implements CustomCompo
                                                               ActionManager.getInstance(), 0));
       }
     });
-
+    updateCustomComponent(checkBox, presentation);
     return checkBox;
   }
 
@@ -70,14 +70,17 @@ public abstract class CheckboxAction extends ToggleAction implements CustomCompo
     if (property instanceof JCheckBox) {
       JCheckBox checkBox = (JCheckBox)property;
 
-      checkBox.setText(presentation.getText());
-      checkBox.setToolTipText(presentation.getDescription());
-      checkBox.setMnemonic(presentation.getMnemonic());
-      checkBox.setDisplayedMnemonicIndex(presentation.getDisplayedMnemonicIndex());
-      checkBox.setSelected(Boolean.TRUE.equals(presentation.getClientProperty(SELECTED_PROPERTY)));
-
-      checkBox.setEnabled(presentation.isEnabled());
-      checkBox.setVisible(presentation.isVisible());
+      updateCustomComponent(checkBox, presentation);
     }
   }
+
+  protected void updateCustomComponent(JCheckBox checkBox, Presentation presentation) {
+    checkBox.setText(presentation.getText());
+    checkBox.setToolTipText(presentation.getDescription());
+    checkBox.setMnemonic(presentation.getMnemonic());
+    checkBox.setDisplayedMnemonicIndex(presentation.getDisplayedMnemonicIndex());
+    checkBox.setSelected(Boolean.TRUE.equals(presentation.getClientProperty(SELECTED_PROPERTY)));
+    checkBox.setEnabled(presentation.isEnabled());
+    checkBox.setVisible(presentation.isVisible());
+  }
 }