fix #10933 - keep the same selection in selection dialog after cliking the "select" button + code refactoring/cleanup