private void applyEnum(ListingActionContext context) {
		ApplyEnumDialog dialog = applyEnumDialog(context);
		DataType dataType = dialog.getUserChosenDataType();
		if (dataType == null) {
			return;
		}

		if (!(dataType instanceof Enum)) {
			Msg.showError(this, null, "Input Error", "Data Type must be an enum");
			return;
		}

		AddressSetView addresses = context.getSelection();
		if (addresses.isEmpty()) {
			addresses = new AddressSet(context.getAddress());
		}
		boolean shouldDoOnSubOps = dialog.shouldApplyOnSubOps();
		Program program = context.getProgram();
		CreateEnumEquateCommand cmd =
			new CreateEnumEquateCommand(addresses, (Enum) dataType, shouldDoOnSubOps);
		tool.executeBackgroundCommand(cmd, program);

		dialog.dispose();
	}
Called in response to the user selecting the Apply Enum action from the popup menu. This
action will apply enum values to scalars in a selection.
@param context the action context
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/equate/EquatePlugin.java