Community
Participate
Working Groups
We should keep track of when the RTL flag is present and make sure it gets propagated to any new shells that get created by the WBWRenderer.
I'm wondering what the correct pattern to use in e4...we have what is essentially a runtime argument ('-dir rtl') or possibly locale based value that the WBWRenderer will need access to in some manner. In the compatibility layer we could use the same mechanisms we currently do but this won't necessarily work well in pure e4 RCP apps. Perhaps we should use a tag ("RTL"?) which we apply to the MWindow to indicate this ? This way we can set the tag in the compatibility layer using the existing mechanisms while leaving the choice of how an e4 RCP apps determines the tag up to it...
(In reply to comment #1) > ... Perhaps we should use a > tag ("RTL"?) which we apply to the MWindow to indicate this ? Emm... context? Place a value in the app context "UIdirection = RTL" ?
*** Bug 340321 has been marked as a duplicate of this bug. ***
Created attachment 199525 [details] Implement RTL mode This patch implements this at the E4Applicaion model by setting a 'transientData' field based on whether or not '-dir rtl' is defined. This makes it usable by E4 applications as well...
Committed (via GIT!) in >20110712. Applied the patch.
(In reply to comment #5) > Committed (via GIT!) in >20110712. Applied the patch. Reopening as this commit has introduced over one hundred errors in our tests.
Created attachment 199829 [details] Patch to remove NPE's in the test code The tests don't all go through the E4Application protocol so they didn't have a boolean in the map. Changed the code in WBWRenderer to take this into account.
Committed in >20110718. Applied the 'tests' patch. Push ID: 85f7d92724bcf9ab1f015280f2cc88b59af75db0
Remarking as FIXED.
*** Bug 352837 has been marked as a duplicate of this bug. ***
Created attachment 207104 [details] Proposed patch In addition to the -dir option, the RTL orientation can also be triggered by setting the -nl option to a bidi language(for example -nl ar_eg). Please refer to this related bug that contains a full description for the mirroring cases w.r.t NLS Packs of the language and the machine locale -> 303889. I can see that in org.eclipse.ui.internal.WorkbenchPlugin class, the start() method sets the orientation to the "Window" via: Window.setDefaultOrientation(getDefaultOrientation()); where getDefaultOrientation() method checks the orientation from -dir and -nl args taking into account the cases mentioned in bug 303889 so I believe we should propagate the orientation from the "Window" to org.eclipse.e4.ui.internal.workbench.swt.E4Application, please find a proposed patch.(Note: The code in class org.eclipse.ui.internal.WorkbenchPlugin was already introduced as a fix for the bug: 303889)
Comment on attachment 207104 [details] Proposed patch diff --git a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/E4Application.java b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/E4Application.java index b0627c5..72aff5e 100644 --- a/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/E4Application.java +++ b/bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/E4Application.java @@ -45,6 +45,7 @@ import org.eclipse.e4.ui.internal.workbench.DefaultLoggerProvider; import org.eclipse.e4.ui.internal.workbench.E4Workbench; import org.eclipse.e4.ui.internal.workbench.ExceptionHandler; +import org.eclipse.e4.ui.internal.workbench.PlaceholderResolver; import org.eclipse.e4.ui.internal.workbench.ReflectionContributionFactory; import org.eclipse.e4.ui.internal.workbench.ResourceHandler; import org.eclipse.e4.ui.internal.workbench.WorkbenchLogger; @@ -70,6 +71,7 @@ import org.eclipse.e4.ui.workbench.lifecycle.ProcessRemovals; import org.eclipse.e4.ui.workbench.modeling.EModelService; import org.eclipse.e4.ui.workbench.modeling.EPartService; +import org.eclipse.e4.ui.workbench.modeling.EPlaceholderResolver; import org.eclipse.e4.ui.workbench.swt.internal.copy.WorkbenchSWTMessages; import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.resource.Resource; @@ -78,6 +80,7 @@ import org.eclipse.jface.databinding.swt.SWTObservables; import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.window.IShellProvider; +import org.eclipse.jface.window.Window; import org.eclipse.osgi.service.datalocation.Location; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; @@ -216,10 +219,9 @@ appContext); appModel.setContext(appContext); - String rtlMode = getArgValue(E4Workbench.RTL_MODE, applicationContext, - false); - appModel.getTransientData().put(E4Workbench.RTL_MODE, - "rtl".equals(rtlMode)); + boolean isRtl = ((Window.getDefaultOrientation() & SWT.RIGHT_TO_LEFT) != 0) ? true + : false; + appModel.getTransientData().put(E4Workbench.RTL_MODE, isRtl); 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 5c8a569..8c9b445 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 @@ -881,6 +881,22 @@ return checkCommandLineLocale(); //Use the default value if there is nothing specified } + + private Boolean isBidiMessageText() { + // Check if the user installed the NLS packs for bidi + String message = WorkbenchMessages.Startup_Loading_Workbench; + if (message == null) + return null; + try { + boolean isBidi = com.ibm.icu.text.Bidi.requiresBidi(message.toCharArray(), 0, + message.length()); + return new Boolean(isBidi); + + } catch (NoClassDefFoundError e) { + // TODO: handle exception + return null; + } + } /** * Check to see if the command line parameter for -nl @@ -903,17 +919,22 @@ //Check if the user property is set. If not do not //rely on the vm. if(System.getProperty(NL_USER_PROPERTY) == null) { - return SWT.NONE; + Boolean needRTL = isBidiMessageText(); + if (needRTL != null && needRTL.booleanValue()) + return SWT.RIGHT_TO_LEFT; + } else { + String lang = Locale.getDefault().getLanguage(); + boolean bidiLangauage = "iw".equals(lang) || "he".equals(lang) || "ar".equals(lang) || //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + "fa".equals(lang) || "ur".equals(lang); //$NON-NLS-1$ //$NON-NLS-2$ + if (bidiLangauage) { + Boolean needRTL = isBidiMessageText(); + if (needRTL == null) + return SWT.RIGHT_TO_LEFT; + if (needRTL.booleanValue()) + return SWT.RIGHT_TO_LEFT; + } } - - Locale locale = Locale.getDefault(); - String lang = locale.getLanguage(); - if ("iw".equals(lang) || "he".equals(lang) || "ar".equals(lang) || //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - "fa".equals(lang) || "ur".equals(lang)) { //$NON-NLS-1$ //$NON-NLS-2$ - return SWT.RIGHT_TO_LEFT; - } - return SWT.NONE; }
Created attachment 207275 [details] Proposed Patch Please check this patch instead of the one attached in comment 11 and ignore the comments 12&13 as I was facing problems with my GIT plug-in in eclipse, and finally I could create this patch using the command "git format-patch" via the GIT command line tool.Sorry for any inconvenience.
This bug is marked as FIXED. If this is not the case, then this bug should be reopened or the recent patches should go to a new bug.