}
protected final Composite createMainComposite( final Composite parent,
final CreateMainCompositeDelegate delegate )
{
final PropertyEditorPart part = part();
final boolean showLabel = delegate.getShowLabel();
final int leftMargin = delegate.getLeftMargin();
final boolean spanBothColumns = delegate.getSpanBothColumns();
final boolean singleLinePresentation = isSingleLine();
final List<FormComponentPart> relatedContentParts = part.getRelatedContent();
final int count = relatedContentParts.size();
if( showLabel )
{
final Label label = new Label( parent, SWT.NONE );
register( label );
final Runnable updateLabelOp = new Runnable()
{
public void run()
{
label.setText( delegate.getLabel( CapitalizationType.FIRST_WORD_ONLY, true ) + ":" );
}
};
attachPartListener
(
new FilteredListener<LabelChangedEvent>()
{
@Override
protected void handleTypedEvent( final LabelChangedEvent event )
{
updateLabelOp.run();
layout();
}
}
);
updateLabelOp.run();
label.setLayoutData( gdhindent( gdhspan( gdvalign( gd(), singleLinePresentation ? SWT.CENTER : SWT.TOP ), spanBothColumns ? 2 : 1 ), leftMargin + 9 ) );
addControl( label );
}
else if( ! spanBothColumns )
{
final Label spacer = new Label( parent, SWT.NONE );
spacer.setLayoutData( gd() );
spacer.setText( MiscUtil.EMPTY_STRING );
register( spacer );
}
GridData gd;
if( delegate.canScaleVertically() )
{
final boolean scaleVertically = part.getScaleVertically();
gd = gdhhint( ( scaleVertically ? gdfill() : gdhfill() ), part.getHeight( 150 ) );
}
else
{
gd = gdhfill();
}
if( spanBothColumns )
{
gd = gdhindent( gdhspan( gd, 2 ), leftMargin );
}
gd = gdwhint( gd, part.getWidth( 200 ) );
final Composite composite = new Composite( parent, SWT.NONE );
composite.setLayoutData( gd );
register( composite );
if( count == 0 )
{
this.mainPropertyEditorComposite = composite;
}
else
{
composite.setLayout( glspacing( glayout( 3, 0, 0 ), 0 ) );
final Composite mainPropertyEditorOuterComposite = new Composite( composite, SWT.NONE );
mainPropertyEditorOuterComposite.setLayout( glayout( 1, 0, 4, 0, 0 ) );
final Composite mainPropertyEditorComposite = new Composite( mainPropertyEditorOuterComposite, SWT.NONE );
final Sash sash = new Sash( composite, SWT.VERTICAL );
sash.setLayoutData( gdhhint( gdvfill(), 1 ) );
final Composite relatedContentComposite = new Composite( composite, SWT.NONE );
relatedContentComposite.setLayout( glayout( 2, 0, 0 ) );
relatedContentComposite.setData( RELATED_CONTENT_WIDTH, ( (double) part.getRelatedContentWidth() ) / ( (double) 100 ) );
composite.addListener
(
SWT.Resize,
new org.eclipse.swt.widgets.Listener()