| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML> | |
| <head> | |
| <meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2005. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." > | |
| <meta http-equiv="Content-Language" content="en-us"> | |
| <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> | |
| <link REL="STYLESHEET" HREF="../../book.css" CHARSET="ISO-8859-1" TYPE="text/css"> | |
| <title>Bidirectional Support in Eclipse</title> | |
| </head> | |
| <BODY BGCOLOR="#ffffff"> | |
| <h1>Bidirectional Support in the Eclipse Workbench</h1> | |
| <p>As of Eclipse 3.1 RC2 bidirectional support will be complete are supported | |
| in JFace and the Workbench. A bidirectional language is one that can write both | |
| right to left and left to right based on context. Eclipse will recognize Hebrew, | |
| Arabic, Farsi and Urdu as bidirectional by default.</p> | |
| <h2>Enabling Bidirectional Support in the SDK</h2> | |
| <p>The orientation of the workbench will be flipped if one of the following ways | |
| (in order of priority)</p> | |
| <ul> | |
| <li><strong>-dir command line parameter</strong>. If the -dir command line option | |
| is used this will be the default orientation. Valid values are -dir rtl or | |
| -dir ltr.</li> | |
| <li><strong>system properties</strong>. If the system property eclipse.orientation | |
| is set this will be used. The value is of the same format as -dir.</li> | |
| <li><strong>-nl command line parameter</strong>. If the -nl option is used and | |
| the language is Hebrew, Arabic, Farsi or Urdu the orientation will be right | |
| to left, otherwise it will be left to right.</li> | |
| </ul> | |
| <p>These values will be used to call org.eclipse.jface.Window#setDefaultOrientation(). | |
| All subclasses of Window and the children of those windows will get the orientation | |
| specified. The default orientation is SWT#NONE.</p> | |
| <p>Views and editors will by default inherit the window orientation from their | |
| parent. Dialogs should inherit orientation by using the shellStyle of their | |
| parent when setting their own by calling super#getShellStyle.</p> | |
| <p><img src="bidi.png" alt="bidi image"></p> | |
| <p><strong>Figure 1 - Screen shot of right to left orientation of the resource | |
| perspective</strong></p> | |
| <h2>Enabling your plug-in for looking up alternate icons</h2> | |
| <p>In many cases your icons will not make any sense in right to left mode. In | |
| particular any icon to do with editing will have this issue.To enable lookup | |
| of images in a fragment all you need to do to nl enable $nl$ in your path and | |
| use the Platform bundle support to lookup the icons file.</p> | |
| <p>For example</p> | |
| <p>String iconPath = "$nl$/icons/myicon.gif";</p> | |
| <p>URL url = Platform.find( Platform.getBundle(MyPluginId), new Path(iconPath));</p> | |
| <p>Image Descriptor descriptor = ImageDescriptor.createFromURL(url);</p> | |
| <p>If the icon reference is in your plugin.xml just make sure you have the $nl$ | |
| prefix on your path. If it is an extension point defined by the workbench the | |
| lookup will be handled for you. Just make sure if you create your own extension | |
| point that it loads ImageDescriptors this way.</p> | |
| <h2>How to choose icons to override</h2> | |
| <p>There is no hard and fast rules for choosing which icons to override but in | |
| general you should focus on the icons that imply a textual direction with a | |
| horizontal arrow.</p> | |
| </BODY></HTML> |