private void updateTextFieldForFile(File file) {
		if (file == null) {
			return;
		}

		boolean selectText = false;
		if (initialFileToSelect != null) {
			// we want to select the file text if it is the first time the chooser has just been
			// shown and the client has called setSelectedFile().
			selectText = file.equals(initialFileToSelect);
			initialFileToSelect = null;
		}

		if (isUserEditing()) {
			return; // don't disrupt what the user is doing in the text field
		}

		String newText = getFilename(file);
		String currentText = filenameTextField.getText();
		if (newText.equals(currentText)) {
			return; // nothing to do
		}

		if (!file.exists()) {
			// special case!: we will always put non-existent text in the field so that clients
			//                can call setSelectedFile() with suggested files choices (like for
			//                saving data.
			setFilenameFieldText(newText, selectText);
			return;
		}

		if (!isDirectory(file)) {
			if (fileSelectionMode.supportsFiles()) {
				setFilenameFieldText(newText, selectText);
			}
		}
		else {
			if (fileSelectionMode.supportsDirectories()) {
				File parentFile = file.getParentFile();
				if (parentFile == null || parentFile.equals(currentDirectory())) {
					// must be a root dir
					setFilenameFieldText(newText, selectText);
				}
			}
		}
	}
Sets the current directory. Passing in <code>null</code> sets the
file chooser to point to the user's default directory.
This default depends on the operating system. It is
typically the "My Documents" folder on Windows, and the user's
home directory on Unix.
<br>
If the file passed in as <code>currentDirectory</code> is not a
directory, the parent of the file will be used as the currentDirectory.
If the parent is not traversable, then it will walk up the parent tree
until it finds a traversable directory, or hits the root of the
file system.
@param directory the current directory to point to
@see #getCurrentDirectory
Ghidra/Framework/Docking/src/main/java/docking/widgets/filechooser/GhidraFileChooser.java