Wait for the user to select an item from a popup


hi, I created a popup like so:

.createListPopup(PopUpMenu("Select a pod to impersonate", pods))
.show(RelativePoint.fromScreen(Point(600, 200)));

but I want to wait for the user to select the item.. how do I do that? Tried what was mentioned here https://plugins.jetbrains.com/docs/intellij/general-threading-rules.html?from=jetbrains.org#read-write-lock but that didnt really solve my problem? Maybe I used the lock wrong? I'd appreciate any ideas! Thanks