add tree item selection listener
refine the tree item listener so as to remove its related warnings