blob: 0add0fa3440d2935a67759c4b931c62ae06d5fd0 [file]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML>
<head>
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2006. 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>Supporting bidirectional text</title>
</head>
<BODY BGCOLOR="#ffffff">
<h1>Supporting bidirectional text</h1>
<p>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.
Eclipse will recognize Hebrew, Arabic, Farsi and Urdu as bidirectional by default.</p>
<h2>Enabling Bidirectional Support</h2>
<p>The orientation of the workbench is determined in 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 <tt>eclipse.orientation</tt>
is set this will be used. The recognized values of this property are the same as
the -dir command line argument.</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.</li>
<li>Failing all of the above, the platform defaults to a left to right orientation.</li>
</ul>
<p>
In JFace, the orientation can be determined by calling
<b>org.eclipse.jface.Window#getDefaultOrientation()</b>. Standalone JFace
applications must set the default orientation by calling
<b>org.eclipse.jface.Window#setDefaultOrientation()</b>, otherwise it
will assume a default value of <b>SWT.NONE</b>. The default orientation is
set automatically when running the Workbench. All subclasses of <tt>org.eclipse.jface.Window</tt>
inherit this default orientation.</p>
<p>Views and editors inherit the window orientation from their
parent. Dialogs should inherit orientation by using the shell style of their
superclass by calling <b>super.getShellStyle()</b> when creating or configuring their shell.</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, use $nl$ in your icon path and use
the <b>org.eclipse.core.runtime.FileLocator</b> class to find icons at runtime.
</p>
<p>For example</p>
<pre>
String iconPath = &quot;$nl$/icons/myicon.gif&quot;;
URL url = FileLocator.find( Platform.getBundle(MyPluginId), new Path(iconPath), null);
Image Descriptor descriptor = ImageDescriptor.createFromURL(url);
</pre>
<p>
If the icon reference is in your <tt>plugin.xml</tt> 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.
</p>
<h2>How to choose icons to override</h2>
<p>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.</p>
</BODY></HTML>