|| getTypeCode( ) == PropertyType.ELEMENT_REF_TYPE || getTypeCode( ) == PropertyType.STRUCT_TYPE )
|| getTypeCode( ) == IPropertyType.ELEMENT_REF_TYPE || getTypeCode( ) == IPropertyType.STRUCT_TYPE )
	public void checkUserPropertyDefn( Module module, DesignElement element )			throws UserPropertyException, MetaDataException	{		// Does the element allow user properties?		String name = getName( );		if ( !element.getDefn( ).allowsUserProperties( ) )			throw new UserPropertyException( element, name,					UserPropertyException.DESIGN_EXCEPTION_USER_PROP_DISALLOWED );		// Validate the name.		if ( StringUtil.isBlank( name ) )			throw new UserPropertyException( element, name,					UserPropertyException.DESIGN_EXCEPTION_NAME_REQUIRED );		if ( element.getPropertyDefn( name ) != null )			throw new UserPropertyException( element, name,					UserPropertyException.DESIGN_EXCEPTION_DUPLICATE_NAME );		// Validate the property type is provided and not structure or element		// reference.		MetaDataDictionary dd = MetaDataDictionary.getInstance( );		if ( dd.getPropertyType( getTypeCode( ) ) == null				|| getTypeCode( ) == PropertyType.ELEMENT_REF_TYPE				|| getTypeCode( ) == PropertyType.STRUCT_TYPE )			throw new UserPropertyException( element, name,					UserPropertyException.DESIGN_EXCEPTION_INVALID_TYPE );		// TODO: Check the display name or id.		// Ensure choices exist if this is a choice typeCode.		if ( getTypeCode( ) == PropertyType.CHOICE_TYPE )		{			IChoiceSet choices = getChoices( );			if ( choices == null || choices.getChoices( ).length == 0 )				throw new UserPropertyException( element, name,						UserPropertyException.DESIGN_EXCEPTION_MISSING_CHOICES );		}		// if the user-defined property has choices and its type is not		// "choice", validate the value of the user choice according to the		// type.		if ( hasChoices( ) )		{			IChoiceSet choiceSet = getChoices( );			IChoice[] choices = choiceSet.getChoices( );			for ( int i = 0; i < choices.length; i++ )			{				UserChoice choice = (UserChoice) choices[i];				Object value = choice.getValue( );				if ( StringUtil.isBlank( choice.getName( ) ) )				{					throw new UserPropertyException(							element,							name,							UserPropertyException.DESIGN_EXCEPTION_CHOICE_NAME_REQUIRED );				}				if ( value == null )					throw new UserPropertyException(							element,							name,							UserPropertyException.DESIGN_EXCEPTION_CHOICE_VALUE_REQUIRED );				if ( getTypeCode( ) != PropertyType.CHOICE_TYPE )				{					try					{						value = validateValue( module, value );					}					catch ( PropertyValueException e )					{						throw new UserPropertyException(								element,								name,								UserPropertyException.DESIGN_EXCEPTION_INVALID_CHOICE_VALUE );					}				}			}		}		// Build the cached semantic data.		this.build( );	}