Choose between Enabled and Disables option from dropdown in selenium webdrivers

I am New to Web-drivers
I want to choose an option between enabled and disabled option from dropdown menu..
For Example..having 2 option as

2.

So the scenario is..
I cannot click on check-out-and-edit option if undo-checkout is visible..
So i want the code sample for this condition such that..
If my undo-checkout is visible then i click on undo-check and then on check-out-Edit option butttttt if my check-out-and-edit is all ready visible then i should continue with my code..