@Override
      public void keyPressed(KeyEvent e) {
        if (e.getKeyCode() == KeyEvent.VK_DELETE) {
          int newSelectionIndex = -1;
          for (Item o : myList.getSelectedValuesList()) {
            int i = o.index;
            removeContentAt(myAllContents.get(i));
            if (newSelectionIndex < 0) {
              newSelectionIndex = i;
            }
          }

          rebuildListContent();
          if (myAllContents.isEmpty()) {
            close(CANCEL_EXIT_CODE);
            return;
          }
          newSelectionIndex = Math.min(newSelectionIndex, myAllContents.size() - 1);
          myList.setSelectedIndex(newSelectionIndex);
        }
        else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
          doOKAction();
        }
        else if (myUseNumbering) {
          SpeedSearchSupply supply = SpeedSearchSupply.getSupply(myList);
          if (supply != null && supply.isPopupActive()) return;
          char aChar = e.getKeyChar();
          if (aChar >= '0' && aChar <= '9') {
            int idx = aChar == '0' ? 9 : aChar - '1';
            if (idx < myAllContents.size()) {
              myList.setSelectedIndex(idx);
              e.consume();
              doConsume = true;
              // postpone doOKAction in order to handle all other (typed/released) key events
              // otherwise this events get to editor
              ApplicationManager.getApplication().invokeLater(() -> doOKAction());
            }
          }
        }
      }
@Override
      public void keyPressed(KeyEvent e)