private static void doRun(Runnable r, boolean wait, String errorMessage) {
		if (isInHeadlessMode()) {
			r.run();
			return;
		}

		if (!wait) {
			SwingUtilities.invokeLater(r);
			return;
		}

		if (SwingUtilities.isEventDispatchThread()) {
			r.run();
			return;
		}

		try {
			SwingUtilities.invokeAndWait(r);
		}
		catch (InterruptedException e) {
			// we sometimes interrupt our tasks intentionally, so don't report it
		}
		catch (InvocationTargetException e) {
			Msg.error(Swing.class, errorMessage + "\nException Message: " + e.getMessage(), e);
		}
	}
Calls the given runnable on the Swing thread

<p>This method will throw an exception if the Swing thread is not available within the
given timeout.  This method is useful for preventing deadlocks.

@param r the runnable
@param timeout the timeout value
@param unit the time unit of the timeout value
@throws UnableToSwingException if the timeout was reach waiting for the Swing thread 
@see #runNow(Supplier) if you need to return a value from the Swing thread.
Ghidra/Framework/Utility/src/main/java/ghidra/util/Swing.java