private boolean checkValidBaseDataType() {
		DropDownSelectionTextField<DataType> textField = dtChoiceEditor.getDropDownTextField();
		String dtName = textField.getText().trim();
		boolean isValid = true;
		try {
			if (dtName.length() == 0 || !dtChoiceEditor.validateUserSelection()) {
				setStatus("Valid bitfield base datatype entry required");
				isValid = false;
			}
		}
		catch (InvalidDataTypeException e) {
			setStatus("Invalid bitfield base datatype: " + e.getMessage());
			isValid = false;
		}
		if (isValid) {
			DataType dt = dtChoiceEditor.getCellEditorValueAsDataType();
			if (!dataTypeValidator.apply(baseDataType)) {
				setStatus("Valid bitfield base datatype entry required");
				isValid = false;
			}
			else {
				baseDataType = dt.clone(composite.getDataTypeManager());
				clearStatus();
			}
		}
		else {
			dataTypeValidator.apply(null); // affects button enablement
		}
		return isValid;
	}
<code>BitFieldEditorPanel</code> provides the ability to add or modify bitfields
within non-packed structures.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/BitFieldEditorPanel.java