Skip to content

Commit 4f1d21d

Browse files
committed
Improve "Close mode" settings in Editor Preference
Make more clear that these two setting belong together. Change-Id: Idf0c683df571ae124e8166e4dcf6bb9536debbb3
1 parent b7784a1 commit 4f1d21d

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
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
@@ -747,7 +747,7 @@ public class WorkbenchMessages extends NLS {
747747
// ==============================================================================
748748
public static String PinEditorAction_toolTip;
749749
public static String WorkbenchPreference_reuseEditors;
750-
public static String WorkbenchPreference_reuseEditorsThreshold;
750+
public static String WorkbenchPreference_reuseEditors_closing;
751751
public static String WorkbenchPreference_reuseEditorsThresholdError;
752752
public static String WorkbenchPreference_recentFiles;
753753
public static String WorkbenchPreference_recentFilesError;

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import org.eclipse.jface.preference.PreferencePage;
2929
import org.eclipse.jface.preference.StringFieldEditor;
3030
import org.eclipse.jface.util.IPropertyChangeListener;
31+
import org.eclipse.jface.widgets.LabelFactory;
3132
import org.eclipse.osgi.util.NLS;
3233
import org.eclipse.swt.SWT;
3334
import org.eclipse.swt.layout.GridData;
@@ -50,7 +51,6 @@
5051
* The Editors preference page of the workbench.
5152
*/
5253
public 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
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,8 +732,8 @@ PageLayout_missingRefPart=Referenced part does not exist yet: {0}.
732732
# Keys used in the reuse editor which is released as experimental.
733733
# ==============================================================================
734734
PinEditorAction_toolTip=Pin Editor
735-
WorkbenchPreference_reuseEditors=&Close editors automatically
736-
WorkbenchPreference_reuseEditorsThreshold=Number of opened editors before closi&ng:
735+
WorkbenchPreference_reuseEditors=&Close editors if there are more than
736+
WorkbenchPreference_reuseEditors_closing=editors open
737737
WorkbenchPreference_reuseEditorsThresholdError=The number of opened editors should be more than 0.
738738
WorkbenchPreference_recentFiles=Size of &recently opened files list:
739739
WorkbenchPreference_recentFilesError=The size of the recently opened files list should be between 0 and {0}.

0 commit comments

Comments
 (0)