Select tree elements based on selected items