diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/classpath/ClasspathPanelImpl.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/classpath/ClasspathPanelImpl.java index fe9bb3a0fea8..f6b4bcbd6f24 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/classpath/ClasspathPanelImpl.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/classpath/ClasspathPanelImpl.java @@ -39,6 +39,7 @@ import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.ProjectStr import com.intellij.openapi.roots.ui.configuration.projectRoot.daemon.SdkProjectStructureElement; import com.intellij.openapi.roots.ui.util.CellAppearance; import com.intellij.openapi.roots.ui.util.OrderEntryCellAppearanceUtils; +import com.intellij.openapi.ui.ComboBoxTableRenderer; import com.intellij.openapi.ui.Messages; import com.intellij.openapi.ui.popup.JBPopup; import com.intellij.openapi.ui.popup.JBPopupFactory; @@ -89,6 +90,13 @@ public class ClasspathPanelImpl extends JPanel implements ClasspathPanel { JComboBox scopeEditor = new JComboBox(new EnumComboBoxModel(DependencyScope.class)); myEntryTable.setDefaultEditor(DependencyScope.class, new DefaultCellEditor(scopeEditor)); + myEntryTable.setDefaultRenderer(DependencyScope.class, new ComboBoxTableRenderer(DependencyScope.values()) { + @Override + protected String getTextFor(@NotNull final DependencyScope value) { + return value.getDisplayName(); + } + }); + myEntryTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); new SpeedSearchBase(myEntryTable) { @@ -187,7 +195,8 @@ public class ClasspathPanelImpl extends JPanel implements ClasspathPanel { } } }; - navigateAction.registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE).getShortcutSet(), myEntryTable); + navigateAction.registerCustomShortcutSet(ActionManager.getInstance().getAction(IdeActions.ACTION_EDIT_SOURCE).getShortcutSet(), + myEntryTable); actionGroup.add(navigateAction); actionGroup.add(new MyFindUsagesAction()); PopupHandler.installPopupHandler(myEntryTable, actionGroup, ActionPlaces.UNKNOWN, ActionManager.getInstance()); diff --git a/platform/platform-api/src/com/intellij/openapi/ui/ComboBoxTableRenderer.java b/platform/platform-api/src/com/intellij/openapi/ui/ComboBoxTableRenderer.java index d974d32e4ade..80dd8ae0387a 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/ComboBoxTableRenderer.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/ComboBoxTableRenderer.java @@ -92,11 +92,11 @@ public class ComboBoxTableRenderer extends JLabel implements TableCellRendere final Rectangle r = getBounds(); final Insets i = getInsets(); - ARROW_ICON.paintIcon(this, g, r.width - i.right - ARROW_ICON.getIconWidth(), i.top); + if (getText() != null && getText().length() != 0) ARROW_ICON.paintIcon(this, g, r.width - i.right - ARROW_ICON.getIconWidth(), i.top); } public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - if (value != null) customizeComponent((T) value, isSelected); + customizeComponent((T) value, isSelected); return this; } @@ -151,7 +151,7 @@ public class ComboBoxTableRenderer extends JLabel implements TableCellRendere protected void customizeComponent(T value, boolean isSelected) { setOpaque(true); - setText(getTextFor(value)); + setText(value == null ? "" : getTextFor(value)); setBackground(isSelected ? UIUtil.getTableSelectionBackground() : UIUtil.getTableBackground()); setForeground(isSelected ? UIUtil.getTableSelectionForeground() : UIUtil.getTableForeground()); }