private boolean selectFieldNumber(String defaultFieldName) {
		ArrayList<String> allFields = new ArrayList<>();
		String[] choices = buildFieldOptions(allFields);
		if (choices.length < 2) {	// If only one field fits the Varnode
			OkDialog.show("No Field Choices", "Only one field fits the selected variable");
			return false;
		}
		int currentChoice = allFields.indexOf(defaultFieldName);
		if (currentChoice < 0) {
			defaultFieldName = null;
		}
		String userChoice = OptionDialog.showInputChoiceDialog(null,
			"Select Field for " + unionDt.getName(), "Field for " + unionDt.getName() + ": ",
			choices, defaultFieldName, OptionDialog.PLAIN_MESSAGE);
		if (userChoice == null) {
			return false;		// User cancelled when making the choice
		}
		fieldNumber = allFields.indexOf(userChoice);
		if (fieldNumber < 0 || fieldNumber == currentChoice) {
			return false;	// User chose original value or something not in list, treat as cancel
		}
		fieldNumber -= 1;	// Convert choice index to field number
		return 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