|| ( oldType == PropertyType.CHOICE_TYPE && newType == PropertyType.CHOICE_TYPE ) )
|| ( oldType == IPropertyType.CHOICE_TYPE && newType == IPropertyType.CHOICE_TYPE ) )
	public void setPropertyDefn( UserPropertyDefn oldPropDefn,			UserPropertyDefn newPropDefn ) throws UserPropertyException,			PropertyValueException	{		assert element != null;		assert oldPropDefn != null;		if ( newPropDefn == null )		{			// need this?			dropUserProperty( oldPropDefn.getName( ) );			return;		}		String propName = oldPropDefn.getName( );		if ( element.getLocalUserPropertyDefn( propName ) == null )			throw new UserPropertyException( element, propName,					UserPropertyException.DESIGN_EXCEPTION_NOT_FOUND );		checkUserPropertyDefn( newPropDefn );		String name = newPropDefn.getName( );		int oldType = oldPropDefn.getType( ).getTypeCode( );		int newType = newPropDefn.getType( ).getTypeCode( );		// Create the command to rename the property. Start a transaction		// using the label of this command.		ActivityStack stack = getActivityStack( );		String label = ModelMessages.getMessage(				MessageConstants.CHANGE_PROPERTY_DEFINITION_MESSAGE,				new String[]{oldPropDefn.getDisplayName( )} );		stack.startTrans( label );		UserPropertyRecord propCmd = new UserPropertyRecord( element,				newPropDefn, true );		stack.execute( propCmd );		// Get the list of elements that extend this one. Add the element		// itself into the list and validate value.		List descendents = element.getDescendents( );		descendents.add( element );		for ( int i = 0; i < descendents.size( ); i++ )		{			DesignElement child = (DesignElement) descendents.get( i );			Object value = child.getLocalProperty( module, propName );			// If the type of the definition is changed, then we will validate			// the old value. Another situation is that the type of the			// definition			// has no change and is "Choice", and then we change the choices for			// it. In this situation, we still validate the old value.			if ( oldType != newType					|| ( oldType == PropertyType.CHOICE_TYPE && newType == PropertyType.CHOICE_TYPE ) )			{				if ( value != null )				{					try					{						value = validateValue( newPropDefn, value.toString( ) );					}					catch ( PropertyValueException ex )					{						stack.rollback( );						throw ex;					}					if ( value != null )					{						PropertyRecord valueCmd = new PropertyRecord( child,								name, value );						stack.execute( valueCmd );					}					// if the name is unchanged, we need not drop the old value.					if ( !name.equals( propName ) )					{						PropertyRecord valueCmd = new PropertyRecord( child,								propName, null );						stack.execute( valueCmd );					}				}			}			// the type is unchanged and name is changed, we will delete the			// the old value and add a new value.			else if ( !name.equals( propName ) )			{				if ( value != null )				{					PropertyRecord valueCmd = new PropertyRecord( child, name,							value );					stack.execute( valueCmd );					valueCmd = new PropertyRecord( child, propName, null );					stack.execute( valueCmd );				}			}		}		if ( !name.equals( propName ) )		{			propCmd = new UserPropertyRecord( element, oldPropDefn, false );			stack.execute( propCmd );		}		stack.commit( );	}