protected Control createContents( Composite parent )
{
IValue value = getValue( getElement() );
Composite composite = BaseWidgetUtils.createColumnContainer( parent, 1, 1 );
Composite mainGroup = BaseWidgetUtils.createColumnContainer( composite, 2, 1 );
BaseWidgetUtils.createLabel( mainGroup, "Attribute Description:", 1 );
descriptionText = BaseWidgetUtils.createLabeledText( mainGroup, "", 1 );
BaseWidgetUtils.createLabel( mainGroup, "Value Type:", 1 );
typeText = BaseWidgetUtils.createLabeledText( mainGroup, "", 1 );
BaseWidgetUtils.createLabel( mainGroup, "Value Size:", 1 );
sizeText = BaseWidgetUtils.createLabeledText( mainGroup, "", 1 );
BaseWidgetUtils.createLabel( mainGroup, "Data:", 1 );
if ( value != null && value.isString() )
{
valueText = new Text( mainGroup, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY );
valueText.setFont( JFaceResources.getFont( JFaceResources.TEXT_FONT ) );
GridData gd = new GridData( GridData.FILL_BOTH );
gd.widthHint = convertHorizontalDLUsToPixels( ( int ) ( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 2 ) );
gd.heightHint = convertHorizontalDLUsToPixels( IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH / 4 );
valueText.setLayoutData( gd );
valueText.setBackground( parent.getBackground() );
}
else
{
valueText = BaseWidgetUtils.createLabeledText( mainGroup, "", 1 );
}
if ( value != null )
{
super.setMessage( "Value " + Utils.shorten( value.toString(), 30 ) );
descriptionText.setText( value.getAttribute().getDescription() );
// valueText.setText(LdifUtils.mustEncode(value.getBinaryValue())?"Binary":value.getStringValue());
valueText.setText( value.isString() ? value.getStringValue() : "Binary" );
typeText.setText( value.isString() ? "String" : "Binary" );
int bytes = value.getBinaryValue().length;
int chars = value.isString() ? value.getStringValue().length() : 0;
String size = value.isString() ? chars + ( chars > 1 ? " Characters, " : " Character, " ) : "";
size += Utils.formatBytes( bytes );
sizeText.setText( size );
}
return parent;