private void exportToC(GTree gTree, DataTypeManager programDataTypeMgr) {

		List<Class<? extends AnnotationHandler>> classes =
			ClassSearcher.getClasses(AnnotationHandler.class);

		List<AnnotationHandler> list = new ArrayList<>();
		Class<?>[] constructorArgumentTypes = {};
		for (Class<? extends AnnotationHandler> clazz : classes) {

			if (clazz == DefaultAnnotationHandler.class) {
				continue;
			}

			try {
				Constructor<?> constructor = clazz.getConstructor(constructorArgumentTypes);
				Object obj = constructor.newInstance();
				list.add(AnnotationHandler.class.cast(obj));
			}
			catch (Exception e) {
				Msg.showError(this, plugin.getTool().getToolFrame(), "Export Data Types",
					"Error creating " + clazz.getName() + "\n" + e.toString(), e);
			}
		}

		AnnotationHandler handler = null;
		if (!list.isEmpty()) {
			list.add(0, new DefaultAnnotationHandler());
			AnnotationHandlerDialog dlg = new AnnotationHandlerDialog(list);
			plugin.getTool().showDialog(dlg);
			if (!dlg.wasSuccessful()) {
				return;
			}
			handler = dlg.getHandler();
		}
		else {
			handler = new DefaultAnnotationHandler();
		}

		TreePath[] paths = gTree.getSelectionPaths();
		Map<DataTypeManager, List<DataType>> managersToDataTypesMap = new HashMap<>();

		for (TreePath path : paths) {
			addToManager(path, managersToDataTypesMap);
		}

		GhidraFileChooser fileChooser = new GhidraFileChooser(gTree);

		// filter the files if we can
		String[] fileExtensions = handler.getFileExtensions();
		if (fileExtensions.length > 0) {
			fileChooser.setFileFilter(
				new ExtensionFileFilter(fileExtensions, handler.getLanguageName() + " Files"));
		}

		Set<Entry<DataTypeManager, List<DataType>>> entrySet = managersToDataTypesMap.entrySet();
		for (Entry<DataTypeManager, List<DataType>> entry : entrySet) {
			DataTypeManager dataTypeManager = entry.getKey();
			File file = getFile(gTree, fileChooser, dataTypeManager, handler);
			if (file == null) {
				return; // user cancelled
			}

			List<DataType> dataTypeList = entry.getValue();
			new TaskLauncher(
				new DataTypeWriterTask(gTree, programDataTypeMgr, dataTypeList, handler, file),
				gTree);
		}

		fileChooser.dispose();
	}
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