@Override
  public void actionPerformed(@NotNull AnActionEvent e) {
    final ArrangementMatchingRulesControl control = getRulesControl(e);
    if (control == null) {
      return;
    }

    final int editing = control.getEditingRow() - 1;

    control.runOperationIgnoreSelectionChange(() -> {
      control.hideEditor();
      final List<int[]> mappings = new ArrayList<>();
      fillMappings(control, mappings);

      if (mappings.isEmpty()) {
        return;
      }

      int newRowToEdit = editing;
      ArrangementMatchingRulesModel model = control.getModel();
      Object value;
      int from;
      int to;
      for (int[] pair : mappings) {
        from = pair[0];
        to = pair[1];
        if (from != to) {
          value = model.getElementAt(from);
          model.removeRow(from);
          model.insert(to, value);
          if (newRowToEdit == from) {
            newRowToEdit = to;
          }
        }
      }

      ListSelectionModel selectionModel = control.getSelectionModel();
      for (int[] pair : mappings) {
        selectionModel.addSelectionInterval(pair[1], pair[1]);
      }


      int visibleRow = -1;
      if (newRowToEdit >= 0) {
        control.showEditor(newRowToEdit);
        visibleRow = newRowToEdit;
      }
      else if (!mappings.isEmpty()) {
        visibleRow = mappings.get(0)[1];
      }

      if (visibleRow != -1) {
        scrollRowToVisible(control, visibleRow);
      }
    });
    control.repaintRows(0, control.getModel().getSize() - 1, true);

  }
@Override
  public void actionPerformed(@NotNull AnActionEvent e)