Supporting bidirectional text

A bidirectional language is one that can write either right to left or left to right based on context. Bidirectional text is supported throughout the platform. Per impostazione predefinita, Eclipse riconosce l'ebraico, l'arabo, il farsi e l'urdu come bidirezionali.

Enabling Bidirectional Support

The orientation of the workbench is determined in one of the following ways (in order of priority):

In JFace, the orientation can be determined by calling org.eclipse.jface.Window#getDefaultOrientation(). Standalone JFace applications must set the default orientation by calling org.eclipse.jface.Window#setDefaultOrientation(), otherwise it will assume a default value of SWT.NONE. The default orientation is set automatically when running the Workbench. All subclasses of org.eclipse.jface.Window inherit this default orientation.

Views and editors inherit the window orientation from their parent. Dialogs should inherit orientation by using the shell style of their superclass by calling super.getShellStyle() when creating or configuring their shell.

immagine bidi

Figura 1 - Immagine dell'orientamento da destra a sinistra della prospettiva Risorsa

Abilitazione del plugin per la ricerca di icone alternative

In molti casi, le icone non avrebbero senso in modalitā da destra a sinistra. In particular any icon to do with editing will have this issue.To enable lookup of images in a fragment, use $nl$ in your icon path and use the org.eclipse.core.runtime.FileLocator class to find icons at runtime.

Ad esempio

   String iconPath = "$nl$/icons/myicon.gif";
   URL url = FileLocator.find( Platform.getBundle(MyPluginId), new Path(iconPath), null);
   Image Descriptor descriptor = ImageDescriptor.createFromURL(url);

If the icon reference is in your plugin.xml file, make sure you have the $nl$ prefix on your path and the lookup will be handled for you. If you define your own extension points that involve icons, be sure to load images in the same way.

Scelta delle icone da sovrascrivere

There are no hard and fast rules for determining what icons need to be overridden in a right to left language. In general, focus on icons that imply a textual direction with a horizontal arrow.