static DataTypeInstance getSizedDataType(CompositeEditorProvider<?, ?> provider, DataType dt,
			int defaultSize, int maxSize) throws InvalidDataTypeException {
		if (dt instanceof FactoryDataType) {
			throw new InvalidDataTypeException("Factory data types are not allowed.");
		}
		else if (dt instanceof Dynamic && !((Dynamic) dt).canSpecifyLength()) {
			throw new InvalidDataTypeException("Non-sizable Dynamic data types are not allowed.");
		}

		// A function definition can't be directly applied, only a pointer to the function definition.
		// Convert any function definition to a pointer. Otherwise, keep the original data type.
		boolean isFunctionDef = (dt instanceof FunctionDefinition);
		if (dt instanceof TypeDef) {
			isFunctionDef = (((TypeDef) dt).getBaseDataType() instanceof FunctionDefinition);
		}
		if (isFunctionDef) {
			dt = new PointerDataType(dt, -1, dt.getDataTypeManager());
		}

		int dtLen = dt.getLength();
		if (dtLen == 0) {
			throw new InvalidDataTypeException("Data types of size 0 are not allowed.");
		}
		if ((dtLen < 0) && (dt instanceof Dynamic) && ((Dynamic) dt).canSpecifyLength()) {
			try {
				dtLen = requestDtSize(provider, dt.getDisplayName(), defaultSize, maxSize);
			}
			catch (CancelledException e) {
				return null;
			}
		}
		if (dtLen < 0) {
			throw new InvalidDataTypeException(
				"Data type " + dt.getDisplayName() + " has no size and is not allowed.");
		}
		return DataTypeInstance.getDataTypeInstance(dt, dtLen,
			provider.editorModel.usesAlignedLengthComponents());
	}
Parses a data type that was typed in the composite data type editor.
It creates a DataTypeInstance that consists of the data type and its size.
If there are multiple of the named data type, this method will ask the
user to select the desired data type.
If the data type size can't be determined, then the user is prompted for
the appropriate size.
@param index the component index being edited.
@param dtValue the new data type to parse.
@param editModel the model indicating the composite editor's state.
@param dtManager the data type manager of the composite data type being edited.
@param dtmService the data type manager service to use to determine the
data type the user specified.
@return the data type instance or null if the user canceled when prompted 
for more information.
@throws InvalidDataTypeException if the specified data type isn't valid.
@throws UsrException if the specified data type can't be used at the 
specified index in the composite.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/compositeeditor/DataTypeHelper.java