IDEA-251030 Icons are not shown in Database toolwindow popup menu
[idea/community.git] / java / idea-ui / src / com / intellij / openapi / roots / ui / configuration / classpath / ClasspathPanelImpl.java
index a8c8f0de563162e059c0e901763b025fb7272793..8a32af9466bd6309c4790d38514ea925ccf80162 100644 (file)
@@ -107,14 +107,14 @@ public class ClasspathPanelImpl extends JPanel implements ClasspathPanel {
     myEntryTable.setDefaultRenderer(ClasspathTableItem.class, new TableItemRenderer(getStructureConfigurableContext()));
     myEntryTable.setDefaultRenderer(Boolean.class, new ExportFlagRenderer(myEntryTable.getDefaultRenderer(Boolean.class)));
 
-    JComboBox scopeEditor = new ComboBox<>(new EnumComboBoxModel<>(DependencyScope.class));
+    JComboBox<DependencyScope> scopeEditor = new ComboBox<>(new EnumComboBoxModel<>(DependencyScope.class));
     myEntryTable.setDefaultEditor(DependencyScope.class, new DefaultCellEditor(scopeEditor));
-    myEntryTable.setDefaultRenderer(DependencyScope.class, new ComboBoxTableRenderer<DependencyScope>(DependencyScope.values()) {
-        @Override
-        protected String getTextFor(@NotNull final DependencyScope value) {
-          return value.getDisplayName();
-        }
-      });
+    myEntryTable.setDefaultRenderer(DependencyScope.class, new ComboBoxTableRenderer<>(DependencyScope.values()) {
+      @Override
+      protected String getTextFor(@NotNull final DependencyScope value) {
+        return value.getDisplayName();
+      }
+    });
 
     myEntryTable.setTransferHandler(new TransferHandler() {
       @Nullable
@@ -135,7 +135,7 @@ public class ClasspathPanelImpl extends JPanel implements ClasspathPanel {
 
     myEntryTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
 
-    new SpeedSearchBase<JBTable>(myEntryTable) {
+    new SpeedSearchBase<>(myEntryTable) {
       @Override
       public int getSelectedIndex() {
         return myEntryTable.getSelectedRow();
@@ -346,11 +346,6 @@ public class ClasspathPanelImpl extends JPanel implements ClasspathPanel {
       }
     };
 
-    //addButton.setShortcut(CustomShortcutSet.fromString("alt A", "INSERT"));
-    //removeButton.setShortcut(CustomShortcutSet.fromString("alt DELETE"));
-    //upButton.setShortcut(CustomShortcutSet.fromString("alt UP"));
-    //downButton.setShortcut(CustomShortcutSet.fromString("alt DOWN"));
-
     final ToolbarDecorator decorator = ToolbarDecorator.createDecorator(myEntryTable);
     AnActionButtonUpdater moveUpDownUpdater = e -> {
       for (RowSorter.SortKey key : myEntryTable.getRowSorter().getSortKeys()) {
@@ -365,7 +360,7 @@ public class ClasspathPanelImpl extends JPanel implements ClasspathPanel {
       public void run(AnActionButton button) {
         initPopupActions();
         final JBPopup popup = JBPopupFactory.getInstance().createListPopup(
-          new BaseListPopupStep<AddItemPopupAction<?>>(null, myPopupActions) {
+          new BaseListPopupStep<>(null, myPopupActions) {
             @Override
             public Icon getIconFor(AddItemPopupAction<?> aValue) {
               return aValue.getIcon();
@@ -395,7 +390,9 @@ public class ClasspathPanelImpl extends JPanel implements ClasspathPanel {
               return "&" + value.getIndex() + "  " + value.getTitle();
             }
           });
-        popup.show(button.getPreferredPopupPoint());
+        final RelativePoint point = button.getPreferredPopupPoint();
+        if (point == null) return;
+        popup.show(point);
       }
     })
       .setRemoveAction(new AnActionButtonRunnable() {
@@ -456,7 +453,7 @@ public class ClasspathPanelImpl extends JPanel implements ClasspathPanel {
     ModuleStructureConfigurable.getInstance(myState.getProject()).getTree().repaint();
   }
 
-  private void removeSelectedItems(final List removedRows) {
+  private void removeSelectedItems(final List<Object[]> removedRows) {
     if (removedRows.isEmpty()) {
       return;
     }