Bug 72426 [BIDI] plan item - Proposed changes for BIDI support
(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) ... } ...
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ProgressMonitorDialog.java
}
    /*
     *  (non-Javadoc)
     * @see org.eclipse.jface.window.Window#getInitialSize()
     */
    protected Point getInitialSize() {
        Point calculatedSize = super.getInitialSize();
        if (calculatedSize.x < 450)
            calculatedSize.x = 450;
        return calculatedSize;
    }
    /**
     * Returns the progress monitor to use for operations run in this progress
     * dialog.
     * 
     * @return the progress monitor
     */
    public IProgressMonitor getProgressMonitor() {
        return progressMonitor;
    }
    /*
     * (non-Javadoc) Method declared on IRunnableContext. Runs the given <code>
     * IRunnableWithProgress </code> with the progress monitor for this progress
     * dialog. The dialog is opened before it is run, and closed after it
     * completes.
     */
    public void run(boolean fork, boolean cancelable,
            IRunnableWithProgress runnable) throws InvocationTargetException,
            InterruptedException {
        setCancelable(cancelable);