void (@NotNull AnActionEvent e) { ArrangementGroupingRulesControl control = e.getData(ArrangementGroupingRulesControl.KEY); if (control == null) { e.getPresentation().setEnabled(false); return; } int[] rows = control.getSelectedRows(); e.getPresentation().setEnabled(rows.length == 1 && rows[0] != control.getRowCount() - 1); }