private File getFile(GTree gTree, GhidraFileChooser fileChooser,
			DataTypeManager dataTypeManager, AnnotationHandler handler) {

		fileChooser.setTitle("Select File For Export: " + dataTypeManager.getName());
		fileChooser.setSelectedFile(null);

		String defaultExtendsionSuffix = ".h";

		String lastDirSelected = Preferences.getProperty(LAST_DATA_TYPE_EXPORT_DIRECTORY);
		if (lastDirSelected != null) {
			File dir = new File(lastDirSelected);
			if (dir.isDirectory()) {
				fileChooser.setCurrentDirectory(dir);
			}
		}

		fileChooser.rescanCurrentDirectory(); // pick up any recently added archives
		File currentDirectory = fileChooser.getCurrentDirectory();
		File newFile =
			new File(currentDirectory, dataTypeManager.getName() + defaultExtendsionSuffix);
		fileChooser.setSelectedFile(newFile);

		// show the chooser
		File file = fileChooser.getSelectedFile();
		if (file == null) {
			return null;
		}

		boolean hasKnownExtension = false;
		String path = file.getAbsolutePath();

		String[] fileExtensions = handler.getFileExtensions();
		for (String element : fileExtensions) {
			if (path.toLowerCase().endsWith("." + element)) {
				hasKnownExtension = true;
			}
		}

		if (!hasKnownExtension) {
			// no user provided extension and we have a suggested value, so pick the first one
			file = new File(path + defaultExtendsionSuffix);
		}

		if (file.exists()) {
			if (OptionDialog.showYesNoDialog(gTree, "Overwrite Existing File?",
				"Do you want to overwrite the existing file \"" + file.getAbsolutePath() +
					"\"?") == OptionDialog.OPTION_TWO) {
				return null;
			}
		}

		// save the directory off for the next export
		Preferences.setProperty(LAST_DATA_TYPE_EXPORT_DIRECTORY, file.getAbsolutePath());

		return file;
	}
Writes the selection out to a file of the user's choosing.  One file will be written for
each DataTypeManager in the selection.
@param gTree The tree that contains the selected nodes.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/datamgr/actions/ExportToHeaderAction.java