model.setWidth( String.valueOf( width ) + DesignChoiceConstants.UNITS_PX ); model.setHeight( String.valueOf( height ) + DesignChoiceConstants.UNITS_PX );
DimensionValue dimensionValue = new DimensionValue( width, DesignChoiceConstants.UNITS_PX ); model.getWidth( ).setValue( dimensionValue ); dimensionValue = new DimensionValue( height, DesignChoiceConstants.UNITS_PX ); model.getHeight( ).setValue( dimensionValue );
	public void execute( )	{		CommandStack stack = SessionHandleAdapter.getInstance( )				.getCommandStack( );		// start trans		stack.startTrans( TRANS_LABEL_SET_CONSTRAINT ); //$NON-NLS-1$		try		{			if ( DesignerConstants.TRACING_COMMANDS )			{				System.out.println( "SetConstraintCommand >>  Starts. Target: " //$NON-NLS-1$						+ DEUtil.getDisplayLabel( model )						+ ",New size: " //$NON-NLS-1$						+ newSize.width						+ "," //$NON-NLS-1$						+ newSize.height );			}			if ( model instanceof TableHandle || model instanceof GridHandle )			{				HandleAdapterFactory.getInstance( )						.getTableHandleAdapter( model )						.ajustSize( newSize );			}			else if ( model instanceof ImageHandle )			{				int width = newSize.width;				int height = newSize.height;				if ( width <= 0 )				{					width = 1;				}				if ( height <= 0 )				{					height = 1;				}				model.setWidth( String.valueOf( width )						+ DesignChoiceConstants.UNITS_PX );				model.setHeight( String.valueOf( height )						+ DesignChoiceConstants.UNITS_PX );			}			else			{				double width = MetricUtility.pixelToPixelInch( newSize.width );				double height = MetricUtility.pixelToPixelInch( newSize.height );				if ( width <= 0 )				{					width = 0.1;				}				if ( height <= 0 )				{					height = 0.1;				}				model.setWidth( String.valueOf( width )						+ DesignChoiceConstants.UNITS_IN );				model.setHeight( String.valueOf( height )						+ DesignChoiceConstants.UNITS_IN );			}			stack.commit( );			if ( DesignerConstants.TRACING_COMMANDS )			{				System.out.println( "SetConstraintCommand >> Finised." ); //$NON-NLS-1$			}		}		catch ( SemanticException e )		{			if ( DesignerConstants.TRACING_COMMANDS )			{				System.out.println( "SetConstraintCommand >> Failed." ); //$NON-NLS-1$			}			e.printStackTrace( );			stack.rollback( );		}	}