private void helperForRemove(@NotNull ConsoleCommunication.ConsoleCodeFragment command) {
    var removedPanel = myQueueElementPanelMap.remove(command);

    if (removedPanel != null) {
      myPanel.remove(removedPanel.getQueuePanel());
    }

    if (!myQueueElementPanelMap.isEmpty()) {
      var firstCommand = myService.getFirstCommand(communication);
      if (firstCommand != null) {
        QueueElementPanel elementPanel = myQueueElementPanelMap.get(firstCommand);
        if (elementPanel != null) {
          elementPanel.setIcon(new AnimatedIcon.Default());
          elementPanel.unsetCancelButton();

          if (selectedCommand == removedPanel) {
            commandSelected(elementPanel);
          }
        }
      }
    }
    else {
      setTextToEditor("");
      selectedCommand = null;
    }
  }
private void helperForRemove(@NotNull ConsoleCommunication.ConsoleCodeFragment command)