private void copySpecial(final ClipboardContentProviderService clipboardService,
			ClipboardType type, boolean prompt) {
		ClipboardType newType = type;

		List<ClipboardType> availableTypes = clipboardService.getCurrentCopyTypes();
		if (availableTypes == null || availableTypes.isEmpty()) {
			if (prompt) {
				Msg.showError(this, tool.getToolFrame(), "Error",
					"There are no copy formats available");
			}
			else {
				tool.setStatusInfo("There are no copy formats available");
			}
			return;
		}

		if (prompt) {
			final CopyPasteSpecialDialog dialog =
				new CopyPasteSpecialDialog(this, availableTypes, "Copy Special");
			tool.showDialog(dialog, clipboardService.getComponentProvider());
			newType = dialog.getSelectedType();
		}

		if (newType == null) {
			return;
		}

		lastUsedCopySpecialType.put(clipboardService, newType);
		final ClipboardType selectedType = newType;

		Task copyTask = new Task("Copying", true, false, true) {
			@Override
			public void run(TaskMonitor monitor) {
				monitor.setMessage("Setting Clipboard Contents");

				Clipboard systemClipboard = getSystemClipboard();
				Transferable transferable = clipboardService.copySpecial(selectedType, monitor);
				if (transferable != null) {
					setClipboardContents(systemClipboard, transferable);
					clipboardOwnerProvider = clipboardService;
					updatePasteState();
				}
			}
		};

		new TaskLauncher(copyTask, clipboardService.getComponentProvider().getComponent(), 250);
	}
@see java.awt.datatransfer.ClipboardOwner#lostOwnership(java.awt.datatransfer.Clipboard,
     java.awt.datatransfer.Transferable)
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/clipboard/ClipboardPlugin.java