private void ensureDataTypeComponentRecordExists(Structure struct) {
			DataTypeComponent dtc = composite.getComponent(ordinal);
			if (dtc.getDataType() != DataType.DEFAULT) {
				return; // the record exists 
			}

			// The default type does not have a record for the data type component.  We need to
			// replace that default type with a type that will force a record to be get created.
			// We need a record to exist in order to set a comment or name.
			DataType newtype = new Undefined1DataType();
			DataTypeComponent newDtc =
				struct.replaceAtOffset(dtc.getOffset(), newtype, 1, "tempName",
					"Created by Edit Data Field action");

			DataType oldDt = dtc.getDataType();
			DataType editorDt = dataTypeEditor.getCellEditorValueAsDataType();
			if (oldDt.equals(editorDt)) {
				// If the user has changed the type, we want to keep that change.  Otherwise, the
				// editor should always track what is in the structure so we know if the user has
				// made a change to the data type.  When the user changes the type, we need to apply
				// that change.
				dataTypeEditor.setCellEditorValue(newDtc.getDataType());
			}
		}
Sets the pending new datatype and updates the datatype text field to the name of that
datatype.
@param dataType the new pending datatype
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/data/EditDataFieldDialog.java