Skip to content

Commit

Permalink
Improve "Close mode" settings in Editor Preference
Browse files Browse the repository at this point in the history
Make more clear that these two setting belong together.

Change-Id: Idf0c683df571ae124e8166e4dcf6bb9536debbb3
  • Loading branch information
praveen-skp authored and BeckerWdf committed Oct 11, 2024
1 parent a022116 commit 090a18a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ public class WorkbenchMessages extends NLS {
// ==============================================================================
public static String PinEditorAction_toolTip;
public static String WorkbenchPreference_reuseEditors;
public static String WorkbenchPreference_reuseEditorsThreshold;
public static String WorkbenchPreference_reuseEditors_closing;
public static String WorkbenchPreference_reuseEditorsThresholdError;
public static String WorkbenchPreference_recentFiles;
public static String WorkbenchPreference_recentFilesError;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@

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

import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.preference.FieldEditor;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.IntegerFieldEditor;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.widgets.LabelFactory;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
Expand All @@ -46,7 +49,6 @@
* The Editors preference page of the workbench.
*/
public class EditorsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
private static final int REUSE_INDENT = 20;

protected Composite editorReuseGroup;

Expand Down Expand Up @@ -213,11 +215,7 @@ protected void updateValidState() {
*/
protected void createEditorReuseGroup(Composite composite) {
editorReuseGroup = new Composite(composite, SWT.LEFT);
GridLayout layout = new GridLayout();
// Line up with other entries in preference page
layout.marginWidth = 0;
layout.marginHeight = 0;
editorReuseGroup.setLayout(layout);
editorReuseGroup.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).spacing(0, 0).create());
editorReuseGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));

reuseEditors = new Button(editorReuseGroup, SWT.CHECK);
Expand All @@ -232,20 +230,22 @@ protected void createEditorReuseGroup(Composite composite) {
}));

editorReuseIndentGroup = new Composite(editorReuseGroup, SWT.LEFT);
GridLayout indentLayout = new GridLayout();
indentLayout.marginLeft = REUSE_INDENT;
indentLayout.marginWidth = 0;
editorReuseIndentGroup.setLayout(indentLayout);
editorReuseIndentGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
editorReuseIndentGroup.setLayout(GridLayoutFactory.fillDefaults().create());
editorReuseIndentGroup
.setLayoutData(GridDataFactory.fillDefaults().grab(false, false).create());

editorReuseThresholdGroup = new Composite(editorReuseIndentGroup, SWT.LEFT);
layout = new GridLayout();
GridLayout layout = new GridLayout();
layout.marginWidth = 0;
editorReuseThresholdGroup.setLayout(layout);
editorReuseThresholdGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
GridData gridData = GridDataFactory.fillDefaults().grab(true, false).create();
gridData.widthHint = 35;
editorReuseThresholdGroup
.setLayoutData(gridData);

reuseEditorsThreshold = new IntegerFieldEditor(IPreferenceConstants.REUSE_EDITORS,
WorkbenchMessages.WorkbenchPreference_reuseEditorsThreshold, editorReuseThresholdGroup);
reuseEditorsThreshold = new IntegerFieldEditor(IPreferenceConstants.REUSE_EDITORS, "", //$NON-NLS-1$
editorReuseThresholdGroup);
reuseEditorsThreshold.getLabelControl(editorReuseThresholdGroup).dispose();

reuseEditorsThreshold.setPreferenceStore(WorkbenchPlugin.getDefault().getPreferenceStore());
reuseEditorsThreshold.setPage(this);
Expand All @@ -258,6 +258,8 @@ protected void createEditorReuseGroup(Composite composite) {
reuseEditorsThreshold.getTextControl(editorReuseThresholdGroup).setEnabled(reuseEditors.getSelection());
reuseEditorsThreshold.setPropertyChangeListener(validityChangeListener);

LabelFactory.newLabel(SWT.NONE).text(WorkbenchMessages.WorkbenchPreference_reuseEditors_closing)
.create(editorReuseGroup);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,10 @@ OpenPerspectiveDialogAction_tooltip=Open Perspective

#---- General Preferences----
PreferencePage_noDescription = (No description available)
PreferencePageParameterValues_pageLabelSeparator = \ >\
PreferencePageParameterValues_pageLabelSeparator = \ >\

This comment has been minimized.

Copy link
@merks

merks Oct 12, 2024

Contributor

This was a mistake.

You can see the mistake just in the coloring in the editor.

Image

The trailing space was supposed to be part of the value of the PreferencePageParameterValues_pageLabelSeparator but this change has continued the value to the next line.

I noticed this because my build had errors

Warning: NLS missing message: ThemingEnabled in: org.eclipse.ui.internal.messages

Fixing via #2393

ThemingEnabled = E&nable theming
ThemeChangeWarningText = Restart for the theme changes to take full effect
ThemeChangeWarningTitle = Theme Changed
ThemeChangeWarningTitle = Theme Changed
# --- Workbench -----
WorkbenchPreference_openMode=Open mode
WorkbenchPreference_doubleClick=D&ouble click
Expand Down Expand Up @@ -729,8 +729,8 @@ PageLayout_missingRefPart=Referenced part does not exist yet: {0}.
# Keys used in the reuse editor which is released as experimental.
# ==============================================================================
PinEditorAction_toolTip=Pin Editor
WorkbenchPreference_reuseEditors=&Close editors automatically
WorkbenchPreference_reuseEditorsThreshold=Number of opened editors before closi&ng:
WorkbenchPreference_reuseEditors=&Close editors if there are more than
WorkbenchPreference_reuseEditors_closing=editors open
WorkbenchPreference_reuseEditorsThresholdError=The number of opened editors should be more than 0.
WorkbenchPreference_recentFiles=Size of &recently opened files list:
WorkbenchPreference_recentFilesError=The size of the recently opened files list should be between 0 and {0}.
Expand Down

0 comments on commit 090a18a

Please sign in to comment.