Skip to content

Commit 090a18a

Browse files
praveen-skpBeckerWdf
authored andcommitted
Improve "Close mode" settings in Editor Preference
Make more clear that these two setting belong together. Change-Id: Idf0c683df571ae124e8166e4dcf6bb9536debbb3
1 parent a022116 commit 090a18a

File tree

3 files changed

+22
-20
lines changed

3 files changed

+22
-20
lines changed

bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ public class WorkbenchMessages extends NLS {
744744
// ==============================================================================
745745
public static String PinEditorAction_toolTip;
746746
public static String WorkbenchPreference_reuseEditors;
747-
public static String WorkbenchPreference_reuseEditorsThreshold;
747+
public static String WorkbenchPreference_reuseEditors_closing;
748748
public static String WorkbenchPreference_reuseEditorsThresholdError;
749749
public static String WorkbenchPreference_recentFiles;
750750
public static String WorkbenchPreference_recentFilesError;

bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EditorsPreferencePage.java

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@
1818

1919
import static org.eclipse.swt.events.SelectionListener.widgetSelectedAdapter;
2020

21+
import org.eclipse.jface.layout.GridDataFactory;
22+
import org.eclipse.jface.layout.GridLayoutFactory;
2123
import org.eclipse.jface.preference.FieldEditor;
2224
import org.eclipse.jface.preference.IPreferenceStore;
2325
import org.eclipse.jface.preference.IntegerFieldEditor;
2426
import org.eclipse.jface.preference.PreferencePage;
2527
import org.eclipse.jface.preference.StringFieldEditor;
2628
import org.eclipse.jface.util.IPropertyChangeListener;
29+
import org.eclipse.jface.widgets.LabelFactory;
2730
import org.eclipse.osgi.util.NLS;
2831
import org.eclipse.swt.SWT;
2932
import org.eclipse.swt.layout.GridData;
@@ -46,7 +49,6 @@
4649
* The Editors preference page of the workbench.
4750
*/
4851
public 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
/**

bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,10 +493,10 @@ OpenPerspectiveDialogAction_tooltip=Open Perspective
493493

494494
#---- General Preferences----
495495
PreferencePage_noDescription = (No description available)
496-
PreferencePageParameterValues_pageLabelSeparator = \ >\
496+
PreferencePageParameterValues_pageLabelSeparator = \ >\
497497
ThemingEnabled = E&nable theming
498498
ThemeChangeWarningText = Restart for the theme changes to take full effect
499-
ThemeChangeWarningTitle = Theme Changed
499+
ThemeChangeWarningTitle = Theme Changed
500500
# --- Workbench -----
501501
WorkbenchPreference_openMode=Open mode
502502
WorkbenchPreference_doubleClick=D&ouble click
@@ -729,8 +729,8 @@ PageLayout_missingRefPart=Referenced part does not exist yet: {0}.
729729
# Keys used in the reuse editor which is released as experimental.
730730
# ==============================================================================
731731
PinEditorAction_toolTip=Pin Editor
732-
WorkbenchPreference_reuseEditors=&Close editors automatically
733-
WorkbenchPreference_reuseEditorsThreshold=Number of opened editors before closi&ng:
732+
WorkbenchPreference_reuseEditors=&Close editors if there are more than
733+
WorkbenchPreference_reuseEditors_closing=editors open
734734
WorkbenchPreference_reuseEditorsThresholdError=The number of opened editors should be more than 0.
735735
WorkbenchPreference_recentFiles=Size of &recently opened files list:
736736
WorkbenchPreference_recentFilesError=The size of the recently opened files list should be between 0 and {0}.

0 commit comments

Comments
 (0)