EA-72906 - NPE: PopupListElementRenderer.customizeComponent
authorDmitry Avdeev <Dmitry.Avdeev@jetbrains.com>
Thu, 10 Sep 2015 12:10:23 +0000 (15:10 +0300)
committerDmitry Avdeev <Dmitry.Avdeev@jetbrains.com>
Thu, 10 Sep 2015 12:15:58 +0000 (15:15 +0300)
platform/platform-impl/src/com/intellij/ui/popup/list/PopupListElementRenderer.java

index 50b462875bc9dfc2dd44aea595ff59d0a6c58a32..51e73e85b0ab2045836dc0702491136caed522dc 100644 (file)
@@ -91,10 +91,7 @@ public class PopupListElementRenderer extends GroupedItemsListRenderer {
     if (!isSelected && step instanceof BaseListPopupStep) {
       Color bg = ((BaseListPopupStep)step).getBackgroundFor(value);
       Color fg = ((BaseListPopupStep)step).getForegroundFor(value);
-      if (fg != null) {
-        myTextLabel.setForeground(fg);
-        myShortcutLabel.setForeground(fg);
-      }
+      if (fg != null) myTextLabel.setForeground(fg);
       if (bg != null) UIUtil.setBackgroundRecursively(myComponent, bg);
     }
 
@@ -123,19 +120,22 @@ public class PopupListElementRenderer extends GroupedItemsListRenderer {
       //myNextStepLabel.setIcon(PopupIcons.EMPTY_ICON);
     }
 
-    myShortcutLabel.setText("");
-    if (value instanceof ShortcutProvider) {
-      ShortcutSet set = ((ShortcutProvider)value).getShortcut();
-      if (set != null) {
-        Shortcut shortcut = ArrayUtil.getFirstElement(set.getShortcuts());
-        if (shortcut != null) {
-          myShortcutLabel.setText("     " + KeymapUtil.getShortcutText(shortcut));
+    setSelected(myNextStepLabel, isSelected);
+
+
+    if (myShortcutLabel != null) {
+      myShortcutLabel.setText("");
+      if (value instanceof ShortcutProvider) {
+        ShortcutSet set = ((ShortcutProvider)value).getShortcut();
+        if (set != null) {
+          Shortcut shortcut = ArrayUtil.getFirstElement(set.getShortcuts());
+          if (shortcut != null) {
+            myShortcutLabel.setText("     " + KeymapUtil.getShortcutText(shortcut));
+          }
         }
       }
+      setSelected(myShortcutLabel, isSelected);
+      //    myShortcutLabel.setForeground(isSelected ? UIManager.getColor("MenuItem.acceleratorSelectionForeground") : UIManager.getColor("MenuItem.acceleratorForeground"));
     }
-
-    setSelected(myNextStepLabel, isSelected);
-    setSelected(myShortcutLabel, isSelected);
-//    myShortcutLabel.setForeground(isSelected ? UIManager.getColor("MenuItem.acceleratorSelectionForeground") : UIManager.getColor("MenuItem.acceleratorForeground"));
   }
 }