invoke And Wait If Necessary
Perform the specified action on the event dispatch thread and wait for it to complete. If this is the event dispatch thread, then just perform the action synchronously.
Parameters
action
The action to perform on the event dispatch thread.