1818
1919import static org .eclipse .swt .events .SelectionListener .widgetSelectedAdapter ;
2020
21+ import org .eclipse .jface .layout .GridDataFactory ;
22+ import org .eclipse .jface .layout .GridLayoutFactory ;
2123import org .eclipse .jface .preference .FieldEditor ;
2224import org .eclipse .jface .preference .IPreferenceStore ;
2325import org .eclipse .jface .preference .IntegerFieldEditor ;
2426import org .eclipse .jface .preference .PreferencePage ;
2527import org .eclipse .jface .preference .StringFieldEditor ;
2628import org .eclipse .jface .util .IPropertyChangeListener ;
29+ import org .eclipse .jface .widgets .LabelFactory ;
2730import org .eclipse .osgi .util .NLS ;
2831import org .eclipse .swt .SWT ;
2932import org .eclipse .swt .layout .GridData ;
4649 * The Editors preference page of the workbench.
4750 */
4851public class EditorsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
49- private static final int REUSE_INDENT = 20 ;
5052
5153 protected Composite editorReuseGroup ;
5254
@@ -213,11 +215,7 @@ protected void updateValidState() {
213215 */
214216 protected void createEditorReuseGroup (Composite composite ) {
215217 editorReuseGroup = new Composite (composite , SWT .LEFT );
216- GridLayout layout = new GridLayout ();
217- // Line up with other entries in preference page
218- layout .marginWidth = 0 ;
219- layout .marginHeight = 0 ;
220- editorReuseGroup .setLayout (layout );
218+ editorReuseGroup .setLayout (GridLayoutFactory .fillDefaults ().numColumns (3 ).spacing (0 , 0 ).create ());
221219 editorReuseGroup .setLayoutData (new GridData (GridData .HORIZONTAL_ALIGN_FILL | GridData .GRAB_HORIZONTAL ));
222220
223221 reuseEditors = new Button (editorReuseGroup , SWT .CHECK );
@@ -232,20 +230,22 @@ protected void createEditorReuseGroup(Composite composite) {
232230 }));
233231
234232 editorReuseIndentGroup = new Composite (editorReuseGroup , SWT .LEFT );
235- GridLayout indentLayout = new GridLayout ();
236- indentLayout .marginLeft = REUSE_INDENT ;
237- indentLayout .marginWidth = 0 ;
238- editorReuseIndentGroup .setLayout (indentLayout );
239- editorReuseIndentGroup .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , true , false ));
233+ editorReuseIndentGroup .setLayout (GridLayoutFactory .fillDefaults ().create ());
234+ editorReuseIndentGroup
235+ .setLayoutData (GridDataFactory .fillDefaults ().grab (false , false ).create ());
240236
241237 editorReuseThresholdGroup = new Composite (editorReuseIndentGroup , SWT .LEFT );
242- layout = new GridLayout ();
238+ GridLayout layout = new GridLayout ();
243239 layout .marginWidth = 0 ;
244240 editorReuseThresholdGroup .setLayout (layout );
245- editorReuseThresholdGroup .setLayoutData (new GridData (SWT .FILL , SWT .CENTER , true , false ));
241+ GridData gridData = GridDataFactory .fillDefaults ().grab (true , false ).create ();
242+ gridData .widthHint = 35 ;
243+ editorReuseThresholdGroup
244+ .setLayoutData (gridData );
246245
247- reuseEditorsThreshold = new IntegerFieldEditor (IPreferenceConstants .REUSE_EDITORS ,
248- WorkbenchMessages .WorkbenchPreference_reuseEditorsThreshold , editorReuseThresholdGroup );
246+ reuseEditorsThreshold = new IntegerFieldEditor (IPreferenceConstants .REUSE_EDITORS , "" , //$NON-NLS-1$
247+ editorReuseThresholdGroup );
248+ reuseEditorsThreshold .getLabelControl (editorReuseThresholdGroup ).dispose ();
249249
250250 reuseEditorsThreshold .setPreferenceStore (WorkbenchPlugin .getDefault ().getPreferenceStore ());
251251 reuseEditorsThreshold .setPage (this );
@@ -258,6 +258,8 @@ protected void createEditorReuseGroup(Composite composite) {
258258 reuseEditorsThreshold .getTextControl (editorReuseThresholdGroup ).setEnabled (reuseEditors .getSelection ());
259259 reuseEditorsThreshold .setPropertyChangeListener (validityChangeListener );
260260
261+ LabelFactory .newLabel (SWT .NONE ).text (WorkbenchMessages .WorkbenchPreference_reuseEditors_closing )
262+ .create (editorReuseGroup );
261263 }
262264
263265 /**
0 commit comments