Project: Eclipse_Platform_UI
Bug 72426 [BIDI] plan item - Proposed changes for BIDI support
Reported: 2004-08-23 08:57:52 | Status: verified fixed

(Nick I have cc'ed you as some of these changes are going into the WorkbenchAdvisor). Suggestions from Alex Benish and Simeon Semion Chichelnitsky (IBM Israel) Orientation of components, which are based on JFace Window (windows, including ApplicationWindow and even WorkbenchWindow, dialogs, wizards) can be set before creating their internal Shells by existing API - using method setShellStyle(). Orientation of WorkbenchWindow can be determined by one of the following options: by adding additional "orientation" property in the global property file (like eclipse.ini or config.ini). Its value can be set as application (system) property and will be handled in the corresponding place. by checking the language of the default locale (which is set in Eclipse in accordance with "-nl" parameter of Eclipse executable). The similar checking is done in IBM JDK 1.4.1 (see ComponentOrientation.getOrientation(Locale locale)). In addition, we can use existing parameter "-DIR", which is currently used to set orientation of Help system UI. Orientation of workbench can be set in the WorkbenchAdvisor.preWindowOpen() method (in this case subclasses of WorkbenchAdvisor can call this method from their superclass). Orientation of JFace viewers , which are used as wrappers for corresponding SWT components, can be set by some existing constructors. For example, org.eclipse.jface.viewer.TreeViewer, which is based on an SWT Tree control, has 3 constructors: TreeViewer(Composite parent), which creates Tree with some default SWT styles. When this constructor is used, orientation is inherited from parent. TreeViewer(Composite parent, int style), which creates Tree with explicitly assigned SWT styles (one of them can be orientation style) TreeViewer(Tree tree), which is built on the given Tree control. Orientation of Tree control can be set previously. I think, we need additional possibility to set orientation not only on the WorkbenchWindow level, but on the level of WorkbenchPart. Some additional APIs are needed to create view or editior with explicitly assigned orientation. org.eclipse.ui.application.WorkbenchAdvisor ... public void preWindowOpen(IWorkbenchWindowConfigurer configurer) { configurer.setShellStyle(configurer.getShellStyle() | getWorkbenchOrientation()); } ... protected int getWorkbenchOrientation() { Locale locale = Locale.getDefault(); String lang = locale.getLanguage(); if ("iw".equals(lang) || "ar".equals(lang) || "fa".equals(lang) || "ur".equals(lang)) return SWT.RIGHT_TO_LEFT; else return SWT.LEFT_TO_RIGHT; } ... org.eclipse.ui.IWorkbenchPart ... public int getPartOrientation(); public void setPartOrientation(int orientation); public Locale getPartLocale(); public void setPartLocale(Locale locale); //Gives to Part ability to use different ResourceBundles ... org.eclipse.ui.part.WorkbenchPart ... private int orientation = SWT.NONE; //Orientation will be inherited private Locale locale = null; //Locale of Part is the same, as default locale ... public int getPartOrientation() { return orientation; } public void setPartOrientation(int orientation) { this.orientation = orientation; } public Locale getPartLocale() { if (locale == null) return Locale.getDefault(); else return locale; } public void setPartLocale(locale locale) { this.locale = locale; if (orientation == SWT.NONE) { String lang = locale.getLanguage(); if ("iw".equals(lang) || "ar".equals(lang) || "fa".equals (lang) || "ur".equals(lang)) setPartOrientation(SWT.RIGHT_TO_LEFT); else setPartOrientation(SWT.LEFT_TO_RIGHT); } } ... org.eclipse.ui.part.EditorPart ... protected EditorPart() { super(); setPartOrientation (SWT.LEFT_TO_RIGHT); //Orientation of editors shouldn't be inherited. RTL orientation can be explicitly assigned in subclasses. } ... org.eclipse.ui.internal.PartPane ... protected void createChildControl() { ... int contentOrientation = part[0].getPartOrientation(); final Composite content = new Composite(control, contentOrientation); //If contentOrientation == SWT.NONE, orientation is inherited from parent // (actually - from Shell of WorkbenchWindow) ... } ...

Files changed in fix:
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/Dialog.java bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ErrorDialog.java bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ProgressMonitorDialog.java bundles/org.eclipse.jface/src/org/eclipse/jface/window/Window.java bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardDialog.java bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/IDEWorkbenchAdvisor.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DetachedWindow.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindowConfigurer.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutFeaturesDialog.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutPluginsDialog.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutSystemDialog.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/BlockedJobsDialog.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/progress/ErrorNotificationDialog.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/EditorPart.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/WorkbenchPart.java