private void waitForModalTask() {

		if (!task.isModal()) {
			return; // we do not wait for non-modal tasks
		}

		try {
			// fun note: if this is the Swing thread, then it will not wait, as the Swing thread
			// was blocked by the modal dialog in the call before this one
			finished.await();
		}
		catch (InterruptedException e) {
			Msg.debug(this, "Task Launcher unexpectedly interrupted waiting for task thread", e);
		}
	}
Helper class to launch the given task in a background thread, showing a task dialog if
this task takes to long. See {@link TaskLauncher}.
Ghidra/Framework/Docking/src/main/java/ghidra/util/task/TaskRunner.java