2828import org .eclipse .jface .preference .PreferencePage ;
2929import org .eclipse .jface .preference .StringFieldEditor ;
3030import org .eclipse .jface .util .IPropertyChangeListener ;
31+ import org .eclipse .jface .widgets .LabelFactory ;
3132import org .eclipse .osgi .util .NLS ;
3233import org .eclipse .swt .SWT ;
3334import org .eclipse .swt .layout .GridData ;
5051 * The Editors preference page of the workbench.
5152 */
5253public class EditorsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
53- private static final int REUSE_INDENT = 20 ;
5454
5555 protected Composite editorReuseGroup ;
5656
@@ -238,11 +238,7 @@ protected void updateValidState() {
238238 */
239239 protected void createEditorReuseGroup (Composite composite ) {
240240 editorReuseGroup = new Composite (composite , SWT .LEFT );
241- GridLayout layout = new GridLayout ();
242- // Line up with other entries in preference page
243- layout .marginWidth = 0 ;
244- layout .marginHeight = 0 ;
245- editorReuseGroup .setLayout (layout );
241+ editorReuseGroup .setLayout (GridLayoutFactory .fillDefaults ().numColumns (3 ).spacing (0 , 0 ).create ());
246242 editorReuseGroup .setLayoutData (new GridData (GridData .HORIZONTAL_ALIGN_FILL | GridData .GRAB_HORIZONTAL ));
247243
248244 reuseEditors = new Button (editorReuseGroup , SWT .CHECK );
@@ -257,20 +253,22 @@ protected void createEditorReuseGroup(Composite composite) {
257253 }));
258254
259255 editorReuseIndentGroup = new Composite (editorReuseGroup , SWT .LEFT );
260- GridLayout indentLayout = new GridLayout ();
261- indentLayout .marginLeft = REUSE_INDENT ;
262- indentLayout .marginWidth = 0 ;
263- editorReuseIndentGroup .setLayout (indentLayout );
264- editorReuseIndentGroup .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , true , false ));
256+ editorReuseIndentGroup .setLayout (GridLayoutFactory .fillDefaults ().create ());
257+ editorReuseIndentGroup
258+ .setLayoutData (GridDataFactory .fillDefaults ().grab (false , false ).create ());
265259
266260 editorReuseThresholdGroup = new Composite (editorReuseIndentGroup , SWT .LEFT );
267- layout = new GridLayout ();
261+ GridLayout layout = new GridLayout ();
268262 layout .marginWidth = 0 ;
269263 editorReuseThresholdGroup .setLayout (layout );
270- editorReuseThresholdGroup .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , true , false ));
264+ GridData gridData = GridDataFactory .fillDefaults ().grab (true , false ).create ();
265+ gridData .widthHint = 35 ;
266+ editorReuseThresholdGroup
267+ .setLayoutData (gridData );
271268
272- reuseEditorsThreshold = new IntegerFieldEditor (IPreferenceConstants .REUSE_EDITORS ,
273- WorkbenchMessages .WorkbenchPreference_reuseEditorsThreshold , editorReuseThresholdGroup );
269+ reuseEditorsThreshold = new IntegerFieldEditor (IPreferenceConstants .REUSE_EDITORS , "" , //$NON-NLS-1$
270+ editorReuseThresholdGroup );
271+ reuseEditorsThreshold .getLabelControl (editorReuseThresholdGroup ).dispose ();
274272
275273 reuseEditorsThreshold .setPreferenceStore (WorkbenchPlugin .getDefault ().getPreferenceStore ());
276274 reuseEditorsThreshold .setPage (this );
@@ -283,6 +281,8 @@ protected void createEditorReuseGroup(Composite composite) {
283281 reuseEditorsThreshold .getTextControl (editorReuseThresholdGroup ).setEnabled (reuseEditors .getSelection ());
284282 reuseEditorsThreshold .setPropertyChangeListener (validityChangeListener );
285283
284+ LabelFactory .newLabel (SWT .NONE ).text (WorkbenchMessages .WorkbenchPreference_reuseEditors_closing )
285+ .create (editorReuseGroup );
286286 }
287287
288288 /**
0 commit comments