@Override
	protected void okCallback() {

		// validate the data type
		DataType dt;
		try {
			if (!editor.validateUserSelection()) {
				// users can only select existing data types
				setStatusText("Unrecognized data type of \"" + editor.getCellEditorValueAsText() +
					"\" entered.");
				return;
			}
			dt = (DataType) editor.getCellEditorValue();
			int dtLen = dt.getLength();
			if (maxSize >= 0 && dtLen > maxSize) {
				setStatusText(dt.getDisplayName() + " doesn't fit within " + maxSize +
					" bytes, need " + dtLen + " bytes");
				return;
			}
		}
		catch (Exception e) {
			setStatusText(e.getMessage());
			return;
		}
		clearStatusText();

		userChoice = dt;
		close();
	}
A dialog that allows the user to choose from available data types or create new ones.
Ghidra/Features/Base/src/main/java/ghidra/app/util/datatype/DataTypeSelectionDialog.java