Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added "Close mode" frame in editor preference #2298

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ public class WorkbenchMessages extends NLS {

// --- Workbench -----
public static String WorkbenchPreference_openMode;
public static String WorkbenchPreference_closeMode;
public static String WorkbenchPreference_doubleClick;
public static String WorkbenchPreference_singleClick;
public static String WorkbenchPreference_singleClick_SelectOnHover;
Expand Down Expand Up @@ -744,7 +745,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,20 @@ 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(true, 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));
editorReuseThresholdGroup
.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

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 +256,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,12 +493,13 @@ OpenPerspectiveDialogAction_tooltip=Open Perspective

#---- General Preferences----
PreferencePage_noDescription = (No description available)
PreferencePageParameterValues_pageLabelSeparator = \ >\
PreferencePageParameterValues_pageLabelSeparator = \ >\
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_closeMode=Close mode
WorkbenchPreference_doubleClick=D&ouble click
WorkbenchPreference_singleClick=&Single click
WorkbenchPreference_singleClick_SelectOnHover=Select on &hover
Expand Down Expand Up @@ -729,8 +730,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 oldest 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
Loading