Extracted anySelected() and clearSelection().