final Composite textFieldComposite = new Composite( composite, SWT.NONE );
textFieldComposite.setLayoutData( gdwhint( gd(), 60 ) );
textFieldComposite.setLayout( glspacing( glayout( 2, 0, 0 ), 2 ) );
final PropertyEditorAssistDecorator decorator = createDecorator( textFieldComposite );
decorator.control().setLayoutData( gdvalign( gd(), SWT.TOP ) );
this.textField = new Text( textFieldComposite, SWT.BORDER );
this.textField.setLayoutData( gdhfill() );
this.textField.addModifyListener
(
new ModifyListener()
{
public void modifyText( final ModifyEvent event )
{
setPropertyValue( ScalePropertyEditorPresentation.this.textField.getText() );
}
}
);
final TextOverlayPainter.Controller textOverlayPainterController = new TextOverlayPainter.Controller()
{
@Override
public String overlay()
{
return property().getDefaultText();
}
};
TextOverlayPainter.install( this.textField, textOverlayPainterController );
this.scale = new Scale( composite, SWT.HORIZONTAL );
this.scale.setLayoutData( gdhfill() );
this.scale.setMinimum( this.minimum );
this.scale.setMaximum( this.maximum );
this.scale.setIncrement( 1 );
this.scale.setPageIncrement( 1 );
this.scale.addSelectionListener
(
new SelectionAdapter()
{
@Override
public void widgetSelected( final SelectionEvent event )
{
final int value = ScalePropertyEditorPresentation.this.scale.getSelection() - ScalePropertyEditorPresentation.this.offset;
setPropertyValue( String.valueOf( value ) );
}
}
);
decorator.addEditorControl( composite );
addControl( this.textField );
addControl( this.scale );
}