@Override
		public void run(TaskMonitor monitor) {
			try {
				monitor.setMessage("Export to " + file.getName() + "...");
				PrintWriter writer = new PrintWriter(file);
				try {
					DataTypeWriter dataTypeWriter =
						new DataTypeWriter(programDataTypeMgr, writer, handler);
					dataTypeWriter.write(dataTypeList, monitor, false);
				}
				finally {
					writer.close();
				}
				plugin.getTool()
						.setStatusInfo(
							"Successfully exported data type(s) to " + file.getAbsolutePath());
			}
			catch (CancelledException e) {
				// user cancelled; ignore
			}
			catch (IOException e) {
				Msg.showError(getClass(), gTree, "Export Data Types Failed",
					"Error exporting Data Types: " + e);
				return;
			}
		}
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