in plugins/schemaeditor/src/main/java/org/apache/directory/studio/schemaeditor/view/preferences/SearchViewPreferencePage.java [80:268]
protected Control createContents( Composite parent )
{
Composite composite = new Composite( parent, SWT.NONE );
composite.setLayout( new GridLayout() );
composite.setLayoutData( new GridData( SWT.FILL, SWT.FILL, true, true ) );
// Label Group
Group labelGroup = new Group( composite, SWT.NONE );
labelGroup.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
labelGroup.setText( Messages.getString( "SearchViewPreferencePage.Label" ) ); //$NON-NLS-1$
labelGroup.setLayout( new GridLayout() );
Composite labelGroupComposite = new Composite( labelGroup, SWT.NONE );
GridLayout gl = new GridLayout( 1, false );
gl.marginHeight = gl.marginWidth = 0;
labelGroupComposite.setLayout( gl );
labelGroupComposite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
// Label row composite
Composite labelComposite = new Composite( labelGroupComposite, SWT.NONE );
gl = new GridLayout( 3, false );
gl.marginHeight = gl.marginWidth = 0;
labelComposite.setLayout( gl );
GridData gd = new GridData( SWT.FILL, SWT.NONE, true, false );
gd.horizontalSpan = 1;
labelComposite.setLayoutData( gd );
// Use Label
Label useLabel = new Label( labelComposite, SWT.NONE );
useLabel.setText( Messages.getString( "SearchViewPreferencePage.Use" ) ); //$NON-NLS-1$
// Label Combo
labelCombo = new Combo( labelComposite, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER );
labelCombo.setLayoutData( new GridData() );
labelCombo
.setItems( new String[]
{
Messages.getString( "SearchViewPreferencePage.FirstName" ), Messages.getString( "SearchViewPreferencePage.AllAliases" ), Messages.getString( "SearchViewPreferencePage.OID" ) } ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
labelCombo.setEnabled( true );
// As label Label
Label asLabel = new Label( labelComposite, SWT.NONE );
asLabel.setText( Messages.getString( "SearchViewPreferencePage.AsLabel" ) ); //$NON-NLS-1$
// Abbreviate row composite
Composite abbreviateComposite = new Composite( labelGroupComposite, SWT.NONE );
gl = new GridLayout( 3, false );
gl.marginHeight = gl.marginWidth = 0;
abbreviateComposite.setLayout( gl );
gd = new GridData( SWT.FILL, SWT.NONE, true, false );
gd.horizontalSpan = 1;
abbreviateComposite.setLayoutData( gd );
// Limit label lenght to Label
limitButton = new Button( abbreviateComposite, SWT.CHECK );
limitButton.setText( Messages.getString( "SearchViewPreferencePage.LimitLength" ) ); //$NON-NLS-1$
gd = new GridData();
gd.horizontalSpan = 1;
limitButton.setLayoutData( gd );
// Lenght Text
lengthText = new Text( abbreviateComposite, SWT.NONE | SWT.BORDER );
GridData gridData = new GridData();
gridData.horizontalSpan = 1;
gridData.widthHint = 9 * 3;
lengthText.setLayoutData( gridData );
lengthText.setTextLimit( 3 );
lengthText.addVerifyListener( new VerifyListener()
{
public void verifyText( VerifyEvent e )
{
if ( !e.text.matches( "[0-9]*" ) ) //$NON-NLS-1$
{
e.doit = false;
}
if ( "".equals( lengthText.getText() ) && e.text.matches( "[0]" ) ) //$NON-NLS-1$ //$NON-NLS-2$
{
e.doit = false;
}
}
} );
// Characters Label
Label charactersLabel = new Label( abbreviateComposite, SWT.NONE );
charactersLabel.setText( Messages.getString( "SearchViewPreferencePage.Characters" ) ); //$NON-NLS-1$
// Secondary Label Group
Group secondaryLabelGroup = new Group( composite, SWT.NONE );
secondaryLabelGroup.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
secondaryLabelGroup.setText( Messages.getString( "SearchViewPreferencePage.SecondaryLabel" ) ); //$NON-NLS-1$
secondaryLabelGroup.setLayout( new GridLayout() );
Composite secondaryLabelGroupComposite = new Composite( secondaryLabelGroup, SWT.NONE );
gl = new GridLayout( 1, false );
gl.marginHeight = gl.marginWidth = 0;
secondaryLabelGroupComposite.setLayout( gl );
secondaryLabelGroupComposite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
secondaryLabelButtonDisplay = new Button( secondaryLabelGroupComposite, SWT.CHECK );
secondaryLabelButtonDisplay.setText( Messages.getString( "SearchViewPreferencePage.DisplaySecondaryLabel" ) ); //$NON-NLS-1$
// Label row composite
Composite secondaryLabelComposite = new Composite( secondaryLabelGroupComposite, SWT.NONE );
gl = new GridLayout( 3, false );
gl.marginHeight = gl.marginWidth = 0;
secondaryLabelComposite.setLayout( gl );
gd = new GridData( SWT.FILL, SWT.NONE, true, false );
gd.horizontalSpan = 1;
secondaryLabelComposite.setLayoutData( gd );
// Use Label
Label useLabel2 = new Label( secondaryLabelComposite, SWT.NONE );
useLabel2.setText( Messages.getString( "SearchViewPreferencePage.Use" ) ); //$NON-NLS-1$
// Label Combo
secondaryLabelCombo = new Combo( secondaryLabelComposite, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER );
secondaryLabelCombo.setLayoutData( new GridData() );
secondaryLabelCombo
.setItems( new String[]
{
Messages.getString( "SearchViewPreferencePage.FirstName" ), Messages.getString( "SearchViewPreferencePage.AllAliases" ), Messages.getString( "SearchViewPreferencePage.OID" ) } ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
secondaryLabelCombo.setEnabled( true );
// As label Label
Label asLabel2 = new Label( secondaryLabelComposite, SWT.NONE );
asLabel2.setText( Messages.getString( "SearchViewPreferencePage.AsSecondaryLabel" ) ); //$NON-NLS-1$
// Abbreviate row composite
Composite abbreviateComposite2 = new Composite( secondaryLabelGroup, SWT.NONE );
gl = new GridLayout( 3, false );
gl.marginHeight = gl.marginWidth = 0;
abbreviateComposite2.setLayout( gl );
gd = new GridData( SWT.FILL, SWT.NONE, true, false );
gd.horizontalSpan = 1;
abbreviateComposite2.setLayoutData( gd );
// Limit label lenght to Label
secondaryLabelLimitButton = new Button( abbreviateComposite2, SWT.CHECK );
secondaryLabelLimitButton.setText( Messages.getString( "SearchViewPreferencePage.LimitSecondaryLabel" ) ); //$NON-NLS-1$
gd = new GridData();
gd.horizontalSpan = 1;
secondaryLabelLimitButton.setLayoutData( gd );
// Lenght Text
secondaryLabelLengthText = new Text( abbreviateComposite2, SWT.NONE | SWT.BORDER );
gridData = new GridData();
gridData.horizontalSpan = 1;
gridData.widthHint = 9 * 3;
secondaryLabelLengthText.setLayoutData( gridData );
secondaryLabelLengthText.setTextLimit( 3 );
secondaryLabelLengthText.addVerifyListener( new VerifyListener()
{
public void verifyText( VerifyEvent e )
{
if ( !e.text.matches( "[0-9]*" ) ) //$NON-NLS-1$
{
e.doit = false;
}
if ( "".equals( secondaryLabelLengthText.getText() ) && e.text.matches( "[0]" ) ) //$NON-NLS-1$ //$NON-NLS-2$
{
e.doit = false;
}
}
} );
// Characters Label
Label secondaryLabelcharactersLabel = new Label( abbreviateComposite2, SWT.NONE );
secondaryLabelcharactersLabel.setText( Messages.getString( "SearchViewPreferencePage.Characters" ) ); //$NON-NLS-1$
// Schema Label Group
Group schemaLabelGroup = new Group( composite, SWT.NONE );
schemaLabelGroup.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
schemaLabelGroup.setText( Messages.getString( "SearchViewPreferencePage.SchemaLabel" ) ); //$NON-NLS-1$
schemaLabelGroup.setLayout( new GridLayout() );
Composite schemaLabelGroupComposite = new Composite( schemaLabelGroup, SWT.NONE );
gl = new GridLayout( 1, false );
gl.marginHeight = gl.marginWidth = 0;
schemaLabelGroupComposite.setLayout( gl );
schemaLabelGroupComposite.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false ) );
schemaLabelButtonDisplay = new Button( schemaLabelGroupComposite, SWT.CHECK );
schemaLabelButtonDisplay.setText( Messages.getString( "SearchViewPreferencePage.DisplaySchemaLabel" ) ); //$NON-NLS-1$
initFieldsFromPreferences();
initListeners();
applyDialogFont( parent );
return parent;
}