public static boolean waitForSwing() {
		if (SwingUtilities.isEventDispatchThread()) {
			throw new AssertException("Can't wait for swing from within the swing thread!");
		}

		Set<AbstractSwingUpdateManager> set = new HashSet<>();
		runSwing(() -> {
			@SuppressWarnings("unchecked")
			WeakSet<SwingUpdateManager> s =
				(WeakSet<SwingUpdateManager>) getInstanceField("instances",
					SwingUpdateManager.class);
			for (AbstractSwingUpdateManager manager : s) {
				set.add(manager);
			}
		});

		/*
		long start = System.nanoTime();
		boolean wasEverBusy = waitForSwing(set, true);
		long end = System.nanoTime();
		Msg.out("\twaitForSwing() - " +
			TimeUnit.MILLISECONDS.convert(end - start, TimeUnit.NANOSECONDS));
		*/

		boolean wasEverBusy = waitForSwing(set, true);
		return wasEverBusy;
	}
Waits for the Swing thread to process any pending events. This method
also waits for any {@link SwingUpdateManager}s that have pending events
to be flushed.

@return true if the any {@link SwingUpdateManager}s were busy.
Ghidra/Framework/Gui/src/main/java/generic/test/AbstractGuiTest.java