public void handleKeyAction(@NotNull KeyEvent event,
                              @NotNull List<? extends ListPluginComponent> selection) {
    if (selection.isEmpty()) {
      return;
    }

    // If the focus is not on a ListPluginComponent, the focused component will handle the event.
    Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
    if (event.getKeyCode() == KeyEvent.VK_SPACE && !(focusOwner instanceof ListPluginComponent)) {
      return;
    }

    if (myOnlyUpdateMode) {
      if (event.getKeyCode() == KeyEvent.VK_SPACE) {
        for (ListPluginComponent component : selection) {
          component.myChooseUpdateButton.doClick();
        }
      }
      return;
    }

    for (ListPluginComponent component : selection) {
      if (MyPluginModel.isInstallingOrUpdate(component.myPlugin) || component.myAfterUpdate) {
        return;
      }
    }

    boolean restart = true;
    for (ListPluginComponent component : selection) {
      if (component.myRestartButton == null) {
        restart = false;
        break;
      }
    }

    boolean getDescriptorFunction = true;

    int keyCode = event.getKeyCode();
    if (myMarketplace) {
      if (keyCode == KeyEvent.VK_ENTER) {
        if (restart) {
          selection.get(0).myRestartButton.doClick();
        }

        int installCount = 0;
        int installedCount = 0;

        for (ListPluginComponent component : selection) {
          JButton button = component.myInstallButton;
          if (button != null && button.isVisible() && button.isEnabled()) {
            installCount++;
          }
          else if (component.myInstalledDescriptorForMarketplace != null) {
            installedCount++;
          }
          else {
            return;
          }
        }
        int size = selection.size();
        if (installCount == size) {
          for (ListPluginComponent component : selection) {
            component.myInstallButton.doClick();
          }
          return;
        }
        if (installedCount != size) {
          return;
        }
        getDescriptorFunction = false;
      }
      else if (keyCode == KeyEvent.VK_SPACE || keyCode == EventHandler.DELETE_CODE) {
        int installedCount = 0;
        for (ListPluginComponent component : selection) {
          if (component.myInstalledDescriptorForMarketplace != null) {
            installedCount++;
          }
          else {
            return;
          }
        }
        if (installedCount != selection.size()) {
          return;
        }
        getDescriptorFunction = false;
      }
      else {
        return;
      }
    }

    boolean update = true;
    for (ListPluginComponent component : selection) {
      JButton button = component.myUpdateButton;
      if (button == null || !button.isVisible() || !button.isEnabled()) {
        update = false;
        break;
      }
    }

    if (keyCode == KeyEvent.VK_ENTER) {
      if (restart) {
        selection.get(0).myRestartButton.doClick();
      }
      else if (update) {
        for (ListPluginComponent component : selection) {
          component.myUpdateButton.doClick();
        }
      }
    }
    else if (!restart && !update) {
      Function<ListPluginComponent, IdeaPluginDescriptor> function =
        getDescriptorFunction ? ListPluginComponent::getPluginDescriptor : ListPluginComponent::getInstalledDescriptorForMarketplace;

      DumbAwareAction action;

      if (keyCode == KeyEvent.VK_SPACE && event.getModifiersEx() == 0) {
        action = createEnableDisableAction(getEnableDisableAction(selection), selection, function);
      }
      else if (keyCode == EventHandler.DELETE_CODE) {
        action = createUninstallAction(selection, function);
      }
      else {
        return;
      }

      ActionManager.getInstance().tryToExecute(action, event, this, ActionPlaces.UNKNOWN, true);
    }
  }
public void handleKeyAction(@NotNull KeyEvent event,
                              @NotNull List<? extends ListPluginComponent> selection)