@Override
		public void run(TaskMonitor monitor) throws CancelledException {

			exporter = getSelectedExporter();

			exporter.setExporterServiceProvider(tool);

			boolean exportDomainFile =
				!domainObjectWasSupplied && exporter.canExportDomainFile(domainFile);
			if (!exportDomainFile && domainFile == null) {
				return;
			}

			// Program selection only relavent if isFrontEndPlugin() is false
			ProgramSelection selection = getApplicableProgramSelection();
			File outputFile = getSelectedOutputFile();

			try {
				if (outputFile.exists() &&
					OptionDialog.showOptionDialog(getComponent(), "Overwrite Existing File?",
						"The file " + outputFile + " already exists.\nDo you want to overwrite it?",
						"Overwrite", OptionDialog.QUESTION_MESSAGE) != OptionDialog.OPTION_ONE) {
					return;
				}
				if (options != null) {
					exporter.setOptions(options);
				}

				if (!domainObjectWasSupplied && exporter.canExportDomainFile(domainFile)) {
					success = exporter.export(outputFile, domainFile, monitor);
				}
				else {
					success = exporter.export(outputFile, domainObject, selection, monitor);
				}
				showResults = true;
			}
			catch (Exception e) {
				Msg.error(this, "Exception exporting", e);
				SystemUtilities.runSwingLater(() -> setStatusText(
					"Exception exporting: " + e.getMessage() + ".  If null, see log for details."));
			}
		}
Gets the address factory for the program to be exported, opening it if necessary.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/exporter/ExporterDialog.java