@Override
	protected void decompilerActionPerformed(DecompilerActionContext context) {
		Program program = context.getProgram();
		ClangToken tokenAtCursor = context.getTokenAtCursor();
		HighFunction highFunction = context.getHighFunction();
		unionDt = (Union) getCompositeDataType(tokenAtCursor);
		determineFacet(tokenAtCursor);
		if (accessOp == null || accessVn == null) {
			Msg.showError(this, null, "Force Union failed", "Could not recover p-code op");
			return;
		}
		if (!selectFieldNumber(tokenAtCursor.getText())) {
			return;		// User cancelled or no options to choose from
		}
		Function function = highFunction.getFunction();
		DynamicHash dhash = new DynamicHash(accessOp, accessSlot, highFunction);
		pcAddr = dhash.getAddress();
		if (pcAddr == Address.NO_ADDRESS) {
			Msg.showError(this, null, "Force Union failed", "Unable to find a unique hash");
		}
		int transaction = program.startTransaction("Force Union");
		try {
			HighFunctionDBUtil.writeUnionFacet(function, parentDt, fieldNumber, pcAddr,
				dhash.getHash(), SourceType.USER_DEFINED);
		}
		catch (DuplicateNameException e) {
			Msg.showError(this, null, "Force Union failed", e.getMessage());
		}
		catch (InvalidInputException e) {
			Msg.showError(this, null, "Force Union failed", e.getMessage());
		}
		finally {
			program.endTransaction(transaction, true);
		}
	}
Let the user choose the particular field to force on the selected Varnode. The names
of the fields in the associated union are presented, possibly along with the special
string "no field". The choices are filtered so that they match the size of the Varnode
being forced.  Its possible that all names are filtered out except the current field
assigned to the Varnode, in which case a confirmation dialog is brought up instead.
@param defaultFieldName is the default name to use when presenting options to the user
@return the index of the selected field or -1 if "no field" was selected
Ghidra/Features/Decompiler/src/main/java/ghidra/app/plugin/core/decompile/actions/ForceUnionAction.java