@Override
	public void actionPerformed(ActionEvent e) {

		List<PatternInfoRowObject> selected = clipboardPanel.getLastSelectedObjects();
		if (selected.isEmpty()) {
			return;
		}
		//scan through all of them: must be at least one pre-pattern and 
		//at least one post-pattern
		boolean containsPostPattern = false;
		boolean containsPrePattern = false;
		for (PatternInfoRowObject row : selected) {
			if (row.getPatternType().equals(PatternType.FIRST)) {
				containsPostPattern = true;
			}
			if (row.getPatternType().equals(PatternType.PRE)) {
				containsPrePattern = true;
			}
		}
		if (!containsPostPattern) {
			Msg.showWarn(this, component, "No Post Pattern",
				"Selected patterns must contain at least one post pattern");
			return;
		}
		if (!containsPrePattern) {
			Msg.showWarn(this, component, "No Pre Pattern",
				"Selected patterns must contain at least one pre pattern");
			return;
		}

		boolean proceed = checkConsistencyForExport(selected);
		if (!proceed) {
			return;
		}
		GhidraFileChooser gFileChooser = new GhidraFileChooser(component);
		gFileChooser.setFileSelectionMode(GhidraFileChooserMode.FILES_ONLY);
		ExtensionFileFilter xmlFilter = new ExtensionFileFilter("xml", "XML Files");
		gFileChooser.setFileFilter(xmlFilter);
		String baseDir = Preferences.getProperty(XML_EXPORT_DIR_PROPERTY);
		if (baseDir != null) {
			File dir = new File(baseDir);
			if (dir.isDirectory()) {
				gFileChooser.setCurrentDirectory(dir);
			}
		}
		gFileChooser.setTitle("Select Export File");
		File outFile = gFileChooser.getSelectedFile();
		String lastDirPath = gFileChooser.getCurrentDirectory().getAbsolutePath();
		gFileChooser.dispose();
		if (gFileChooser.wasCancelled() || outFile == null) {
			return;
		}

		Preferences.setProperty(XML_EXPORT_DIR_PROPERTY, lastDirPath);
		Preferences.store();
		BitsInputDialogComponentProvider bitsProvider =
			new BitsInputDialogComponentProvider(BITS_PROVIDER_MESSAGE);
		if (bitsProvider.isCanceled()) {
			return;
		}
		int totalBits = bitsProvider.getTotalBits();
		int postBits = bitsProvider.getPostBits();
		try {
			PatternInfoRowObject.exportXMLFile(selected, outFile, postBits, totalBits);
		}
		catch (IOException e1) {
			Msg.showError(this, component, "IO Error", "IO error exporting pattern xml file", e1);
		}
	}
Create a new {@code ExportPatternFileActionListener} for a given {@link ClipboardPanel} with
parent {@link Component}
@param clipboardPanel the clipboard panel
@param comp the parent component
Ghidra/Features/BytePatterns/src/main/java/ghidra/bitpatterns/gui/ExportPatternFileActionListener.java