diff options
Diffstat (limited to 'bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java')
-rw-r--r-- | bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java | 62 |
1 files changed, 62 insertions, 0 deletions
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 eb1898df16d..6550ebfe34e 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 @@ -33,6 +33,7 @@ import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.preference.PreferenceManager; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.jface.util.BidiUtils; import org.eclipse.jface.window.Window; import org.eclipse.osgi.service.debug.DebugOptions; import org.eclipse.swt.SWT; @@ -65,6 +66,7 @@ import org.eclipse.ui.internal.themes.IThemeRegistry; import org.eclipse.ui.internal.themes.ThemeRegistry; import org.eclipse.ui.internal.themes.ThemeRegistryReader; import org.eclipse.ui.internal.util.BundleUtility; +import org.eclipse.ui.internal.util.Util; import org.eclipse.ui.internal.wizards.ExportWizardRegistry; import org.eclipse.ui.internal.wizards.ImportWizardRegistry; import org.eclipse.ui.internal.wizards.NewWizardRegistry; @@ -121,6 +123,10 @@ public class WorkbenchPlugin extends AbstractUIPlugin { private static final String ORIENTATION_COMMAND_LINE = "-dir";//$NON-NLS-1$ private static final String ORIENTATION_PROPERTY = "eclipse.orientation";//$NON-NLS-1$ private static final String NL_USER_PROPERTY = "osgi.nl.user"; //$NON-NLS-1$ + private static final String BIDI_COMMAND_LINE = "-bidi";//$NON-NLS-1$ + private static final String BIDI_SUPPORT_OPTION = "on";//$NON-NLS-1$ + private static final String BIDI_TEXTDIR_OPTION = "textDir";//$NON-NLS-1$ + // Default instance of the receiver private static WorkbenchPlugin inst; @@ -841,6 +847,7 @@ public class WorkbenchPlugin extends AbstractUIPlugin { JFaceUtil.initializeJFace(); + parseBidiArguments(); Window.setDefaultOrientation(getDefaultOrientation()); // The UI plugin needs to be initialized so that it can install the callback in PrefUtil, @@ -866,6 +873,61 @@ public class WorkbenchPlugin extends AbstractUIPlugin { } /** + * Read the -bidi option from the command line arguments. The valid values / + * syntax is as follows: + * + * <pre> + * -bidi "on=[y/n];textDir=[ltr/rtl/auto]" + * </pre> + * <p> + * Important: + * <ul> + * <li>The order of parameters under the <code>-bidi</code> switch is + * arbitrary.</li> + * <li>The presence of any parameter is not mandatory.</li> + * <li>If any of the parameters is not specified, the default value is + * assumed. Defaults: + * <ul> + * <li>on: n</li> + * <li>textDir: no default value</li> + * </ul> + * </li> + * <li>If no value (or an illegal value) is provided for handling of base + * text direction functionality, then bidi support is turned off and no + * handling occurs.</li> + * </ul> + */ + private void parseBidiArguments() { + String[] commandLineArgs = Platform.getCommandLineArgs(); + String bidiParams = null; + // Do not process the last one as it will never have a parameter + for (int i = 0; i < commandLineArgs.length - 1; i++) { + if (commandLineArgs[i].equals(BIDI_COMMAND_LINE)) { + bidiParams = commandLineArgs[i + 1]; + } + } + if (bidiParams != null) { + String[] bidiProps = Util.getArrayFromList(bidiParams, ";"); //$NON-NLS-1$ + for (int i = 0; i < bidiProps.length; ++i) { + int eqPos = bidiProps[i].indexOf("="); //$NON-NLS-1$ + if ((eqPos > 0) && (eqPos < bidiProps[i].length() - 1)) { + String nameProp = bidiProps[i].substring(0, eqPos); + String valProp = bidiProps[i].substring(eqPos + 1); + if (nameProp.equals(BIDI_SUPPORT_OPTION)) { + BidiUtils.setBidiSupport("y".equals(valProp)); //$NON-NLS-1$ + } else if (nameProp.equalsIgnoreCase(BIDI_TEXTDIR_OPTION)) { + try { + BidiUtils.setTextDirection(valProp.intern()); + } catch (IllegalArgumentException e) { + WorkbenchPlugin.log(e); + } + } + } + } + } + } + + /** * Get the default orientation from the command line * arguments. If there are no arguments imply the * orientation. |