private void updateHistory(File dir, boolean addToHistory) {

		if (!directoryExistsOrIsLogicalDirectory(dir)) {
			return;
		}

		HistoryEntry historyEntry = history.getCurrentHistoryItem();
		if (historyEntry != null) {

			updateHistoryWithSelectedFiles(historyEntry);

			if (historyEntry.isSameDir(dir)) {
				// already recorded in history
				return;
			}
		}

		if (addToHistory) {
			history.add(new HistoryEntry(dir, null));
			updateNavigationButtons();
		}
	}
Displays the WAIT panel. It handles the Swing thread issues.
Ghidra/Framework/Docking/src/main/java/docking/widgets/filechooser/GhidraFileChooser.java