void (AnActionButton button) { final int selectedRow = myRendererChooser.getSelectedElementRow(); if (selectedRow < 0) { return; } int newRow = selectedRow + (myMoveUp ? -1 : 1); if (newRow < 0) { newRow = myRendererChooser.getElementCount() - 1; } else if (newRow >= myRendererChooser.getElementCount()) { newRow = 0; } myRendererChooser.moveElement(myRendererChooser.getElementAt(selectedRow), newRow); }