aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoshe WAJNBERG2014-02-24 16:04:06 (EST)
committerMarkus Keller2014-02-24 16:04:06 (EST)
commitcd159efd28799e71212681b63bc74f016fb538b9 (patch)
tree3a771f7d90d0bc195232a8a0da77d0adfdcb4ce3
parent5479fbcb2d0fc973f1279341eb87570555a12c8c (diff)
downloadeclipse.platform.ui-cd159efd28799e71212681b63bc74f016fb538b9.zip
eclipse.platform.ui-cd159efd28799e71212681b63bc74f016fb538b9.tar.gz
eclipse.platform.ui-cd159efd28799e71212681b63bc74f016fb538b9.tar.bz2
Bug 424723: [BiDi] [BDL] Provide a Globalization Preferences dialog
Signed-off-by: Moshe WAJNBERG <wajnberg@il.ibm.com>
-rw-r--r--bundles/org.eclipse.ui.ide/plugin.properties2
-rw-r--r--bundles/org.eclipse.ui.ide/plugin.xml10
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPreferenceConstants.java16
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchHelpContextIds.java5
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java24
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java13
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPreferenceInitializer.java9
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/GlobalizationPreferencePage.java284
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties13
10 files changed, 380 insertions, 9 deletions
diff --git a/bundles/org.eclipse.ui.ide/plugin.properties b/bundles/org.eclipse.ui.ide/plugin.properties
index 7270ce2..cf30577 100644
--- a/bundles/org.eclipse.ui.ide/plugin.properties
+++ b/bundles/org.eclipse.ui.ide/plugin.properties
@@ -50,6 +50,7 @@ NewWizards.file = File
NewWizards.file.description = Create a new file resource
PreferencePages.Workbench = General
+PreferencePages.Globalization = Globalization
PreferencePages.Editors = Editors
PreferencePages.LinkedResources = Linked Resources
PreferencePages.FileEditors = File Associations
@@ -214,6 +215,7 @@ PreferenceKeywords.Themes = themes
PreferenceKeywords.AppearancePage = presentation
PreferenceKeywords.Tabs = tab
PreferenceKeywords.Editors = editors
+PreferenceKeywords.Globalization = unicode locale extensions bidi ltr rtl direction
PreferenceKeywords.Reuse = reuse
PreferenceKeywords.Pin = pin
PreferenceKeywords.Close = close
diff --git a/bundles/org.eclipse.ui.ide/plugin.xml b/bundles/org.eclipse.ui.ide/plugin.xml
index bcedb2d..3c8b23c 100644
--- a/bundles/org.eclipse.ui.ide/plugin.xml
+++ b/bundles/org.eclipse.ui.ide/plugin.xml
@@ -478,6 +478,9 @@
id="org.eclipse.ui.ide.editors"
label="%PreferenceKeywords.Editors"/>
<keyword
+ id="org.eclipse.ui.ide.globalization"
+ label="%PreferenceKeywords.Globalization"/>
+ <keyword
id="org.eclipse.ui.ide.reuse"
label="%PreferenceKeywords.Reuse"/>
<keyword
@@ -547,6 +550,13 @@
<keywordReference id="org.eclipse.ui.ide.general"/>
</page>
<page
+ name="%PreferencePages.Globalization"
+ category="org.eclipse.ui.preferencePages.Workbench"
+ class="org.eclipse.ui.internal.dialogs.GlobalizationPreferencePage"
+ id="org.eclipse.ui.preferencePages.Globalization">
+ <keywordReference id="org.eclipse.ui.ide.globalization"/>
+ </page>
+ <page
name="%PreferencePages.Editors"
category="org.eclipse.ui.preferencePages.Workbench"
class="org.eclipse.ui.internal.ide.dialogs.IDEEditorsPreferencePage"
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPreferenceConstants.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPreferenceConstants.java
index 2d40a81..cc7f96f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPreferenceConstants.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPreferenceConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -30,6 +30,20 @@ public interface IPreferenceConstants {
//Boolean: true = open after delay
public static final String OPEN_AFTER_DELAY = "OPEN_AFTER_DELAY"; //$NON-NLS-1$
+ // Boolean: true = bidi support enabled; false = bidi support disabled
+ public static final String BIDI_SUPPORT = "BIDI_SUPPORT"; //$NON-NLS-1$
+
+ // String: Text direction. May have the following values: "ltr", "rtl",
+ // "auto", and "".
+ public static final String TEXT_DIRECTION = "TEXT_DIRECTION"; //$NON-NLS-1$
+
+ // String: Layout direction. May have the following values:
+ // SWT.LEFT_TO_RIGHT, SWT.RIGHT_TO_LEFT, and SWT.NONE.
+ public static final String LAYOUT_DIRECTION = "LAYOUT_DIRECTION"; //$NON-NLS-1$
+
+ // String: Unicode locale extensions
+ public static final String NL_EXTENSIONS = "NL_EXTENSIONS"; //$NON-NLS-1$
+
//Do we show color icons in toolbars?
public static final String COLOR_ICONS = "COLOR_ICONS"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchHelpContextIds.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchHelpContextIds.java
index 7770303..bfd68e7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchHelpContextIds.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchHelpContextIds.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -282,6 +282,9 @@ public interface IWorkbenchHelpContextIds {
public static final String WORKBENCH_PREFERENCE_PAGE = PREFIX
+ "workbench_preference_page_context"; //$NON-NLS-1$
+ public static final String GLOBALIZATION_PREFERENCE_PAGE = PREFIX
+ + "globalization_preference_page_context"; //$NON-NLS-1$
+
public static final String DECORATORS_PREFERENCE_PAGE = PREFIX
+ "decorators_preference_page_context"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
index 598da09..dfc2e90 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
@@ -123,6 +123,7 @@ import org.eclipse.jface.operation.ModalContext;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceManager;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.util.BidiUtils;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.OpenStrategy;
import org.eclipse.jface.util.PropertyChangeEvent;
@@ -1608,6 +1609,9 @@ public final class Workbench extends EventManager implements IWorkbench,
// initialize workbench single-click vs double-click behavior
initializeSingleClickOption();
+ initializeGlobalization();
+ initializeNLExtensions();
+
initializeWorkbenchImages();
StartupThreading.runWithoutExceptions(new StartupRunnable() {
@@ -1715,6 +1719,26 @@ public final class Workbench extends EventManager implements IWorkbench,
OpenStrategy.setOpenMethod(singleClickMethod);
}
+ private void initializeGlobalization() {
+ IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
+
+ if (!store.isDefault(IPreferenceConstants.BIDI_SUPPORT)) {
+ BidiUtils.setBidiSupport(store.getBoolean(IPreferenceConstants.BIDI_SUPPORT));
+ }
+ if (!store.isDefault(IPreferenceConstants.TEXT_DIRECTION)) {
+ BidiUtils.setTextDirection(store.getString(IPreferenceConstants.TEXT_DIRECTION));
+ }
+ }
+
+ private void initializeNLExtensions() {
+ IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
+ if (!store.isDefault(IPreferenceConstants.NL_EXTENSIONS)) {
+ String nlExtensions = store.getString(IPreferenceConstants.NL_EXTENSIONS);
+ ULocale.setDefault(Category.FORMAT, new ULocale(ULocale.getDefault(Category.FORMAT)
+ .getBaseName() + nlExtensions));
+ }
+ }
+
/*
* Initializes the workbench fonts with the stored values.
*/
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java
index 56bdc06..50fc1ae 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2013 IBM Corporation and others.
+ * Copyright (c) 2005, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -556,6 +556,17 @@ public class WorkbenchMessages extends NLS {
public static String WorkbenchPreference_HeapStatusButton;
public static String WorkbenchPreference_HeapStatusButtonToolTip;
+ // --- Globalization -----
+ public static String GlobalizationPreference_nlExtensions;
+ public static String GlobalizationPreference_layoutDirection;
+ public static String GlobalizationPreference_bidiSupport;
+ public static String GlobalizationPreference_textDirection;
+ public static String GlobalizationPreference_defaultDirection;
+ public static String GlobalizationPreference_ltrDirection;
+ public static String GlobalizationPreference_autoDirection;
+ public static String GlobalizationPreference_rtlDirection;
+ public static String GlobalizationPreference_restartWidget;
+
// --- Fonts ---
public static String FontsPreference_useSystemFont;
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java
index 9fdc438..2785452 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java
@@ -851,7 +851,7 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
JFaceUtil.initializeJFace();
parseBidiArguments();
- Window.setDefaultOrientation(getDefaultOrientation());
+ Window.setDefaultOrientation(getDefaultOrientation());
// The UI plugin needs to be initialized so that it can install the callback in PrefUtil,
// which needs to be done as early as possible, before the workbench
@@ -931,9 +931,9 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
}
/**
- * Get the default orientation from the command line
- * arguments. If there are no arguments imply the
- * orientation.
+ * Get the default orientation from the preferences or from the command line
+ * arguments. If there are no arguments imply the orientation.
+ *
* @return int
* @see SWT#NONE
* @see SWT#RIGHT_TO_LEFT
@@ -941,6 +941,11 @@ public class WorkbenchPlugin extends AbstractUIPlugin {
*/
private int getDefaultOrientation() {
+ IPreferenceStore store = getPreferenceStore();
+ if (!store.isDefault(IPreferenceConstants.LAYOUT_DIRECTION)) {
+ return store.getInt(IPreferenceConstants.LAYOUT_DIRECTION);
+ }
+
String[] commandLineArgs = Platform.getCommandLineArgs();
int orientation = getCommandLineOrientation(commandLineArgs);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPreferenceInitializer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPreferenceInitializer.java
index 031b4f8..2c9f33f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPreferenceInitializer.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPreferenceInitializer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -23,6 +23,7 @@ import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.util.OpenStrategy;
+import org.eclipse.swt.SWT;
import org.eclipse.ui.IWorkbenchPreferenceConstants;
import org.osgi.service.prefs.BackingStoreException;
@@ -109,6 +110,12 @@ public class WorkbenchPreferenceInitializer extends
node.putBoolean(IHeapStatusConstants.PREF_SHOW_MAX, false);
node.putBoolean(IPreferenceConstants.OVERRIDE_PRESENTATION, false);
+ // Globalization preferences
+ node.put(IPreferenceConstants.NL_EXTENSIONS, ""); //$NON-NLS-1$
+ node.putInt(IPreferenceConstants.LAYOUT_DIRECTION, SWT.NONE);
+ node.putBoolean(IPreferenceConstants.BIDI_SUPPORT, false);
+ node.put(IPreferenceConstants.TEXT_DIRECTION, ""); //$NON-NLS-1$
+
IEclipsePreferences rootNode = (IEclipsePreferences) Platform
.getPreferencesService().getRootNode()
.node(InstanceScope.SCOPE);
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/GlobalizationPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/GlobalizationPreferencePage.java
new file mode 100644
index 0000000..4e46084
--- /dev/null
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/GlobalizationPreferencePage.java
@@ -0,0 +1,284 @@
+/*******************************************************************************
+ * Copyright (c) 2014 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Moshe Wajnberg - <wajnberg@il.ibm.com> -
+ ******************************************************************************/
+
+package org.eclipse.ui.internal.dialogs;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.LayoutConstants;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.preference.StringFieldEditor;
+import org.eclipse.jface.util.BidiUtils;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.IPreferenceConstants;
+import org.eclipse.ui.internal.IWorkbenchHelpContextIds;
+import org.eclipse.ui.internal.WorkbenchMessages;
+import org.eclipse.ui.internal.WorkbenchPlugin;
+import org.eclipse.ui.internal.util.PrefUtil;
+
+/**
+ * Globalization preference page.
+ */
+public class GlobalizationPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+
+ private Combo layoutDirectionCombo;
+ private Button bidiSupportClickButton;
+ private Combo textDirectionCombo;
+ private StringFieldEditor nlExtensionsField;
+ private int layoutDirection;
+ private boolean bidiSupport;
+ private String textDirection;
+ private static final String DEFAULT_DIR = WorkbenchMessages.GlobalizationPreference_defaultDirection;
+ private static final String LTR_DIR = WorkbenchMessages.GlobalizationPreference_ltrDirection;
+ private static final String AUTO_DIR = WorkbenchMessages.GlobalizationPreference_autoDirection;
+ private static final String RTL_DIR = WorkbenchMessages.GlobalizationPreference_rtlDirection;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.preference.PreferencePage
+ */
+ protected Control createContents(Composite parent) {
+ PlatformUI.getWorkbench().getHelpSystem()
+ .setHelp(parent, IWorkbenchHelpContextIds.GLOBALIZATION_PREFERENCE_PAGE);
+
+ Composite composite = createComposite(parent);
+ createNlsExtensionsGroup(composite);
+ createSpace(composite);
+ createBidiPreferencesGroup(composite);
+
+ applyDialogFont(composite);
+
+ return composite;
+ }
+
+ /**
+ * Creates the composite which will contain all the preference controls for
+ * this page.
+ *
+ * @param parent
+ * the parent composite
+ * @return the composite for this page
+ */
+ private static Composite createComposite(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL
+ | GridData.HORIZONTAL_ALIGN_FILL));
+ return composite;
+ }
+
+ private void createNlsExtensionsGroup(Composite parent) {
+ nlExtensionsField = new StringFieldEditor(IPreferenceConstants.NL_EXTENSIONS,
+ WorkbenchMessages.GlobalizationPreference_nlExtensions, parent);
+
+ nlExtensionsField.setPreferenceStore(getPreferenceStore());
+ nlExtensionsField.setPage(this);
+ nlExtensionsField.load();
+ }
+
+ private void createBidiPreferencesGroup(Composite composite) {
+
+ layoutDirectionCombo = addComboBox(composite,
+ WorkbenchMessages.GlobalizationPreference_layoutDirection, 0);
+ layoutDirectionCombo.setItems(new String[] { DEFAULT_DIR, LTR_DIR, RTL_DIR });
+ layoutDirectionCombo.select(getLayoutDirectionIndex(layoutDirection));
+ layoutDirectionCombo.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ layoutDirection = getLayoutDirectionInteger(layoutDirectionCombo
+ .getSelectionIndex());
+ }
+ });
+
+ createSpace(composite);
+
+ bidiSupportClickButton = new Button(composite, SWT.CHECK | SWT.LEFT);
+ bidiSupportClickButton.setLayoutData(GridDataFactory.swtDefaults().span(2, 1).create());
+ bidiSupportClickButton.setText(WorkbenchMessages.GlobalizationPreference_bidiSupport);
+ bidiSupportClickButton.setSelection(bidiSupport);
+ bidiSupportClickButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ selectClickMode(bidiSupportClickButton.getSelection());
+ }
+ });
+
+ textDirectionCombo = addComboBox(composite,
+ WorkbenchMessages.GlobalizationPreference_textDirection,
+ LayoutConstants.getIndent());
+ textDirectionCombo.setItems(new String[] { DEFAULT_DIR, LTR_DIR, AUTO_DIR, RTL_DIR });
+ textDirectionCombo.setEnabled(bidiSupport);
+ textDirectionCombo.select(getTextDirectionIndex(textDirection));
+ textDirectionCombo.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ textDirection = getTextDirectionString(textDirectionCombo.getSelectionIndex());
+ }
+ });
+
+ createSpace(composite);
+
+ Font font = composite.getFont();
+ Composite note = createNoteComposite(font, composite, WorkbenchMessages.Preference_note,
+ WorkbenchMessages.GlobalizationPreference_restartWidget);
+ note.setLayoutData(GridDataFactory.swtDefaults().span(2, 1).create());
+ }
+
+ private void selectClickMode(boolean singleClick) {
+ bidiSupport = singleClick;
+ textDirectionCombo.setEnabled(bidiSupport);
+ }
+
+ private int getTextDirectionIndex(String textDirection) {
+ int index;
+ if (textDirection.equals(BidiUtils.LEFT_TO_RIGHT)) {
+ index = textDirectionCombo.indexOf(LTR_DIR);
+ } else if (textDirection.equals(BidiUtils.RIGHT_TO_LEFT)) {
+ index = textDirectionCombo.indexOf(RTL_DIR);
+ } else if (textDirection.equals(BidiUtils.AUTO)) {
+ index = textDirectionCombo.indexOf(AUTO_DIR);
+ } else {
+ index = textDirectionCombo.indexOf(DEFAULT_DIR);
+ }
+ return index;
+ }
+
+ private String getTextDirectionString(int index) {
+ String textDir;
+ if (index == textDirectionCombo.indexOf(LTR_DIR)) {
+ textDir = BidiUtils.LEFT_TO_RIGHT;
+ } else if (index == textDirectionCombo.indexOf(AUTO_DIR)) {
+ textDir = BidiUtils.AUTO;
+ } else if (index == textDirectionCombo.indexOf(RTL_DIR)) {
+ textDir = BidiUtils.RIGHT_TO_LEFT;
+ } else {
+ textDir = ""; //$NON-NLS-1$
+ }
+ return textDir;
+ }
+
+ private int getLayoutDirectionIndex(int layoutDirection) {
+ int index;
+ if (layoutDirection == SWT.LEFT_TO_RIGHT) {
+ index = layoutDirectionCombo.indexOf(LTR_DIR);
+ } else if (layoutDirection == SWT.RIGHT_TO_LEFT) {
+ index = layoutDirectionCombo.indexOf(RTL_DIR);
+ } else {
+ index = layoutDirectionCombo.indexOf(DEFAULT_DIR);
+ }
+ return index;
+ }
+
+ private int getLayoutDirectionInteger(int index) {
+ int layoutDir;
+ if (index == layoutDirectionCombo.indexOf(LTR_DIR)) {
+ layoutDir = SWT.LEFT_TO_RIGHT;
+ } else if (index == layoutDirectionCombo.indexOf(RTL_DIR)) {
+ layoutDir = SWT.RIGHT_TO_LEFT;
+ } else {
+ layoutDir = SWT.NONE;
+ }
+ return layoutDir;
+ }
+
+ private static Combo addComboBox(Composite parent, String label, int indent) {
+ Label labelControl = new Label(parent, SWT.LEFT);
+ GridData gd = new GridData();
+ gd.horizontalIndent = indent;
+ labelControl.setLayoutData(gd);
+ labelControl.setText(label);
+
+ Combo comboBox = new Combo(parent, SWT.READ_ONLY);
+ return comboBox;
+ }
+
+ private static void createSpace(Composite parent) {
+ Label vfiller = new Label(parent, SWT.LEFT);
+ GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
+ gridData.horizontalSpan= 2;
+
+ GC gc = new GC(parent);
+ gridData.heightHint = Dialog.convertHeightInCharsToPixels(gc.getFontMetrics(), 1) / 2;
+ gc.dispose();
+
+ vfiller.setLayoutData(gridData);
+ }
+
+ protected IPreferenceStore doGetPreferenceStore() {
+ return WorkbenchPlugin.getDefault().getPreferenceStore();
+ }
+
+ /**
+ * @see IWorkbenchPreferencePage
+ */
+ public void init(IWorkbench aWorkbench) {
+ IPreferenceStore store = getPreferenceStore();
+ layoutDirection = store.getInt(IPreferenceConstants.LAYOUT_DIRECTION);
+ bidiSupport = store.getBoolean(IPreferenceConstants.BIDI_SUPPORT);
+ textDirection = store.getString(IPreferenceConstants.TEXT_DIRECTION);
+ }
+
+ /**
+ * The default button has been pressed.
+ */
+ protected void performDefaults() {
+ IPreferenceStore store = getPreferenceStore();
+ nlExtensionsField
+ .setStringValue(store.getDefaultString(IPreferenceConstants.NL_EXTENSIONS));
+ layoutDirection = store.getDefaultInt(IPreferenceConstants.LAYOUT_DIRECTION);
+ bidiSupport = store.getDefaultBoolean(IPreferenceConstants.BIDI_SUPPORT);
+ textDirection = store.getDefaultString(IPreferenceConstants.TEXT_DIRECTION);
+ layoutDirectionCombo.select(getLayoutDirectionIndex(layoutDirection));
+ bidiSupportClickButton.setSelection(bidiSupport);
+ textDirectionCombo.select(getTextDirectionIndex(textDirection));
+ textDirectionCombo.setEnabled(bidiSupport);
+
+ super.performDefaults();
+ }
+
+ /**
+ * The user has pressed Ok. Store/apply this page's values appropriately.
+ */
+ public boolean performOk() {
+ IPreferenceStore store = getPreferenceStore();
+
+ store.setValue(IPreferenceConstants.NL_EXTENSIONS, nlExtensionsField.getStringValue());
+ store.setValue(IPreferenceConstants.LAYOUT_DIRECTION, layoutDirection);
+ store.setValue(IPreferenceConstants.BIDI_SUPPORT, bidiSupport);
+ store.setValue(IPreferenceConstants.TEXT_DIRECTION, textDirection);
+
+ Window.setDefaultOrientation(layoutDirection);
+ BidiUtils.setBidiSupport(bidiSupport);
+ BidiUtils.setTextDirection(textDirection.isEmpty() ? null : textDirection);
+
+ PrefUtil.savePrefs();
+ return true;
+ }
+}
+
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties
index b33462f..8cfeeeb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2013 IBM Corporation and others.
+# Copyright (c) 2000, 2014 IBM Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
@@ -505,6 +505,17 @@ WorkbenchPreference_singleClick_SelectOnHover=Select on &hover
WorkbenchPreference_singleClick_OpenAfterDelay=Open when using arrow &keys
WorkbenchPreference_noEffectOnAllViews=This preference may not take effect on all views
+# --- Globalization -----
+GlobalizationPreference_nlExtensions=&Unicode locale extensions:
+GlobalizationPreference_layoutDirection=&Graphical layout direction:
+GlobalizationPreference_bidiSupport=&Enable bidirectional support
+GlobalizationPreference_textDirection=&Text direction:
+GlobalizationPreference_defaultDirection=OS Default
+GlobalizationPreference_ltrDirection=Left to right
+GlobalizationPreference_autoDirection=Contextual
+GlobalizationPreference_rtlDirection=Right to left
+GlobalizationPreference_restartWidget=A restart is required for these preferences to take full effect.
+
# --- Fonts ---
FontsPreference_useSystemFont=&Use System Font