popup menu on items of a listview and not if no item selected

1)How to show a popup menu only if an item is selected on the list
view

2) How to have a popu menu for Listview's items and an another popup
menu for the listview?

Regards