Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

New Bidi APIs

In Eclipse 3.2, new APIs were added to provide proper rendering of strings containing bidirectional text that have implicit left to right semantic meaning. The method org.eclipse.osgi.util.TextProcessor.process(String str, String delimiter) provides this function.

str 
the string to process
delimiter 
a string of characters used to segment the string.

The text of each segment has directional markers inserted at the beginning and end of it to ensure the entire string is rendered left-to-right and also has the Unicode Bidirectional algorithm applied to it in order to render the mixed text of the segment in the proper orientation.

As an example, a file path such as

  d:\myFolder\FOLDER\MYFILE.java

(where capital letters indicate RTL-oriented text) should render as

  d:\myFolder\REDLOF\ELIFYM.java

when using the Unicode Bidi algorithm and segmenting the string according to a specified delimiter set. However, since the OS does not understand that the string should be segmented according to each segment of the file path, it uses the Bidirectional algorithm to renders the string as follows:

  java.ELIFYM\REDLOF\d:\myFolder

Types of strings to which this API should be applied are:

  1. File paths (e.g. d:\myFolder\abc\DEF)
  2. URLs (e.g. http://abc/DEF )
  3. File names with extensions (e.g. ABC.java)
  4. File associations (e.g. *.java, *.ABC)

In Eclipse 3.3, there is a bug that suggests providing APIs for the most common usages so that users won't have to figure out for themselves the instances in which this API should be used (see bug 146220).

Back to the top