Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 199855 Details for
Bug 183164
[Implementation for] Display of Complex Expressions Containing Bidirectional Text
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch - minor API changes and initial Javadoc cleanup
bidi patch.txt (text/plain), 134.85 KB, created by
Oleg Besedin
on 2011-07-18 14:23:33 EDT
(
hide
)
Description:
Patch - minor API changes and initial Javadoc cleanup
Filename:
MIME Type:
Creator:
Oleg Besedin
Created:
2011-07-18 14:23:33 EDT
Size:
134.85 KB
patch
obsolete
>From 505db885a3cc29e925aa9e42f52cc5e4f0b5f194 Mon, 18 Jul 2011 14:20:45 -0400 >From: Oleg Besedin <obesedin@ca.ibm.com> >Date: Mon, 18 Jul 2011 14:19:42 -0400 >Subject: [PATCH] Bug 183164 - [Implementation for] Display of Complex Expressions Containing Bidirectional Text > >diff --git a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextExtensionsTest.java b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextExtensionsTest.java >index 753361e..b7486eb 100644 >--- a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextExtensionsTest.java >+++ b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextExtensionsTest.java >@@ -11,8 +11,8 @@ > > package org.eclipse.equinox.bidi.internal.tests; > >-import java.util.Locale; > import org.eclipse.equinox.bidi.STextEngine; >+import org.eclipse.equinox.bidi.STextEnvironment; > import org.eclipse.equinox.bidi.custom.STextProcessor; > > /** >@@ -21,24 +21,28 @@ > > public class STextExtensionsTest extends STextTestBase { > >+ STextEnvironment env = STextEnvironment.DEFAULT; >+ STextEnvironment envArabic = new STextEnvironment("ar", false, STextEnvironment.ORIENT_LTR); >+ STextEnvironment envHebrew = new STextEnvironment("he", false, STextEnvironment.ORIENT_LTR); >+ > STextProcessor processor; > int[] state = new int[1]; > > private void doTest1(String label, String data, String result) { > String full; >- full = STextEngine.leanToFullText(processor, null, toUT16(data), state); >+ full = STextEngine.leanToFullText(processor, env, toUT16(data), state); > assertEquals(label + " data = " + data, result, toPseudo(full)); > } > > private void doTest2(String label, String data, String result) { > String full; >- full = STextEngine.leanToFullText(processor, null, data, state); >+ full = STextEngine.leanToFullText(processor, env, data, state); > assertEquals(label + " data = " + data, result, toPseudo(full)); > } > > private void doTest3(String label, String data, String result) { > String full; >- full = STextEngine.leanToFullText(processor, null, toUT16(data), state); >+ full = STextEngine.leanToFullText(processor, env, toUT16(data), state); > assertEquals(label + " data = " + data, result, toPseudo(full)); > } > >@@ -47,6 +51,7 @@ > String data; > processor = STextEngine.PROC_COMMA_DELIMITED; > state[0] = STextEngine.STATE_INITIAL; >+ > doTest1("Comma #1", "ab,cd, AB, CD, EFG", "ab,cd, AB@, CD@, EFG"); > > processor = STextEngine.PROC_EMAIL; >@@ -55,13 +60,13 @@ > doTest1("Email #2", "DEF.GHI \"A.B\":JK ", "DEF@.GHI @\"A.B\"@:JK "); > doTest1("Email #3", "DEF,GHI (A,B);JK ", "DEF@,GHI @(A,B)@;JK "); > doTest1("Email #4", "DEF.GHI (A.B :JK ", "DEF@.GHI @(A.B :JK "); >- Locale.setDefault(new Locale("ar")); >+ env = envArabic; > doTest1("Email #5", "#EF.GHI \"A.B\":JK ", "<&#EF.GHI \"A.B\":JK &^"); > doTest1("Email #6", "#EF,GHI (A,B);JK ", "<&#EF,GHI (A,B);JK &^"); > doTest1("Email #7", "#EF.GHI (A.B :JK ", "<&#EF.GHI (A.B :JK &^"); > data = toUT16("peter.pan") + "@" + toUT16("#EF.GHI"); > doTest2("Email #8", data, "<&peter&.pan@#EF.GHI&^"); >- Locale.setDefault(new Locale("he")); >+ env = envHebrew; > data = toUT16("peter.pan") + "@" + toUT16("DEF.GHI"); > doTest2("Email #9", data, "peter.pan@DEF@.GHI"); > >@@ -134,7 +139,7 @@ > doTest1("Regex #17.6", "aB*123", "aB*@123"); > doTest1("Regex #17.7", "aB*567", "aB*@567"); > >- Locale.setDefault(new Locale("ar")); >+ env = envArabic; > data = toUT16("#BC(?") + "#" + toUT16("DEF)GHI"); > doTest2("Regex #0.0", data, "<&#BC(?#DEF)GHI&^"); > data = toUT16("#BC(?") + "#" + toUT16("DEF"); >@@ -170,7 +175,7 @@ > doTest2("Regex #16.1", data, "<&#BC\\qDEF&^"); > data = toUT16("#HI") + "\\E" + toUT16("JKL"); > doTest2("Regex #16.2", data, "<&#HI\\eJKL&^"); >- Locale.setDefault(new Locale("he")); >+ env = envHebrew; > > processor = STextEngine.PROC_SQL; > state[0] = STextEngine.STATE_INITIAL; >diff --git a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextMathTest.java b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextMathTest.java >index ab836bf..b334e5a 100644 >--- a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextMathTest.java >+++ b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextMathTest.java >@@ -11,7 +11,6 @@ > > package org.eclipse.equinox.bidi.internal.tests; > >-import java.util.Locale; > import org.eclipse.equinox.bidi.STextEngine; > import org.eclipse.equinox.bidi.STextEnvironment; > import org.eclipse.equinox.bidi.custom.STextProcessor; >@@ -21,8 +20,8 @@ > */ > public class STextMathTest extends STextTestBase { > >- static final STextEnvironment envLTR = new STextEnvironment(null, false, STextEnvironment.ORIENT_LTR); >- static final STextEnvironment envRTL = new STextEnvironment(null, false, STextEnvironment.ORIENT_RTL); >+ static final STextEnvironment envLTR = new STextEnvironment("ar", false, STextEnvironment.ORIENT_LTR); >+ static final STextEnvironment envRTL = new STextEnvironment("ar", false, STextEnvironment.ORIENT_RTL); > > STextProcessor processor = STextEngine.PROC_RTL_ARITHMETIC; > >@@ -40,13 +39,13 @@ > verifyOneLine("Math #2", "2+ABC-DEF", "2+ABC@-DEF", ">@2+ABC@-DEF@^"); > verifyOneLine("Math #3", "A+3*BC/DEF", "A@+3*BC@/DEF", ">@A@+3*BC@/DEF@^"); > verifyOneLine("Math #4", "4+ABC/DEF", "4+ABC@/DEF", ">@4+ABC@/DEF@^"); >- Locale.setDefault(new Locale("ar")); >+ > verifyOneLine("Math #5", "5#BC", "<&5#BC&^", "5#BC"); > verifyOneLine("Math #6", "6#BC-DE", "<&6#BC-DE&^", "6#BC-DE"); > verifyOneLine("Math #7", "7#BC+DE", "<&7#BC+DE&^", "7#BC+DE"); > verifyOneLine("Math #8", "8#BC*DE", "<&8#BC*DE&^", "8#BC*DE"); > verifyOneLine("Math #9", "9#BC/DE", "<&9#BC/DE&^", "9#BC/DE"); > verifyOneLine("Math #10", "10ab+cd-ef", "10ab+cd-ef", ">@10ab+cd-ef@^"); >- Locale.setDefault(new Locale("he")); >+ > } > } >diff --git a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextSomeMoreTest.java b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextSomeMoreTest.java >index cbea79a..88d89b3 100644 >--- a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextSomeMoreTest.java >+++ b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextSomeMoreTest.java >@@ -64,8 +64,8 @@ > } > > public void testSomeMore() { >- assertFalse(env1.isBidi()); >- assertTrue(env2.isBidi()); >+ assertFalse(env1.isProcessingNeeded()); >+ assertTrue(env2.isProcessingNeeded()); > > STextProcessor processor = new Processor1(); > String full = STextEngine.leanToFullText(processor, env1, "abcd", null); >diff --git a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextUtilTest.java b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextUtilTest.java >index 2b4fe77..385f8c6 100644 >--- a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextUtilTest.java >+++ b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextUtilTest.java >@@ -60,7 +60,7 @@ > assertEquals("Util #1 full UR - ", result, toPseudo(full)); > Locale.setDefault(new Locale(HEBREW)); > full = STextUtil.process(toUT16(data)); >- String ful2 = STextUtil.process(toUT16(data), null); >+ String ful2 = STextUtil.process(toUT16(data), (String) null); > assertEquals("Util #1 full - ", result, toPseudo(full)); > assertEquals("Util #1 ful2 - ", result, toPseudo(ful2)); > String lean = STextUtil.deprocess(full); >@@ -83,7 +83,7 @@ > } > > private void doTest3(String msg, String data, String result, String resLean) { >- String full = STextUtil.processTyped(toUT16(data), STextEngine.PROC_COMMA_DELIMITED); >+ String full = STextUtil.process(toUT16(data), STextEngine.PROC_COMMA_DELIMITED); > assertEquals(msg + "full", result, toPseudo(full)); > String lean = STextUtil.deprocess(full, STextEngine.PROC_COMMA_DELIMITED); > assertEquals(msg + "lean", resLean, toPseudo(lean)); >diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/STextEngine.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/STextEngine.java >index 3d05bf8..e2cc528 100644 >--- a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/STextEngine.java >+++ b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/STextEngine.java >@@ -15,100 +15,66 @@ > import org.eclipse.equinox.bidi.internal.STextImpl; > > /** >- * This class acts as a mediator between applications and structured text >- * processors. >- * The purpose of structured text processors is to add directional >- * formatting characters to ensure correct display. >- * This class shields applications from the >- * intricacies of structured text processors. >- * <p> >- * For a general introduction to structured text, see >- * {@link <a href="package-summary.html"> >- * the package documentation</a>}. >- * >- * <h2><a name="processor">How to Specify a Processor</a></h2> >- * >- * <p>All the methods in this class have a first argument which >- * designates a processor. >- * >- * <p>It must be specified as an instance of {@link STextProcessor}. >- * Pre-defined instances are included in <b>STextEngine</b> for all >- * the types of structured text supported by this package. >- * >- * <p>For processors supplied by other packages, a processor instance >- * can be obtained using the >- * {@link org.eclipse.equinox.bidi.custom.STextStringProcessor#getProcessor getProcessor} >- * method for the registered processors, or by instantiating a private processor. >- * >- * <p>Specifying <code>null</code> for the processor as first argument >- * of a method causes this method to behave as a no-op. >- * >- * <h2><a name="state">State</a></h2> >- * >- * <p>Most of the methods in this class have a <code>text</code> >- * argument which may be just a part of a larger body of text. >- * When it is the case that the text is submitted in parts with >- * repeated calls, there may be a need to pass information from >- * one invocation to the next one. For instance, one invocation >- * may detect that a comment or a literal has been started but >- * has not been completed. In such cases, a <code>state</code> >- * argument must be used. >- * >- * <p>The <code>state</code> argument must be an array of integers >- * with at least one element. Only the first element is used by >- * the methods of this class. >- * >- * <p>When submitting the initial part of the text, the first element >- * of <code>state</code> must contain the value {@link #STATE_INITIAL} >- * or any value <= 0. >- * >- * <p>After calling a method with a non-null <code>state</code> argument, >- * a value is returned in the first element of <code>state</code>. This >- * value should be passed unmodified to the method when calling it again >- * with the text which is the continuation of the text submitted in the >- * last call. >- * >- * <p>When the text submitted to a method is not a continuation and is not >- * expected to have a continuation , e.g. it is processed all by itself, >- * the <code>state</code> argument should be specified as <code>null</code>. >- * >- * <h2>Code Samples</h2> >- * >- * <p>The following code shows how to transform a certain type of structured text >- * (directory and file paths) in order to obtain the <i>full</i> >- * text corresponding to the given <i>lean</i> text. >- * >- * <pre> >- * >- * String leanText = "D:\\\u05d0\u05d1\\\u05d2\\\u05d3.ext"; >- * String fullText = STextEngine.leanToFullText(STextEngine.PROC_FILE, null, leanText, null); >- * System.out.println("full text = " + fullText); >- * >- * </pre> >- * >- * <p>The following code shows how to transform successive lines of Java >- * code in order to obtain the <i>full</i> >- * text corresponding to the <i>lean</i> text of each line. >- * >- * <pre> >- * >- * int[] state = new int[1]; >- * state[0] = STextEngine.STATE_INITIAL; >- * String leanText = "int i = 3; // first Java statement"; >- * String fullText = STextEngine.leanToFullText(STextEngine.PROC_JAVA, null, leanText, state); >- * System.out.println("full text = " + fullText); >- * leanText = "i += 4; // next Java statement"; >- * fullText = STextEngine.leanToFullText(STextEngine.PROC_JAVA, null, leanText, state); >- * System.out.println("full text = " + fullText); >- * >- * </pre> >- * >- * <p>This class provides a user-oriented API but does not provide >- * an actual implementation. The real work is done by the class >- * {@link STextImpl}. Users of the API need not be concerned by, and >- * should not depend upon, details of the implementation in >- * <code>STextImpl</code>. >- * >+ * For a general introduction to structured text, see >+ * {@link <a href="package-summary.html"> the package documentation</a>}. >+ * <p> >+ * Several common processors are included in <b>STextEngine</b>. For processors >+ * supplied by other packages, a processor instance can be obtained using the >+ * {@link org.eclipse.equinox.bidi.custom.STextStringProcessor#getProcessor} >+ * method for the registered processors, or by instantiating a private processor. >+ * </p><p> >+ * Most of the methods in this class have a <code>text</code> >+ * argument which may be just a part of a larger body of text. >+ * When it is the case that the text is submitted in parts with >+ * repeated calls, there may be a need to pass information from >+ * one invocation to the next one. For instance, one invocation >+ * may detect that a comment or a literal has been started but >+ * has not been completed. In such cases, a <code>state</code> >+ * argument must be used. >+ * </p><p> >+ * The <code>state</code> argument must be an array of integers >+ * with at least one element. Only the first element is used by >+ * the methods of this class. >+ * </p><p> >+ * When submitting the initial part of the text, the first element >+ * of <code>state</code> must contain the value {@link #STATE_INITIAL} >+ * or any value <= 0. >+ * </p><p> >+ * After calling a method with a non-null <code>state</code> argument, >+ * a value is returned in the first element of <code>state</code>. This >+ * value should be passed unmodified to the method when calling it again >+ * with the text which is the continuation of the text submitted in the >+ * last call. >+ * </p><p> >+ * When the text submitted to a method is not a continuation and is not >+ * expected to have a continuation , e.g. it is processed all by itself, >+ * the <code>state</code> argument should be specified as <code>null</code>. >+ * </p><p> >+ * <b>Code Samples</b> >+ * </p><p> >+ * The following code shows how to transform a certain type of structured text >+ * (directory and file paths) in order to obtain the <i>full</i> >+ * text corresponding to the given <i>lean</i> text. >+ * <pre> >+ * String leanText = "D:\\\u05d0\u05d1\\\u05d2\\\u05d3.ext"; >+ * String fullText = STextEngine.leanToFullText(STextEngine.PROC_FILE, null, leanText, null); >+ * System.out.println("full text = " + fullText); >+ * </pre> >+ * </p><p> >+ * The following code shows how to transform successive lines of Java >+ * code in order to obtain the <i>full</i> >+ * text corresponding to the <i>lean</i> text of each line. >+ * <pre> >+ * int[] state = new int[1]; >+ * state[0] = STextEngine.STATE_INITIAL; >+ * String leanText = "int i = 3; // first Java statement"; >+ * String fullText = STextEngine.leanToFullText(STextEngine.PROC_JAVA, null, leanText, state); >+ * System.out.println("full text = " + fullText); >+ * leanText = "i += 4; // next Java statement"; >+ * fullText = STextEngine.leanToFullText(STextEngine.PROC_JAVA, null, leanText, state); >+ * System.out.println("full text = " + fullText); >+ * </pre> >+ * </p> > * @author Matitiahu Allouche > * > */ >@@ -237,35 +203,25 @@ > // nothing to do > } > >- /** Add directional formatting characters to a structured text >- * to ensure correct presentation. >+ /** >+ * Add directional formatting characters to a structured text >+ * to ensure correct presentation. >+ * >+ * @param processor the processor applicable to the text. If <code>null</code>, >+ * the method returns unmodified text. >+ * >+ * @param environment a bidi environment. If <code>null</code>, the default environment >+ * is used. >+ * >+ * @param text is the structured text string > * >- * @param processor designates a processor instance. >- * For more details, see above <a href="#processor"> >- * How to Specify a Processor</a>. >- * <p>If this argument is <code>null</code>, this method >- * returns the <code>text</code> string. >+ * @param state can be used to specify that the <code>text</code> argument is >+ * the continuation of text submitted in a previous call and/or to receive information >+ * to pass to continuation calls. If all calls to this method are independent from one another, >+ * this argument should be specified as <code>null</code>. > * >- * @param environment specifies an environment whose characteristics >- * may affect the processor's behavior. >- * <p>This argument may be specified as <code>null</code>, >- * in which case the processor will assume a standard >- * environment as specified in >- * {@link STextEnvironment#DEFAULT}. >- * >- * @param text is the structured text string. >- * >- * @param state can be used to specify that the <code>text</code> >- * argument is the continuation of text submitted in a >- * previous call and/or to receive information to pass to >- * continuation calls. >- * For more details, see <a href="#state">State</a> above. >- * <p>If all calls to this method are independent from one another, >- * this argument should be specified as <code>null</code>. >- * >- * @return the structured text with directional formatting >- * characters added at proper locations to ensure correct >- * presentation. >+ * @return the structured text with directional formatting characters added to ensure >+ * correct presentation. > */ > public static String leanToFullText(STextProcessor processor, STextEnvironment environment, String text, int[] state) { > if (processor == null) >@@ -274,35 +230,24 @@ > } > > /** >- * Given a <i>lean</i> string, compute the positions of each of its >- * characters within the corresponding <i>full</i> string. >+ * Given a <i>lean</i> string, compute the positions of each of its >+ * characters within the corresponding <i>full</i> string. > * >- * @param processor designates a processor instance. >- * For more details, see above <a href="#processor"> >- * How to Specify a Processor</a>. >- * <p>If this argument is <code>null</code>, this method >- * returns an identity map. >+ * @param processor designates a processor instance. If <code>null</code>, this >+ * method returns an identity map. > * >- * @param environment specifies an environment whose characteristics >- * may affect the processor's behavior. >- * <p>This argument may be specified as <code>null</code>, >- * in which case the processor will assume a standard >- * environment as specified in >- * {@link STextEnvironment#DEFAULT}. >+ * @param environment specifies an environment whose characteristics may affect >+ * the processor's behavior. If <code>null</code>, the default environment is used. > * >- * @param text is the structured text string. >+ * @param text is the structured text string. > * >- * @param state can be used to specify that the <code>text</code> >- * argument is the continuation of text submitted in a >- * previous call and/or to receive information to pass to >- * continuation calls. >- * For more details, see <a href="#state">State</a> above. >- * <p>If all calls to this method are independent from one another, >- * this argument should be specified as <code>null</code>. >+ * @param state can be used to specify that the <code>text</code> argument is >+ * the continuation of text submitted in a previous call and/or to receive information >+ * to pass to continuation calls. If all calls to this method are independent from one another, >+ * this argument should be specified as <code>null</code>. > * >- * @return an array of integers with one element for each of the characters >- * in the <code>text</code> argument, equal to the offset of the >- * corresponding character in the <i>full</i> string. >+ * @return an array which specifies offsets of the <code>text</code> characters >+ * in the <i>full</i> string > */ > public static int[] leanToFullMap(STextProcessor processor, STextEnvironment environment, String text, int[] state) { > if (processor == null) { >@@ -315,43 +260,31 @@ > } > > /** >- * Given a <i>lean</i> string, compute the offsets of characters >- * before which directional formatting characters must be added >- * in order to ensure correct presentation. >+ * Given a <i>lean</i> string, compute the offsets of characters >+ * before which directional formatting characters must be added >+ * in order to ensure correct presentation. >+ * <p> >+ * Only LRMs (for a string with LTR base direction) and RLMs (for >+ * a string with RTL base direction) are considered. Leading and >+ * trailing LRE, RLE and PDF which might be prefixed or suffixed >+ * depending on the {@link STextEnvironment#getOrientation orientation} of the >+ * GUI component used for display are not reflected in this method. >+ * </p> >+ * @param processor designates a processor instance > * >- * <p>Only LRMs (for a string with LTR base direction) and RLMs (for >- * a string with RTL base direction) are considered. Leading and >- * trailing LRE, RLE and PDF which might be prefixed or suffixed >- * depending on the {@link STextEnvironment#getOrientation orientation} of the >- * GUI component used for display are not reflected in this method. >+ * @param environment specifies an environment whose characteristics may affect >+ * the processor's behavior. If <code>null</code>, the default environment is used. > * >- * @param processor designates a processor instance. >- * For more details, see above <a href="#processor"> >- * How to Specify a Processor</a>. >- * <p>If this argument is <code>null</code>, this method >- * returns an empty array. >+ * @param text is the structured text string > * >- * @param environment specifies an environment whose characteristics >- * may affect the processor's behavior. >- * <p>This argument may be specified as <code>null</code>, >- * in which case the processor will assume a standard >- * environment as specified in >- * {@link STextEnvironment#DEFAULT}. >+ * @param state can be used to specify that the <code>text</code> argument is >+ * the continuation of text submitted in a previous call and/or to receive information >+ * to pass to continuation calls. If all calls to this method are independent from one another, >+ * this argument should be specified as <code>null</code>. > * >- * @param text is the structured text string. >- * >- * @param state can be used to specify that the <code>text</code> >- * argument is the continuation of text submitted in a >- * previous call and/or to receive information to pass to >- * continuation calls. >- * For more details, see <a href="#state">State</a> above. >- * <p>If all calls to this method are independent from one another, >- * this argument should be specified as <code>null</code>. >- * >- * @return an array of offsets to the characters in the <code>text</code> >- * argument before which directional marks must be >- * added to ensure correct presentation. >- * The offsets are sorted in ascending order. >+ * @return an array of offsets to the characters in the <code>text</code> argument >+ * before which directional marks must be added to ensure correct presentation. >+ * The offsets are sorted in ascending order. > */ > public static int[] leanBidiCharOffsets(STextProcessor processor, STextEnvironment environment, String text, int[] state) { > if (processor == null) >@@ -360,36 +293,23 @@ > } > > /** >- * Remove directional formatting characters which were added to a >- * structured text string to ensure correct presentation. >+ * Remove directional formatting characters which were added to a >+ * structured text string to ensure correct presentation. > * >- * @param processor designates a processor instance. >- * For more details, see above <a href="#processor"> >- * How to Specify a Processor</a>. >- * <p>If this argument is <code>null</code>, this method >- * returns the <code>text</code> string. >+ * @param processor designates a processor instance > * >- * @param environment specifies an environment whose characteristics >- * may affect the processor's behavior. >- * <p>This argument may be specified as <code>null</code>, >- * in which case the processor will assume a standard >- * environment as specified in >- * {@link STextEnvironment#DEFAULT}. >+ * @param environment specifies an environment whose characteristics may affect >+ * the processor's behavior. If <code>null</code>, the default environment is used. > * >- * @param text is the structured text string including >- * directional formatting characters. >+ * @param text is the structured text string including directional formatting characters. > * >- * @param state can be used to specify that the <code>text</code> >- * argument is the continuation of text submitted in a >- * previous call and/or to receive information to pass to >- * continuation calls. >- * For more details, see <a href="#state">State</a> above. >- * <p>If all calls to this method are independent from one another, >- * this argument should be specified as <code>null</code>. >+ * @param state can be used to specify that the <code>text</code> argument is >+ * the continuation of text submitted in a previous call and/or to receive information >+ * to pass to continuation calls. If all calls to this method are independent from one another, >+ * this argument should be specified as <code>null</code>. > * >- * @return the structured text string without directional formatting >- * characters which might have been added by processing it >- * with {@link #leanToFullText leanToFullText}. >+ * @return the structured text string without directional formatting characters >+ * which might have been added by processing it with {@link #leanToFullText}. > * > */ > public static String fullToLeanText(STextProcessor processor, STextEnvironment environment, String text, int[] state) { >@@ -399,41 +319,26 @@ > } > > /** >- * Given a <i>full</i> string, compute the positions of each of its >- * characters within the corresponding <i>lean</i> string. >+ * Given a <i>full</i> string, compute the positions of each of its >+ * characters within the corresponding <i>lean</i> string. > * >- * @param processor designates a processor instance. >- * For more details, see above <a href="#processor"> >- * How to Specify a Processor</a>. >- * <p>If this argument is <code>null</code>, this method >- * returns an identity map. >+ * @param processor designates a processor instance > * >- * @param environment specifies an environment whose characteristics >- * may affect the processor's behavior. >- * <p>This argument may be specified as <code>null</code>, >- * in which case the processor will assume a standard >- * environment as specified in >- * {@link STextEnvironment#DEFAULT}. >+ * @param environment specifies an environment whose characteristics may affect >+ * the processor's behavior. If <code>null</code>, the default environment is used. > * >- * @param text is the structured text string including >- * directional formatting characters. >+ * @param text is the structured text string including directional formatting characters. > * >- * @param state can be used to specify that the <code>text</code> >- * argument is the continuation of text submitted in a >- * previous call and/or to receive information to pass to >- * continuation calls. >- * For more details, see <a href="#state">State</a> above. >- * <p>If all calls to this method are independent from one another, >- * this argument should be specified as <code>null</code>. >+ * @param state can be used to specify that the <code>text</code> argument is >+ * the continuation of text submitted in a previous call and/or to receive information >+ * to pass to continuation calls. If all calls to this method are independent from one another, >+ * this argument should be specified as <code>null</code>. > * >- * @return an array of integers with one element for each of the characters >- * in the <code>text</code> argument, equal to the offset of the >- * corresponding character in the <i>lean</i> string. >- * If there is no corresponding >- * character in the <i>lean</i> string (because the >- * specified character is a directional formatting character >- * added when invoking {@link #leanToFullText leanToFullText}), >- * the value returned for this character is -1. >+ * @return an array of integers with one element for each of the characters >+ * in the <code>text</code> argument, equal to the offset of the corresponding character >+ * in the <i>lean</i> string. If there is no corresponding character in the <i>lean</i> string >+ * (because the specified character is a directional formatting character added when invoking >+ * {@link #leanToFullText}), the value returned for this character is -1. > */ > public static int[] fullToLeanMap(STextProcessor processor, STextEnvironment environment, String text, int[] state) { > if (processor == null) { >@@ -446,44 +351,30 @@ > } > > /** >- * Given a <i>full</i> string, return the offsets of characters >- * which are directional formatting characters that have been added >- * in order to ensure correct presentation. >+ * Given a <i>full</i> string, return the offsets of characters >+ * which are directional formatting characters that have been added >+ * in order to ensure correct presentation. >+ * <p> >+ * LRMs (for a string with LTR base direction), RLMs (for a string with RTL base direction) >+ * are considered as well as leading and trailing LRE, RLE and PDF which might be prefixed >+ * or suffixed depending on the {@link STextEnvironment#getOrientation orientation} >+ * of the GUI component used for display. >+ * </p> >+ * @param processor designates a processor instance > * >- * <p>LRMs (for a string with LTR base direction), RLMs (for >- * a string with RTL base direction) are considered as well as >- * leading and trailing LRE, RLE and PDF which might be prefixed or suffixed >- * depending on the {@link STextEnvironment#getOrientation orientation} >- * of the GUI component used for display. >+ * @param environment specifies an environment whose characteristics may affect >+ * the processor's behavior. If <code>null</code>, the default environment is used. > * >- * @param processor designates a processor instance. >- * For more details, see above <a href="#processor"> >- * How to Specify a Processor</a>. >- * <p>If this argument is <code>null</code>, this method >- * returns an empty array. >+ * @param text is the structured text string including directional formatting characters > * >- * @param environment specifies an environment whose characteristics >- * may affect the processor's behavior. >- * <p>This argument may be specified as <code>null</code>, >- * in which case the processor will assume a standard >- * environment as specified in >- * {@link STextEnvironment#DEFAULT}. >+ * @param state can be used to specify that the <code>text</code> argument is >+ * the continuation of text submitted in a previous call and/or to receive information >+ * to pass to continuation calls. If all calls to this method are independent from one another, >+ * this argument should be specified as <code>null</code>. > * >- * @param text is the structured text string including >- * directional formatting characters. >- * >- * @param state can be used to specify that the <code>text</code> >- * argument is the continuation of text submitted in a >- * previous call and/or to receive information to pass to >- * continuation calls. >- * For more details, see <a href="#state">State</a> above. >- * <p>If all calls to this method are independent from one another, >- * this argument should be specified as <code>null</code>. >- * >- * @return an array of offsets to the characters in the <code>text</code> >- * argument which are directional formatting characters >- * added to ensure correct presentation. >- * The offsets are sorted in ascending order. >+ * @return an array of offsets to the characters in the <code>text</code> argument which >+ * are directional formatting characters added to ensure correct presentation. The offsets >+ * are sorted in ascending order. > */ > public static int[] fullBidiCharOffsets(STextProcessor processor, STextEnvironment environment, String text, int[] state) { > if (processor == null) >@@ -492,31 +383,18 @@ > } > > /** >- * Get the base direction of a structured text. >- * This base direction may depend on >- * whether the text contains Arabic or Hebrew words >- * (if it contains both, the first Arabic or Hebrew letter in the >- * text determines which is the governing script) and on >- * whether the GUI is {@link STextEnvironment#getMirrored mirrored}. >+ * Get the base direction of a structured text. This base direction may depend on >+ * whether the text contains Arabic or Hebrew words. If the text contains both, >+ * the first Arabic or Hebrew letter in the text determines which is the governing script. > * >- * @param processor designates a processor instance. >- * For more details, see above <a href="#processor"> >- * How to Specify a Processor</a>. >- * <p>If this argument is <code>null</code>, this method >- * returns {@link #DIR_LTR}. >+ * @param processor designates a processor instance > * >- * @param environment specifies an environment whose characteristics >- * may affect the processor's behavior. >- * <p>This argument may be specified as <code>null</code>, >- * in which case the processor will assume a standard >- * environment as specified in >- * {@link STextEnvironment#DEFAULT}. >+ * @param environment specifies an environment whose characteristics may affect >+ * the processor's behavior. If <code>null</code>, the default environment is used. > * >- * @param text is the structured text string. >+ * @param text is the structured text string > * >- * @return the base direction of the structured text. >- * It is one of the values {@link #DIR_LTR} >- * or {@link #DIR_RTL}. >+ * @return the base direction of the structured text, {@link #DIR_LTR} or {@link #DIR_RTL} > */ > public static int getCurDirection(STextProcessor processor, STextEnvironment environment, String text) { > if (processor == null) >diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/STextEnvironment.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/STextEnvironment.java >index 5a6500c..0755826 100644 >--- a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/STextEnvironment.java >+++ b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/STextEnvironment.java >@@ -10,149 +10,98 @@ > ******************************************************************************/ > package org.eclipse.equinox.bidi; > >-import java.util.Locale; > import org.eclipse.equinox.bidi.internal.STextActivator; > > /** >- * This class defines certain details of the environment within which >- * structured text strings are processed. >- * <p> >- * All public fields in this class are <code>final</code>, i.e. cannot be >- * changed after creating an instance. >- * <p> >- * All methods in {@link STextEngine} have a STextEnvironment >- * argument. If this argument is specified as <code>null</code>, the >- * {@link #DEFAULT} environment is used. >- * >- * <h2>Code Samples</h2> >- * <p>Example (set all environment parameters) >- * <pre> >- * >- * STextEnvironment myEnv = new STextEnvironment("he_IL", true, STextEnvironment.ORIENT_RTL); >- * >- * </pre> >- * <p> >- * This class also provides a number of convenience methods related to the environment. >- * <p> </p> >- * >+ * This class describes environment within which structured text strings are >+ * processed. It includes, for example: >+ * <ul> >+ * <li>locale,</li> >+ * <li>desired orientation,</li> >+ * <li>text mirroring attributes.</li> >+ * </ul> > * @author Matitiahu Allouche > */ > public class STextEnvironment { > > /** >- * Constant specifying that the orientation of the GUI component >- * where a structured text will be displayed is LTR. >- * It can appear as <code>orientation</code> argument for the >- * {@link STextEnvironment#STextEnvironment STextEnvironment constructor} >- * and as value returned by {@link #getOrientation}. >+ * Specifies that a GUI component should display text Left-To-Right (value is 0). > */ > public static final int ORIENT_LTR = 0; > > /** >- * Constant specifying that the orientation of the GUI component >- * where a structured text will be displayed is RTL. >- * It can appear as <code>orientation</code> argument for the >- * {@link STextEnvironment#STextEnvironment STextEnvironment constructor} >- * and as value returned by {@link #getOrientation}. >+ * Specifies that a GUI component should display text Right-To-Left (value is 1). > */ > public static final int ORIENT_RTL = 1; > > /** >- * Constant specifying that the orientation of the GUI component >- * where a structured text will be displayed is contextual with >- * a default of LTR (if no strong character appears in the text). >- * It can appear as <code>orientation</code> argument for the >- * {@link STextEnvironment#STextEnvironment STextEnvironment constructor} >- * and as value returned by {@link #getOrientation}. >+ * Specifies that a GUI component should display text depending on the context >+ * with default orientation being Left-To-Right (value is 2). > */ > public static final int ORIENT_CONTEXTUAL_LTR = 2; > > /** >- * Constant specifying that the orientation of the GUI component >- * where a structured text will be displayed is contextual with >- * a default of RTL (if no strong character appears in the text). >- * It can appear as <code>orientation</code> argument for the >- * {@link STextEnvironment#STextEnvironment STextEnvironment constructor} >- * and as value returned by {@link #getOrientation}. >+ * Specifies that a GUI component should display text depending on the context >+ * with default orientation being Right-To-Left (value is 3). > */ > public static final int ORIENT_CONTEXTUAL_RTL = 3; > > /** >- * Constant specifying that the orientation of the GUI component >- * where a structured text will be displayed is not known. >- * Directional formatting characters must be added as prefix and >- * suffix whenever a <i>full</i> text is generated using >- * {@link STextEngine#leanToFullText leanToFullText}. >- * It can appear as <code>orientation</code> argument for the >- * {@link STextEnvironment#STextEnvironment STextEnvironment constructor} >- * and as value returned by {@link #getOrientation}. >+ * Used when the orientation of a GUI component is not known (value is 4). > */ > public static final int ORIENT_UNKNOWN = 4; > > /** >- * Constant specifying that whatever the orientation of the >- * GUI component where a structured text will be displayed, no >- * directional formatting characters must be added as prefix or >- * suffix when a <i>full</i> text is generated using >- * {@link STextEngine#leanToFullText leanToFullText}. >- * It can appear as <code>orientation</code> argument for the >- * {@link STextEnvironment#STextEnvironment STextEnvironment constructor} >- * and as value returned by {@link #getOrientation}. >+ * Used to specify that no directional formatting characters >+ * should be added as prefix or suffix (value is 5). > */ > public static final int ORIENT_IGNORE = 5; > > /** >- * Pre-defined <code>STextEnvironment</code> instance with values >- * for a non-mirrored GUI and a Left-to-Right presentation component.<br> >- * The language is set to <code>null</code>, which defaults to the language >- * of the current default locale. >+ * Pre-defined <code>STextEnvironment</code> instance which uses default locale, >+ * non-mirrored environment, and a Left-to-Right presentation component. > */ > public static final STextEnvironment DEFAULT = new STextEnvironment(null, false, ORIENT_LTR); > > /** >- * This string is a 2-letters code representing a language as defined by >- * ISO-639. If left as <code>null</code>, it defaults to the language >- * of the current default locale. >+ * This string is a 2-letters code representing a language as defined by >+ * ISO-639. > */ >- final String language; >+ final private String language; > > /** >- * Flag specifying that structured text processed under this environment >- * should assume that the GUI is mirrored (globally going from right to left). >+ * Flag specifying that structured text processed under this environment >+ * should assume that the GUI is mirrored (globally going from right to left). > */ >- final boolean mirrored; >- >- /** Specify the orientation (a.k.a. base direction) of the GUI >- * component in which the <i>full</i> structured text will >- * be displayed. >- */ >- final int orientation; >+ final private boolean mirrored; > > /** >- * Constructor >+ * Specify the orientation (a.k.a. base direction) of the GUI >+ * component in which the <i>full</i> structured text will >+ * be displayed. >+ */ >+ final private int orientation; >+ >+ /** >+ * Cached value that determines if the Bidi processing is needed >+ * in this environment. >+ */ >+ private Boolean processingNeeded; >+ >+ /** >+ * Creates an instance of a structured text environment. > * >- * @param lang represents the language to be used in this environment. >- * It should be specified as a 2-letters code as defined by >- * ISO-639.<br> >- * If longer than 2 letters, the extra letters are ignored.<br> >- * If set to <code>null</code>, it defaults to the language >- * of the default locale. >- * @see #getLanguage >- * >- * @param mirrored specifies if the GUI is mirrored. >- * @see #getMirrored >- * >- * @param orientation specifies the orientation of the component >- * which is to display the structured text. It must be >- * one of the values >- * {@link #ORIENT_LTR ORIENT_LTR}, >- * {@link #ORIENT_LTR ORIENT_RTL}, >- * {@link #ORIENT_CONTEXTUAL_LTR ORIENT_CONTEXTUAL_LTR}, >- * {@link #ORIENT_CONTEXTUAL_RTL ORIENT_CONTEXTUAL_RTL}, >- * {@link #ORIENT_UNKNOWN ORIENT_UNKNOWN} or >- * {@link #ORIENT_IGNORE ORIENT_IGNORE}.<br> >- * If different, it defaults to {@link #ORIENT_UNKNOWN ORIENT_UNKNOWN}. >- * @see #getOrientation >+ * @param lang the language to of the environment, encoded as specified >+ * in ISO-639. Might be <code>null</code>, in which case the default >+ * locale is used. >+ * @param mirrored specifies if the environment is mirrored. >+ * @param orientation the orientation of the GUI component: >+ * {@link #ORIENT_LTR ORIENT_LTR}, >+ * {@link #ORIENT_LTR ORIENT_RTL}, >+ * {@link #ORIENT_CONTEXTUAL_LTR ORIENT_CONTEXTUAL_LTR}, >+ * {@link #ORIENT_CONTEXTUAL_RTL ORIENT_CONTEXTUAL_RTL}, >+ * {@link #ORIENT_UNKNOWN ORIENT_UNKNOWN}, or >+ * {@link #ORIENT_IGNORE ORIENT_IGNORE}. > */ > public STextEnvironment(String lang, boolean mirrored, int orientation) { > if (lang != null) { >@@ -161,151 +110,72 @@ > else > language = lang; > } else >- language = null; >+ language = STextActivator.getInstance().getDefaultLocale().getLanguage(); > this.mirrored = mirrored; > this.orientation = orientation >= ORIENT_LTR && orientation <= ORIENT_IGNORE ? orientation : ORIENT_UNKNOWN; > } > > /** >- * Return a 2-letters code representing a language as defined by >- * ISO-639. If specified as <code>null</code>, it defaults to the >- * language of the current default locale. >+ * Returns a 2-letters code representing a language as defined by >+ * ISO-639. >+ * @return language of the environment > */ > public String getLanguage() { >- if (language != null) >- return language; >- return getDefaultLocale().getLanguage(); >+ return language; > } > > /** >- * Return a flag indicating that structured text processed >- * within this environment should assume that the GUI is mirrored >+ * Returns a flag indicating that structured text processed >+ * within this environment should assume that the GUI is mirrored > * (globally going from right to left). >+ * @return <code>true</code> if environment is mirrored > */ > public boolean getMirrored() { > return mirrored; > } > >- /** Return the orientation (a.k.a. base direction) of the GUI >- * component in which the <i>full</i> structured text >- * will be displayed.<br> >- * The orientation must have one of the values >- * {@link #ORIENT_LTR ORIENT_LTR}, >- * {@link #ORIENT_LTR ORIENT_RTL}, >- * {@link #ORIENT_CONTEXTUAL_LTR ORIENT_CONTEXTUAL_LTR}, >- * {@link #ORIENT_CONTEXTUAL_RTL ORIENT_CONTEXTUAL_RTL}, >- * {@link #ORIENT_UNKNOWN ORIENT_UNKNOWN} or >- * {@link #ORIENT_IGNORE ORIENT_IGNORE}. >- * <p> >- * When the orientation is <code>ORIENT_LTR</code> and the >- * structured text has a RTL base direction, >- * {@link STextEngine#leanToFullText leanToFullText} >- * adds RLE+RLM at the head of the <i>full</i> text and RLM+PDF at its >- * end. >- * <p> >- * When the orientation is <code>ORIENT_RTL</code> and the >- * structured text has a LTR base direction, >- * {@link STextEngine#leanToFullText leanToFullText} >- * adds LRE+LRM at the head of the <i>full</i> text and LRM+PDF at its >- * end. >- * <p> >- * When the orientation is <code>ORIENT_CONTEXTUAL_LTR</code> or >- * <code>ORIENT_CONTEXTUAL_RTL</code> and the data content would resolve >- * to a RTL orientation while the structured text has a LTR base >- * direction, {@link STextEngine#leanToFullText leanToFullText} >- * adds LRM at the head of the <i>full</i> text. >- * <p> >- * When the orientation is <code>ORIENT_CONTEXTUAL_LTR</code> or >- * <code>ORIENT_CONTEXTUAL_RTL</code> and the data content would resolve >- * to a LTR orientation while the structured text has a RTL base >- * direction, {@link STextEngine#leanToFullText leanToFullText} >- * adds RLM at the head of the <i>full</i> text. >- * <p> >- * When the orientation is <code>ORIENT_UNKNOWN</code> and the >- * structured text has a LTR base direction, >- * {@link STextEngine#leanToFullText leanToFullText} >- * adds LRE+LRM at the head of the <i>full</i> text and LRM+PDF at its >- * end. >- * <p> >- * When the orientation is <code>ORIENT_UNKNOWN</code> and the >- * structured text has a RTL base direction, >- * {@link STextEngine#leanToFullText leanToFullText} >- * adds RLE+RLM at the head of the <i>full</i> text and RLM+PDF at its >- * end. >- * <p> >- * When the orientation is <code>ORIENT_IGNORE</code>, >- * {@link STextEngine#leanToFullText leanToFullText} does not add any directional >- * formatting characters as either prefix or suffix of the <i>full</i> text. >- * <p> >+ /** >+ * Returns the orientation (a.k.a. base direction) of the GUI >+ * component in which the <i>full</i> structured text >+ * will be displayed. >+ * <p> >+ * The orientation values: >+ * <ul> >+ * <li>{@link #ORIENT_LTR ORIENT_LTR},</li> >+ * <li>{@link #ORIENT_LTR ORIENT_RTL},</li> >+ * <li>{@link #ORIENT_CONTEXTUAL_LTR ORIENT_CONTEXTUAL_LTR},</li> >+ * <li>{@link #ORIENT_CONTEXTUAL_RTL ORIENT_CONTEXTUAL_RTL},</li> >+ * <li>{@link #ORIENT_UNKNOWN ORIENT_UNKNOWN}, or</li> >+ * <li>{@link #ORIENT_IGNORE ORIENT_IGNORE}</li>. >+ * </ul> >+ * </p> > */ > public int getOrientation() { > return orientation; > } > > /** >- * Check whether the current language uses a >- * bidi script (Arabic, Hebrew, Farsi or Urdu). >- * >- * @return <code>true</code> if the current language uses a bidi script. >- * The language may have been set explicitly when creating the >- * <code>STextEnvironment</code> instance, or it may have >- * defaulted to the language of the current default locale. >- * @see #getLanguage >+ * Checks if bidi processing is needed in this environment. >+ * @return <code>true</code> if bidi processing is needed in this environment > */ >- public boolean isBidi() { >- if (language != null) >- return isBidiLanguage(language); >- return isBidiLanguage(getDefaultLocale().getLanguage()); >- } >- >- boolean isBidiLanguage(String lang) { >- return "iw".equals(lang) || "he".equals(lang) || "ar".equals(lang) || "fa".equals(lang) || "ur".equals(lang); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ >- } >- >- static String lineSep; >- >- /** >- * Retrieve the string which represents a line separator in this environment. >- * >- * @return the string which is used as line separator (e.g. CRLF). >- */ >- public static String getLineSep() { >- // use bundle properties >- if (lineSep == null) { >- // lineSep = System.getProperty("line.separator", "\n"); //$NON-NLS-1$//$NON-NLS-2$ >- lineSep = getProperty("line.separator"); //$NON-NLS-1$/ >+ public boolean isProcessingNeeded() { >+ if (processingNeeded == null) { >+ String osName = STextActivator.getInstance().getProperty("os.name"); //$NON-NLS-1$/ >+ if (osName != null) >+ osName = osName.toLowerCase(); >+ boolean supportedOS = osName.startsWith("windows") || osName.startsWith("linux"); //$NON-NLS-1$ //$NON-NLS-2$ >+ if (supportedOS) { >+ // Check whether the current language uses a bidi script (Arabic, Hebrew, Farsi or Urdu) >+ boolean isBidi = "iw".equals(language) || //$NON-NLS-1$ >+ "he".equals(language) || //$NON-NLS-1$ >+ "ar".equals(language) || //$NON-NLS-1$ >+ "fa".equals(language) || //$NON-NLS-1$ >+ "ur".equals(language); //$NON-NLS-1$ >+ processingNeeded = new Boolean(isBidi); >+ } else { >+ processingNeeded = new Boolean(false); >+ } > } >- return lineSep; >+ return processingNeeded.booleanValue(); > } >- >- static String osName; >- static boolean flagOS; >- >- private static String getProperty(String key) { >- // use bundle properties >- // osName = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$ >- STextActivator sTextActivator = STextActivator.getInstance(); >- return sTextActivator.getProperty(key); >- } >- >- private Locale getDefaultLocale() { >- STextActivator sTextActivator = STextActivator.getInstance(); >- return sTextActivator.getDefaultLocale(); >- } >- >- /** >- * Check if the current OS is supported by the structured text packages. >- * >- * @return <code>true</code> if the current OS is supported. >- */ >- public static boolean isSupportedOS() { >- if (osName == null) { >- // use bundle properties >- // osName = System.getProperty("os.name").toLowerCase(); //$NON-NLS-1$ >- osName = getProperty("os.name").toLowerCase(); //$NON-NLS-1$/ >- flagOS = osName.startsWith("windows") || osName.startsWith("linux"); //$NON-NLS-1$ //$NON-NLS-2$ >- } >- return flagOS; >- } >- > } >diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/STextStringRecord.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/STextStringRecord.java >index 76bd6f8..6dfa2a1 100644 >--- a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/STextStringRecord.java >+++ b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/STextStringRecord.java >@@ -14,19 +14,19 @@ > import org.eclipse.equinox.bidi.custom.STextProcessor; > > /** >- * This class records strings which contain structured text. Several static >- * methods in this class allow to record such strings in a pool, and to find if >- * a given string is member of the pool. >- * <p> >- * Instances of this class are the records which are members of the pool. >- * <p> >- * The pool is managed as a cyclic list. When the pool is full, >- * each new element overrides the oldest element in the list. >- * <p> >- * A string may be itself entirely a structured text, or it may contain >- * segments each of which is a structured text of a given type. Each such >- * segment is identified by its starting and ending offsets within the >- * string, and by the processor which is appropriate to handle it. >+ * This class records strings which contain structured text. Several static >+ * methods in this class allow to record such strings in a pool, and to find if >+ * a given string is member of the pool. >+ * <p> >+ * Instances of this class are the records which are members of the pool. >+ * </p><p> >+ * The pool is managed as a cyclic list. When the pool is full, >+ * each new element overrides the oldest element in the list. >+ * </p><p> >+ * A string may be itself entirely a structured text, or it may contain >+ * segments each of which is a structured text of a given type. Each such >+ * segment is identified by its starting and ending offsets within the >+ * string, and by the processor which is appropriate to handle it. > */ > public class STextStringRecord { > /** >@@ -67,42 +67,42 @@ > private short[] boundaries; > > /** >- * Constructor >+ * Constructor > */ > private STextStringRecord() { > // inhibit creation of new instances by customers > } > > /** >- * Record a string in the pool. The caller must specify the number >- * of segments in the record (at least 1), and the processor, starting >- * and ending offsets for the first segment. >+ * Record a string in the pool. The caller must specify the number >+ * of segments in the record (at least 1), and the processor, starting >+ * and ending offsets for the first segment. > * >- * @param string the string to record. >+ * @param string the string to record. > * >- * @param segmentCount number of segments allowed in this string. >- * This number must be >= 1. >+ * @param segmentCount number of segments allowed in this string. >+ * This number must be >= 1. > * >- * @param processor the processor appropriate to handle the type >- * of structured text present in the first segment. >- * It may be one of the pre-defined processor instances >- * appearing in {@link STextEngine}, or it may be an instance >- * created by a plug-in or by the application. >+ * @param processor the processor appropriate to handle the type >+ * of structured text present in the first segment. >+ * It may be one of the pre-defined processor instances >+ * appearing in {@link STextEngine}, or it may be an instance >+ * created by a plug-in or by the application. > * >- * @param start offset in the string of the starting character of the first >- * segment. It must be >= 0 and less than the length of the string. >+ * @param start offset in the string of the starting character of the first >+ * segment. It must be >= 0 and less than the length of the string. > * >- * @param limit offset of the character following the first segment. It >- * must be greater than the <code>start</code> argument and >- * not greater than the length of the string. >+ * @param limit offset of the character following the first segment. It >+ * must be greater than the <code>start</code> argument and >+ * not greater than the length of the string. > * >- * @return an instance of STextRecordString which represents this record. >- * This instance may be used to specify additional segment with >- * {@link #addSegment addSegment}. >+ * @return an instance of STextRecordString which represents this record. >+ * This instance may be used to specify additional segment with >+ * {@link #addSegment addSegment}. > * >- * @throws IllegalArgumentException if <code>string</code> is null or >- * if <code>segmentCount</code> is less than 1. >- * @throws also the same exceptions as {@link #addSegment addSegment}. >+ * @throws IllegalArgumentException if <code>string</code> is null or >+ * if <code>segmentCount</code> is less than 1. >+ * @throws also the same exceptions as {@link #addSegment addSegment}. > */ > public static STextStringRecord addRecord(String string, int segmentCount, STextProcessor processor, int start, int limit) { > if (string == null) >@@ -139,28 +139,28 @@ > } > > /** >- * Add a second or further segment to a record. >+ * Add a second or further segment to a record. > * >- * @param processor the processor appropriate to handle the type >- * of structured text present in this segment. >- * It may be one of the pre-defined processor instances >- * appearing in {@link STextEngine}, or it may be an instance >- * created by a plug-in or by the application. >+ * @param processor the processor appropriate to handle the type >+ * of structured text present in this segment. >+ * It may be one of the pre-defined processor instances >+ * appearing in {@link STextEngine}, or it may be an instance >+ * created by a plug-in or by the application. > * >- * @param start offset in the string of the starting character of the >- * segment. It must be >= 0 and less than the length of the string. >+ * @param start offset in the string of the starting character of the >+ * segment. It must be >= 0 and less than the length of the string. > * >- * @param limit offset of the character following the segment. It must be >- * greater than the <code>start</code> argument and not greater >- * than the length of the string. >+ * @param limit offset of the character following the segment. It must be >+ * greater than the <code>start</code> argument and not greater >+ * than the length of the string. > * >- * @throws IllegalArgumentException if <code>processor</code> is null, >- * or if <code>start</code> or <code>limit</code> have invalid >- * values. >- * @throws IllegalStateException if the current segment exceeds the >- * number of segments specified by <code>segmentCount</code> >- * in the call to {@link #addRecord addRecord} which created >- * the STextStringRecord instance. >+ * @throws IllegalArgumentException if <code>processor</code> is null, >+ * or if <code>start</code> or <code>limit</code> have invalid >+ * values. >+ * @throws IllegalStateException if the current segment exceeds the >+ * number of segments specified by <code>segmentCount</code> >+ * in the call to {@link #addRecord addRecord} which created >+ * the STextStringRecord instance. > */ > public void addSegment(STextProcessor processor, int start, int limit) { > if (processor == null) >@@ -178,21 +178,21 @@ > } > > /** >- * Check if a string is recorded and retrieve its record. >+ * Check if a string is recorded and retrieve its record. > * >- * @param string the string to check. >+ * @param string the string to check. > * >- * @return <code>null</code> if the string is not recorded in the pool; >- * otherwise, return the STextStringRecord instance which >- * records this string.<br> >- * Once a record has been found, the number of its segments can >- * be retrieved using {@link #getSegmentCount getSegmentCount}, >- * its processor can >- * be retrieved using {@link #getProcessor getProcessor}, >- * its starting offset can >- * be retrieved using {@link #getStart getStart}, >- * its ending offset can >- * be retrieved using {@link #getLimit getLimit}, >+ * @return <code>null</code> if the string is not recorded in the pool; >+ * otherwise, return the STextStringRecord instance which >+ * records this string.<br> >+ * Once a record has been found, the number of its segments can >+ * be retrieved using {@link #getSegmentCount getSegmentCount}, >+ * its processor can >+ * be retrieved using {@link #getProcessor getProcessor}, >+ * its starting offset can >+ * be retrieved using {@link #getStart getStart}, >+ * its ending offset can >+ * be retrieved using {@link #getLimit getLimit}, > */ > public static STextStringRecord getRecord(String string) { > if (last < 0) // no records at all >@@ -226,10 +226,8 @@ > } > > /** >- * Retrieve the number of segments in a record. >- * >- * @return the number of segments in the current record. This number >- * is always >= 1. >+ * Retrieve the number of segments in a record. >+ * @return the number of segments in the current record > */ > public int getSegmentCount() { > return usedSegmentCount; >@@ -241,21 +239,21 @@ > } > > /** >- * Retrieve the processor of a given segment. >+ * Retrieve the processor of a given segment. > * >- * @param segmentNumber number of the segment about which information >- * is required. It must be >= 0 and less than the number of >- * segments specified by <code>segmentCount</code> >- * in the call to {@link #addRecord addRecord} which created >- * the STextStringRecord instance. >+ * @param segmentNumber number of the segment about which information >+ * is required. It must be >= 0 and less than the number of >+ * segments specified by <code>segmentCount</code> >+ * in the call to {@link #addRecord addRecord} which created >+ * the STextStringRecord instance. > * >- * @return the processor to handle the structured text in the segment >- * specified by <code>segmentNumber</code>. >+ * @return the processor to handle the structured text in the segment >+ * specified by <code>segmentNumber</code>. > * >- * @throws IllegalArgumentException if <code>segmentNumber</code> >- * has an invalid value. >+ * @throws IllegalArgumentException if <code>segmentNumber</code> >+ * has an invalid value. > * >- * @see #getSegmentCount getSegmentCount >+ * @see #getSegmentCount > */ > public STextProcessor getProcessor(int segmentNumber) { > checkSegmentNumber(segmentNumber); >@@ -263,21 +261,21 @@ > } > > /** >- * Retrieve the starting offset of a given segment. >+ * Retrieve the starting offset of a given segment. > * >- * @param segmentNumber number of the segment about which information >- * is required. It must be >= 0 and less than the number of >- * segments specified by <code>segmentCount</code> >- * in the call to {@link #addRecord addRecord} which created >- * the STextStringRecord instance. >+ * @param segmentNumber number of the segment about which information >+ * is required. It must be >= 0 and less than the number of >+ * segments specified by <code>segmentCount</code> >+ * in the call to {@link #addRecord addRecord} which created >+ * the STextStringRecord instance. > * >- * @return the starting offset within the string of the segment >- * specified by <code>segmentNumber</code>. >+ * @return the starting offset within the string of the segment >+ * specified by <code>segmentNumber</code>. > * >- * @throws IllegalArgumentException if <code>segmentNumber</code> >- * has an invalid value. >+ * @throws IllegalArgumentException if <code>segmentNumber</code> >+ * has an invalid value. > * >- * @see #getSegmentCount getSegmentCount >+ * @see #getSegmentCount > */ > public int getStart(int segmentNumber) { > checkSegmentNumber(segmentNumber); >@@ -285,21 +283,21 @@ > } > > /** >- * Retrieve the ending offset of a given segment. >+ * Retrieve the ending offset of a given segment. > * >- * @param segmentNumber number of the segment about which information >- * is required. It must be >= 0 and less than the number of >- * segments specified by <code>segmentCount</code> >- * in the call to {@link #addRecord addRecord} which created >- * the STextStringRecord instance. >+ * @param segmentNumber number of the segment about which information >+ * is required. It must be >= 0 and less than the number of >+ * segments specified by <code>segmentCount</code> >+ * in the call to {@link #addRecord addRecord} which created >+ * the STextStringRecord instance. > * >- * @return the offset of the position following the segment >- * specified by <code>segmentNumber</code>. >+ * @return the offset of the position following the segment >+ * specified by <code>segmentNumber</code>. > * >- * @throws IllegalArgumentException if <code>segmentNumber</code> >- * has an invalid value. >+ * @throws IllegalArgumentException if <code>segmentNumber</code> >+ * has an invalid value. > * >- * @see #getSegmentCount getSegmentCount >+ * @see #getSegmentCount > */ > public int getLimit(int segmentNumber) { > checkSegmentNumber(segmentNumber); >@@ -307,9 +305,8 @@ > } > > /** >- * Clear the pool. All elements of the pool are erased and any associated >- * memory is freed. >- * >+ * Clear the pool. All elements of the pool are erased and any associated >+ * memory is freed. > */ > public static synchronized void clear() { > for (int i = 0; i <= MAXINDEX; i++) { >diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/STextUtil.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/STextUtil.java >index f261833..32c4859 100644 >--- a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/STextUtil.java >+++ b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/STextUtil.java >@@ -23,60 +23,60 @@ > */ > public final class STextUtil { > >- static class MyProcessor extends STextProcessor { >- String separ; >+ /** >+ * The default set of separators used to segment a string: dot, colon, slash, backslash. >+ */ >+ public static final String defaultSeparators = ".:/\\"; //$NON-NLS-1$ > >- MyProcessor(String separators) { >- separ = separators; >- } >+ // left to right mark >+ private static final char LRM = '\u200e'; > >- public String getSeparators(STextEnvironment environment, String text, byte[] dirProps) { >- return separ; >- } >- } >+ // left to right mark >+ private static final char RLM = '\u200f'; >+ >+ // left to right embedding >+ private static final char LRE = '\u202a'; >+ >+ // right to left embedding >+ private static final char RLE = '\u202b'; >+ >+ // pop directional format >+ private static final char PDF = '\u202c'; > > /** >- * prevent instantiation >+ * Prevents instantiation. > */ > private STextUtil() { > // empty > } > >- /** This is a convenience method which can add directional marks in a given >- * text before the characters specified in the given array of offsets, >- * and can add a prefix and/or a suffix of directional formatting characters. >- * This can be used for instance after obtaining offsets by calling >- * {@link STextEngine#leanBidiCharOffsets leanBidiCharOffsets} in order to >- * produce a <i>full</i> text corresponding to the source text. >- * The directional formatting characters that will be added at the given >- * offsets will be LRMs for structured text strings with LTR base direction >- * and RLMs for strings with RTL base direction. Leading and >- * trailing LRE, RLE and PDF which might be needed as prefix or suffix >- * depending on the orientation of the GUI component used for display >- * may be added depending on argument <code>affix</code>. >- * >- * @param text is the structured text string >- * >- * @param offsets is an array of offsets to characters in <code>text</code> >- * before which an LRM or RLM will be inserted. >- * Members of the array must be non-negative numbers smaller >- * than the length of <code>text</code>. >- * The array must be sorted in ascending order without duplicates. >- * This argument may be null if there are no marks to add. >- * >- * @param direction specifies the base direction of the structured text. >- * It must be one of the values {@link STextEngine#DIR_LTR} or >- * {@link STextEngine#DIR_RTL}. >- * >- * @param affix specifies if a prefix and a suffix should be added to >- * the result to make sure that the <code>direction</code> >- * specified as third argument is honored even if the string >- * is displayed in a GUI component with a different orientation. >- * >- * @return a string corresponding to the source <code>text</code> with >- * directional marks (LRMs or RLMs) added at the specified offsets, >- * and directional formatting characters (LRE, RLE, PDF) added >- * as prefix and suffix if so required. >+ /** >+ * This method adds directional marks to the given text before the characters >+ * specified in the given array of offsets. It can be used to add a prefix and/or >+ * a suffix of directional formatting characters. >+ * <p> >+ * The directional marks will be LRMs for structured text strings with LTR base >+ * direction and RLMs for strings with RTL base direction. >+ * </p><p> >+ * If necessary, leading and trailing directional markers (LRE, RLE and PDF) can >+ * be added depending on the value of the <code>affix</code> argument. >+ * </p> >+ * @see STextEngine#leanBidiCharOffsets(STextProcessor, STextEnvironment, String, int[]) >+ * >+ * @param text the structured text string >+ * @param offsets an array of offsets to characters in <code>text</code> >+ * before which an LRM or RLM will be inserted. >+ * The array must be sorted in ascending order without duplicates. >+ * This argument may be <code>null</code> if there are no marks to add. >+ * @param direction the base direction of the structured text. >+ * It must be one of the values {@link STextEngine#DIR_LTR}, or >+ * {@link STextEngine#DIR_RTL}. >+ * @param affix specifies if a prefix and a suffix should be added to >+ * the result >+ * @return a string corresponding to the source <code>text</code> with >+ * directional marks (LRMs or RLMs) added at the specified offsets, >+ * and directional formatting characters (LRE, RLE, PDF) added >+ * as prefix and suffix if so required. > */ > public static String insertMarks(String text, int[] offsets, int direction, boolean affix) { > int textLen = text.length(); >@@ -118,83 +118,48 @@ > return full; > } > >- /*************************************************************************/ >- /* */ >- /* The following code is provided for compatibility with TextProcessor */ >- /* */ >- /*************************************************************************/ >- >- // The default set of separators to use to segment a string. >- private static final String defaultSeparators = ".:/\\"; //$NON-NLS-1$ >- // left to right mark >- private static final char LRM = '\u200e'; >- // left to right mark >- private static final char RLM = '\u200f'; >- // left to right embedding >- private static final char LRE = '\u202a'; >- // right to left embedding >- private static final char RLE = '\u202b'; >- // pop directional format >- private static final char PDF = '\u202c'; >- >- static boolean isProcessingNeeded() { >- if (!STextEnvironment.isSupportedOS()) >- return false; >- return STextEnvironment.DEFAULT.isBidi(); >- } >- > /** > * Process the given text and return a string with appropriate >- * directional formatting characters if the locale is a bidi locale. >- * This is equivalent to calling >+ * directional formatting characters. This is equivalent to calling > * {@link #process(String str, String separators)} with the default >- * set of separators (dot, colon, slash, backslash). >- * >- * @param str the text to be processed. >- * >- * @return the processed string. >+ * set of separators. >+ * <p> >+ * The processing adds directional formatting characters so that presentation >+ * using the Unicode Bidirectional Algorithm will provide the expected result. >+ * The text is segmented according to the provided separators. >+ * Each segment has the Unicode Bidi Algorithm applied to it, >+ * but as a whole, the string is oriented left to right. >+ * </p><p> >+ * For example, a file path such as <tt>d:\myfolder\FOLDER\MYFILE.java</tt> >+ * (where capital letters indicate RTL text) should render as >+ * <tt>d:\myfolder\REDLOF\ELIFYM.java</tt>. >+ * </p> >+ * @param str the text to be processed >+ * @return the processed string > */ > public static String process(String str) { > return process(str, defaultSeparators); > } > > /** >- * Process a string that has a particular semantic meaning to render >- * it correctly on bidi locales. This is done by adding directional >- * formatting characters so that presentation using the Unicode >- * Bidirectional Algorithm will provide the expected result. >- * The text is segmented according to the provided separators. >- * Each segment has the Unicode Bidi Algorithm applied to it, >- * but as a whole, the string is oriented left to right. >- * <p> >- * For example, a file path such as <tt>d:\myfolder\FOLDER\MYFILE.java</tt> >- * (where capital letters indicate RTL text) should render as >- * <tt>d:\myfolder\REDLOF\ELIFYM.java</tt>.</p> >- * <p> >- * NOTE: this method inserts directional formatting characters into the >- * text. Methods like <code>String.equals(String)</code> and >- * <code>String.length()</code> called on the resulting string will not >- * return the same values as would be returned for the original string.</p> >- * >- * @param str the text to process. >- * >- * @param separators separators by which the string will be segmented. >- * If <code>null</code>, the default separators are used >- * (dot, colon, slash, backslash). >- * >- * @return the processed string. >- * If <code>str</code> is <code>null</code>, >- * or of length 0, or if the current locale is not a bidi one, >- * return the original string. >+ * Process a string that has a particular semantic meaning to render >+ * it correctly on bidi locales. >+ * @see #process(String) >+ * @param str the text to process >+ * @param separators separators by which the string will be segmented >+ * @return the processed string > */ > public static String process(String str, String separators) { >- if ((str == null) || (str.length() <= 1) || !isProcessingNeeded()) >+ if ((str == null) || (str.length() <= 1)) > return str; > > // do not process a string that has already been processed. > if (str.charAt(0) == LRE && str.charAt(str.length() - 1) == PDF) > return str; > >+ STextEnvironment env = new STextEnvironment(null, false, STextEnvironment.ORIENT_UNKNOWN); >+ if (!env.isProcessingNeeded()) >+ return str; > // do not process a string if all the following conditions are true: > // a) it has no RTL characters > // b) it starts with a LTR character >@@ -222,46 +187,20 @@ > separators = defaultSeparators; > > // make sure that LRE/PDF are added around the string >- STextEnvironment env = new STextEnvironment(null, false, STextEnvironment.ORIENT_UNKNOWN); >- STextProcessor processor = new MyProcessor(separators); >+ STextProcessor processor = new STextProcessor(separators); > return STextEngine.leanToFullText(processor, env, str, null); > } > > /** >- * Process a string that has a particular semantic meaning to render >- * it correctly on bidi locales. This is done by adding directional >- * formatting characters so that presentation using the Unicode >- * Bidirectional Algorithm will provide the expected result.. >- * The text is segmented according to the syntax specified in the >- * <code>type</code> argument. >- * Each segment has the Unicode Bidi Algorithm applied to it, but the >- * order of the segments is governed by the type of the structured text. >- * <p> >- * For example, a file path such as <tt>d:\myfolder\FOLDER\MYFILE.java</tt> >- * (where capital letters indicate RTL text) should render as >- * <tt>d:\myfolder\REDLOF\ELIFYM.java</tt>.</p> >- * <p> >- * NOTE: this method inserts directional formatting characters into the >- * text. Methods like <code>String.equals(String)</code> and >- * <code>String.length()</code> called on the resulting string will not >- * return the same values as would be returned for the original string.</p> >- * >- * @param str the text to process. >- * >- * @param processor specifies a processor instance appropriate for >- * the type of the structured text. It will usually be >- * one of the pre-defined processor instances appearing in >- * {@link STextEngine}, but can be an instance >- * added by a plug-in extension or an instance of a >- * processor defined in the application itself. >- * >- * @return the processed string. >- * If <code>str</code> is <code>null</code>, >- * or of length 0, or if the current locale is not a bidi one, >- * return the original string. >+ * Processes a string that has a particular semantic meaning to render >+ * it correctly on bidi locales. >+ * @see #process(String) >+ * @param str the text to process >+ * @param processor a processor instance appropriate for the type of the structured text >+ * @return the processed string > */ >- public static String processTyped(String str, STextProcessor processor) { >- if ((str == null) || (str.length() <= 1) || !isProcessingNeeded()) >+ public static String process(String str, STextProcessor processor) { >+ if ((str == null) || (str.length() <= 1)) > return str; > > // do not process a string that has already been processed. >@@ -271,19 +210,21 @@ > > // make sure that LRE/PDF are added around the string > STextEnvironment env = new STextEnvironment(null, false, STextEnvironment.ORIENT_UNKNOWN); >+ if (!env.isProcessingNeeded()) >+ return str; > return STextEngine.leanToFullText(processor, env, str, null); > } > > /** >- * Remove directional formatting characters in the given string that >- * were inserted by one of the {@link #process process} methods. >- * >- * @param str string with directional characters to remove. >- * >- * @return string with no directional formatting characters. >+ * Removes directional formatting characters in the given string. >+ * @param str string with directional characters to remove >+ * @return string without directional formatting characters > */ > public static String deprocess(String str) { >- if ((str == null) || (str.length() <= 1) || !isProcessingNeeded()) >+ if ((str == null) || (str.length() <= 1)) >+ return str; >+ STextEnvironment env = new STextEnvironment(null, false, STextEnvironment.ORIENT_UNKNOWN); >+ if (!env.isProcessingNeeded()) > return str; > > StringBuffer buf = new StringBuffer(); >@@ -305,22 +246,19 @@ > } > > /** >- * Remove directional formatting characters in the given string that >- * were inserted by the {@link #processTyped processTyped} method. >- * >- * @param str string with directional characters to remove. >- * >- * @param processor to handle the structured text as specified when >- * calling {@link #processTyped processTyped}. >- * >- * @return string with no directional formatting characters. >+ * Removes directional formatting characters in the given string. >+ * @param str string with directional characters to remove >+ * @param processor appropriate for the structured text >+ * @return string without directional formatting characters > */ > public static String deprocess(String str, STextProcessor processor) { >- if ((str == null) || (str.length() <= 1) || !isProcessingNeeded()) >+ if ((str == null) || (str.length() <= 1)) > return str; > > // make sure that LRE/PDF are added around the string > STextEnvironment env = new STextEnvironment(null, false, STextEnvironment.ORIENT_UNKNOWN); >+ if (!env.isProcessingNeeded()) >+ return str; > return STextEngine.fullToLeanText(processor, env, str, null); > } > >diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/custom/STextProcessor.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/custom/STextProcessor.java >index 8401d9c..8889373 100644 >--- a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/custom/STextProcessor.java >+++ b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/custom/STextProcessor.java >@@ -57,76 +57,80 @@ > * conditionally (by calling {@link #processSeparator processSeparator}).</li> > * </ul> > * >- * @author Matitiahu Allouche >+ * @see STextEngine >+ * @author Matitiahu Allouche > */ >-public abstract class STextProcessor { >+public class STextProcessor { >+ >+ final private String separators; > > /** >- * Locate occurrences of special strings within a structured text >- * and return their indexes one after the other in successive calls. >- * <p> >- * This method is called repeatedly from the code implementing >- * {@link STextEngine#leanToFullText leanToFullText} if the >- * number of special cases returned by {@link #getSpecialsCount getSpecialsCount} >- * is greater than zero. >- * <p> >- * The code implementing this method may use the following methods: >- * <ul> >- * <li>{@link #getDirProp getDirProp}</li> >- * <li>{@link #setDirProp setDirProp}</li> >- * <li>{@link #insertMark insertMark}</li> >- * <li>{@link #processSeparator processSeparator}</li> >- * <li>{@link #getDirection getDirection}</li> >- * <li>{@link #getSeparators getSeparators}</li> >- * <li>{@link #getSpecialsCount getSpecialsCount}</li> >- * </ul> >+ * Creates a new instance of the STextProcessor class. >+ */ >+ public STextProcessor() { >+ separators = ""; //$NON-NLS-1$ >+ } >+ >+ /** >+ * Creates a new instance of the STextProcessor class. >+ * @param separators string consisting of characters that split the text into fragments >+ */ >+ public STextProcessor(String separators) { >+ this.separators = separators; >+ } >+ >+ /** >+ * Locate occurrences of special strings within a structured text >+ * and return their indexes one after the other in successive calls. >+ * <p> >+ * This method is called repeatedly from the code implementing >+ * {@link STextEngine#leanToFullText} if the number of special cases >+ * returned by {@link #getSpecialsCount} is greater than zero. >+ * </p><p> >+ * A processor handling special cases must override this method. >+ * </p> >+ * @param environment the current environment, which may affect the behavior of >+ * the processor. This parameter may be specified as >+ * <code>null</code>, in which case the >+ * {@link STextEnvironment#DEFAULT DEFAULT} >+ * environment should be assumed. > * >- * @param environment the current environment, which may affect the behavior of >- * the processor. This parameter may be specified as >- * <code>null</code>, in which case the >- * {@link STextEnvironment#DEFAULT DEFAULT} >- * environment should be assumed. >+ * @param text is the structured text string before >+ * addition of any directional formatting characters. > * >- * @param text is the structured text string before >- * addition of any directional formatting characters. >+ * @param dirProps is a parameter received by <code>indexOfSpecial</code> >+ * uniquely to be used as argument for calls to methods which >+ * need it. > * >- * @param dirProps is a parameter received by <code>indexOfSpecial</code> >- * uniquely to be used as argument for calls to methods which >- * need it. >+ * @param offsets is a parameter received by <code>indexOfSpecial</code> >+ * uniquely to be used as argument for calls to methods which >+ * need it. > * >- * @param offsets is a parameter received by <code>indexOfSpecial</code> >- * uniquely to be used as argument for calls to methods which >- * need it. >+ * @param caseNumber number of the special case to locate. >+ * This number varies from 1 to the number of special cases >+ * returned by {@link #getSpecialsCount getSpecialsCount} >+ * for this processor. >+ * The meaning of this number is internal to the class >+ * implementing <code>indexOfSpecial</code>. > * >- * @param caseNumber number of the special case to locate. >- * This number varies from 1 to the number of special cases >- * returned by {@link #getSpecialsCount getSpecialsCount} >- * for this processor. >- * The meaning of this number is internal to the class >- * implementing <code>indexOfSpecial</code>. >+ * @param fromIndex the index within <code>text</code> to start >+ * the search from. > * >- * @param fromIndex the index within <code>text</code> to start >- * the search from. >+ * @return the position where the start of the special case >+ * corresponding to <code>caseNumber</code> was located. >+ * The method must return the first occurrence of whatever >+ * identifies the start of the special case starting from >+ * <code>fromIndex</code>. The method does not have to check if >+ * this occurrence appears within the scope of another special >+ * case (e.g. a comment starting delimiter within the scope of >+ * a literal or vice-versa). >+ * <br>If no occurrence is found, the method must return -1. > * >- * @return the position where the start of the special case >- * corresponding to <code>caseNumber</code> was located. >- * The method must return the first occurrence of whatever >- * identifies the start of the special case starting from >- * <code>fromIndex</code>. The method does not have to check if >- * this occurrence appears within the scope of another special >- * case (e.g. a comment starting delimiter within the scope of >- * a literal or vice-versa). >- * <br>If no occurrence is found, the method must return -1. >- * >- * @throws IllegalStateException >- * >- * <p>If not overridden, this method throws an >- * <code>IllegalStateException</code>. This is appropriate behavior >- * (and does not need to be overridden) for processors whose >- * number of special cases is zero, which means that >- * <code>indexOfSpecial</code> should never be called for them. >- * >- * <p>A processor handling special cases must override this method. >+ * @throws IllegalStateException If not overridden, this method throws an >+ * <code>IllegalStateException</code>. This is appropriate behavior >+ * (and does not need to be overridden) for processors whose >+ * number of special cases is zero, which means that >+ * <code>indexOfSpecial</code> should never be called for them. > */ > public int indexOfSpecial(STextEnvironment environment, String text, byte[] dirProps, int[] offsets, int caseNumber, int fromIndex) { > // This method must be overridden by all subclasses with special cases. >@@ -134,98 +138,83 @@ > } > > /** >- * This method handles special cases specific to this processor. >- * It is called by {@link STextEngine#leanToFullText leanToFullText} >- * when a special case occurrence is located by >- * {@link #indexOfSpecial indexOfSpecial}. >- * <p> >- * The code implementing this method may use the following methods: >- * <ul> >- * <li>{@link #getDirProp getDirProp}</li> >- * <li>{@link #setDirProp setDirProp}</li> >- * <li>{@link #insertMark insertMark}</li> >- * <li>{@link #processSeparator processSeparator}</li> >- * <li>{@link #getDirection getDirection}</li> >- * <li>{@link #getSeparators getSeparators}</li> >- * <li>{@link #getSpecialsCount getSpecialsCount}</li> >- * </ul> >- * <p> >- * If a special processing cannot be completed within a current call to >- * <code>processSpecial</code> (for instance, a comment has been started >- * in the current line but its end appears in a following line), >- * <code>processSpecial</code> should specify a final state by >- * putting its value in the first element of the <code>state</code> >- * parameter. >- * The meaning of this state is internal to the processor. >- * On a later call to >- * {@link STextEngine#leanToFullText leanToFullText} >- * specifying that state value, <code>processSpecial</code> will be >- * called with that value for parameter <code>caseNumber</code> and >- * <code>-1</code> for parameter <code>separLocation</code> and should >- * perform whatever initializations are required depending on the state. >+ * This method handles special cases specific to this processor. >+ * It is called by {@link STextEngine#leanToFullText} when a special case occurrence >+ * is located by {@link #indexOfSpecial}. >+ * <p> >+ * If a special processing cannot be completed within a current call to >+ * <code>processSpecial</code> (for instance, a comment has been started >+ * in the current line but its end appears in a following line), >+ * <code>processSpecial</code> should specify a final state by >+ * putting its value in the first element of the <code>state</code> >+ * parameter. >+ * The meaning of this state is internal to the processor. >+ * On a later call to {@link STextEngine#leanToFullText} specifying that >+ * state value, <code>processSpecial</code> will be called with that value >+ * for parameter <code>caseNumber</code> and <code>-1</code> for parameter >+ * <code>separLocation</code> and should perform whatever initializations are required >+ * depending on the state. >+ * </p><p> >+ * A processor handling special cases (with a number of >+ * special cases greater than zero) must override this method. >+ * </p> >+ * @param environment the current environment, which may affect the behavior of >+ * the processor. This parameter may be specified as >+ * <code>null</code>, in which case the >+ * {@link STextEnvironment#DEFAULT DEFAULT} >+ * environment should be assumed. > * >- * @param environment the current environment, which may affect the behavior of >- * the processor. This parameter may be specified as >- * <code>null</code>, in which case the >- * {@link STextEnvironment#DEFAULT DEFAULT} >- * environment should be assumed. >+ * @param text is the structured text string before >+ * addition of any directional formatting characters. > * >- * @param text is the structured text string before >- * addition of any directional formatting characters. >+ * @param dirProps is a parameter received by <code>processSpecial</code> >+ * uniquely to be used as argument for calls to methods which >+ * need it. > * >- * @param dirProps is a parameter received by <code>processSpecial</code> >- * uniquely to be used as argument for calls to methods which >- * need it. >+ * @param offsets is a parameter received by <code>processSpecial</code> >+ * uniquely to be used as argument for calls to methods which >+ * need it. > * >- * @param offsets is a parameter received by <code>processSpecial</code> >- * uniquely to be used as argument for calls to methods which >- * need it. >+ * @param state is an integer array with at least one element. >+ * If the processor needs to signal the occurrence of a >+ * special case which must be passed to the next call to >+ * <code>leanToFullText</code> (for instance, a comment or a >+ * literal started but not closed in the current >+ * <code>text</code>), it must put a value in the first element >+ * of the <code>state</code> parameter. >+ * This number must be >= 1 and less or equal to the number of special >+ * cases returned by {@link #getSpecialsCount getSpecialsCount} >+ * by this processor. >+ * This number is passed back to the caller >+ * and should be specified as <code>state</code> argument >+ * in the next call to <code>leanToFullText</code> together >+ * with the continuation text. >+ * The meaning of this number is internal to the processor. > * >- * @param state is an integer array with at least one element. >- * If the processor needs to signal the occurrence of a >- * special case which must be passed to the next call to >- * <code>leanToFullText</code> (for instance, a comment or a >- * literal started but not closed in the current >- * <code>text</code>), it must put a value in the first element >- * of the <code>state</code> parameter. >- * This number must be >= 1 and less or equal to the number of special >- * cases returned by {@link #getSpecialsCount getSpecialsCount} >- * by this processor. >- * This number is passed back to the caller >- * and should be specified as <code>state</code> argument >- * in the next call to <code>leanToFullText</code> together >- * with the continuation text. >- * The meaning of this number is internal to the processor. >+ * @param caseNumber number of the special case to handle. > * >- * @param caseNumber number of the special case to handle. >+ * @param separLocation the position returned by >+ * {@link #indexOfSpecial indexOfSpecial}. In calls to >+ * {@link STextEngine#leanToFullText leanToFullText} and other >+ * methods of {@link STextEngine} specifying a non-null >+ * <code>state</code> parameter, <code>processSpecial</code> is >+ * called when initializing the processing with the value of >+ * <code>caseNumber</code> equal to the value returned in the >+ * first element of <code>state</code> and the value of >+ * <code>separLocation</code> equal to <code>-1</code>. > * >- * @param separLocation the position returned by >- * {@link #indexOfSpecial indexOfSpecial}. In calls to >- * {@link STextEngine#leanToFullText leanToFullText} and other >- * methods of {@link STextEngine} specifying a non-null >- * <code>state</code> parameter, <code>processSpecial</code> is >- * called when initializing the processing with the value of >- * <code>caseNumber</code> equal to the value returned in the >- * first element of <code>state</code> and the value of >- * <code>separLocation</code> equal to <code>-1</code>. >+ * @return the position after the scope of the special case ends. >+ * For instance, the position after the end of a comment, >+ * the position after the end of a literal. >+ * <br>A value greater or equal to the length of <code>text</code> >+ * means that there is no further occurrence of this case in the >+ * current structured text. > * >- * @return the position after the scope of the special case ends. >- * For instance, the position after the end of a comment, >- * the position after the end of a literal. >- * <br>A value greater or equal to the length of <code>text</code> >- * means that there is no further occurrence of this case in the >- * current structured text. >- * >- * @throws IllegalStateException >- * >- * <p>If not overridden, this method throws an >- * <code>IllegalStateException</code>. This is appropriate behavior >- * (and does not need to be overridden) for processors whose >- * number of special cases is zero, which means that >- * <code>processSpecial</code> should never be called for them. >- * >- * <p>A processor handling special cases (with a number of >- * special cases greater than zero) must override this method. >+ * @throws IllegalStateException If not overridden, this method throws an >+ * <code>IllegalStateException</code>. This is appropriate behavior >+ * (and does not need to be overridden) for processors whose >+ * number of special cases is zero, which means that >+ * <code>processSpecial</code> should never be called for them. > */ > public int processSpecial(STextEnvironment environment, String text, byte[] dirProps, int[] offsets, int[] state, int caseNumber, int separLocation) { > // This method must be overridden by all subclasses with any special case. >@@ -233,248 +222,238 @@ > } > > /** >- * This method can be called from within >- * {@link #indexOfSpecial indexOfSpecial} or >- * {@link #processSpecial processSpecial} in extensions of >- * <code>STextProcessor</code> to retrieve the >- * bidirectional class of characters in the <i>lean</i> text. >+ * This method can be called from within {@link #indexOfSpecial} or >+ * {@link #processSpecial} in extensions of <code>STextProcessor</code> to retrieve >+ * the bidirectional class of characters in the <i>lean</i> text. > * >- * @param text is the structured text string received as >- * parameter to <code>indexOfSpecial</code> or >- * <code>processSpecial</code>. >+ * @param text is the structured text string received as >+ * parameter to <code>indexOfSpecial</code> or >+ * <code>processSpecial</code>. > * >- * @param dirProps is a parameter received by <code>indexOfSpecial</code> >- * or <code>processSpecial</code>, uniquely to be used as argument >- * for calls to <code>getDirProp</code> and other methods used >- * by processors. >+ * @param dirProps is a parameter received by <code>indexOfSpecial</code> >+ * or <code>processSpecial</code>, uniquely to be used as argument >+ * for calls to <code>getDirProp</code> and other methods used >+ * by processors. > * >- * @param index position of the character in the <i>lean</i> text. >- * It must be a non-negative number smaller than the length >- * of the <i>lean</i> text. >+ * @param index position of the character in the <i>lean</i> text. >+ * It must be a non-negative number smaller than the length >+ * of the <i>lean</i> text. > * >- * @return the bidirectional class of the character. It is one of the >- * values which can be returned by >- * <code>java.lang.Character.getDirectionality</code>. >- * However, it is recommended to use <code>getDirProp</code> >- * rather than <code>java.lang.Character.getDirectionality</code> >- * since <code>getDirProp</code> manages a cache of character >- * properties and so can be more efficient than calling the >- * java.lang.Character method. >+ * @return the bidirectional class of the character. It is one of the >+ * values which can be returned by >+ * <code>java.lang.Character.getDirectionality</code>. >+ * However, it is recommended to use <code>getDirProp</code> >+ * rather than <code>java.lang.Character.getDirectionality</code> >+ * since <code>getDirProp</code> manages a cache of character >+ * properties and so can be more efficient than calling the >+ * java.lang.Character method. > */ > public static final byte getDirProp(String text, byte[] dirProps, int index) { > return STextImpl.getDirProp(text, dirProps, index); > } > > /** >- * This method can be called from within >- * {@link #indexOfSpecial indexOfSpecial} or >- * {@link #processSpecial processSpecial} in extensions of >- * <code>STextProcessor</code> to set or >- * override the bidirectional class of characters in the <i>lean</i> text. >+ * This method can be called from within {@link #indexOfSpecial} or >+ * {@link #processSpecial} in extensions of <code>STextProcessor</code> to set or >+ * override the bidirectional class of characters in the <i>lean</i> text. > * >- * @param dirProps is a parameter received by <code>indexOfSpecial</code> >- * or <code>processSpecial</code>, uniquely to be used as argument >- * for calls to <code>setDirProp</code> and other methods used >- * by processors. >+ * @param dirProps is a parameter received by <code>indexOfSpecial</code> >+ * or <code>processSpecial</code>, uniquely to be used as argument >+ * for calls to <code>setDirProp</code> and other methods used >+ * by processors. > * >- * @param index position of the character in the <i>lean</i> text. >- * It must be a non-negative number smaller than the length >- * of the <i>lean</i> text. >+ * @param index position of the character in the <i>lean</i> text. >+ * It must be a non-negative number smaller than the length >+ * of the <i>lean</i> text. > * >- * @param dirProp bidirectional class of the character. It must be >- * one of the values which can be returned by >- * <code>java.lang.Character.getDirectionality</code>. >+ * @param dirProp bidirectional class of the character. It must be >+ * one of the values which can be returned by >+ * <code>java.lang.Character.getDirectionality</code>. > */ > public static final void setDirProp(byte[] dirProps, int index, byte dirProp) { > STextImpl.setDirProp(dirProps, index, dirProp); > } > > /** >- * This method can be called from within >- * {@link #indexOfSpecial indexOfSpecial} or >- * {@link #processSpecial processSpecial} in extensions of >- * <code>STextProcessor</code> >- * to specify that a mark character must be added before the character >- * at the specified position of the <i>lean</i> text when generating the >- * <i>full</i> text. The mark character will be LRM for structured text >- * with a LTR base direction, and RLM for structured text with RTL >- * base direction. The mark character is not added physically by this >- * method, but its position is noted and will be used when generating >- * the <i>full</i> text. >+ * This method can be called from within {@link #indexOfSpecial} or >+ * {@link #processSpecial} in extensions of <code>STextProcessor</code> >+ * to specify that a mark character must be added before the character >+ * at the specified position of the <i>lean</i> text when generating the >+ * <i>full</i> text. The mark character will be LRM for structured text >+ * with a LTR base direction, and RLM for structured text with RTL >+ * base direction. The mark character is not added physically by this >+ * method, but its position is noted and will be used when generating >+ * the <i>full</i> text. > * >- * @param text is the structured text string received as >- * parameter to <code>indexOfSpecial</code> or >- * <code>processSpecial</code>. >+ * @param text is the structured text string received as >+ * parameter to <code>indexOfSpecial</code> or >+ * <code>processSpecial</code>. > * >- * @param dirProps is a parameter received by <code>indexOfSpecial</code> >- * or <code>processSpecial</code>, uniquely to be used as argument >- * for calls to <code>insertMark</code> and other methods used >- * by processors. >+ * @param dirProps is a parameter received by <code>indexOfSpecial</code> >+ * or <code>processSpecial</code>, uniquely to be used as argument >+ * for calls to <code>insertMark</code> and other methods used >+ * by processors. > * >- * @param offsets is a parameter received by <code>indexOfSpecial</code> >- * or <code>processSpecial</code>, uniquely to be used as argument >- * for calls to <code>insertMark</code> and other methods used >- * by processors. >+ * @param offsets is a parameter received by <code>indexOfSpecial</code> >+ * or <code>processSpecial</code>, uniquely to be used as argument >+ * for calls to <code>insertMark</code> and other methods used >+ * by processors. > * >- * @param offset position of the character in the <i>lean</i> text. >- * It must be a non-negative number smaller than the length >- * of the <i>lean</i> text. >- * For the benefit of efficiency, it is better to insert >- * multiple marks in ascending order of the offsets. >+ * @param offset position of the character in the <i>lean</i> text. >+ * It must be a non-negative number smaller than the length >+ * of the <i>lean</i> text. >+ * For the benefit of efficiency, it is better to insert >+ * multiple marks in ascending order of the offsets. > */ > public static final void insertMark(String text, byte[] dirProps, int[] offsets, int offset) { > STextImpl.insertMark(text, dirProps, offsets, offset); > } > > /** >- * This method can be called from within >- * {@link #indexOfSpecial indexOfSpecial} or >- * {@link #processSpecial processSpecial} in extensions of >- * <code>STextProcessor</code> to add a directional mark before a >- * separator if needed for correct display, depending on the >- * base direction of the text and on the class of the >- * characters in the <i>lean</i> text preceding and following >- * the separator itself. >+ * This method can be called from within {@link #indexOfSpecial} or >+ * {@link #processSpecial} in extensions of <code>STextProcessor</code> to add >+ * a directional mark before a separator if needed for correct display, >+ * depending on the base direction of the text and on the class of the >+ * characters in the <i>lean</i> text preceding and following the separator itself. >+ * <p> >+ * The logic implemented in this method considers the text before >+ * <code>separLocation</code> and the text following it. If, and only if, >+ * a directional mark is needed to insure that the two parts of text >+ * will be laid out according to the base direction, a mark will be >+ * added when generating the <i>full</i> text. >+ * </p> >+ * @param text is the structured text string received as >+ * parameter to <code>indexOfSpecial</code> or >+ * <code>processSpecial</code>. > * >- * <p>The logic implemented in this method considers the text before >- * <code>separLocation</code> and the text following it. If, and only if, >- * a directional mark is needed to insure that the two parts of text >- * will be laid out according to the base direction, a mark will be >- * added when generating the <i>full</i> text. >+ * @param dirProps is a parameter received by <code>indexOfSpecial</code> >+ * or <code>processSpecial</code>, uniquely to be used as argument >+ * for calls to <code>processSeparator</code> and other methods used >+ * by processors. > * >- * @param text is the structured text string received as >- * parameter to <code>indexOfSpecial</code> or >- * <code>processSpecial</code>. >+ * @param offsets is a parameter received by <code>indexOfSpecial</code> >+ * or <code>processSpecial</code>, uniquely to be used as argument >+ * for calls to <code>processSeparator</code> and other methods used >+ * by processors. > * >- * @param dirProps is a parameter received by <code>indexOfSpecial</code> >- * or <code>processSpecial</code>, uniquely to be used as argument >- * for calls to <code>processSeparator</code> and other methods used >- * by processors. >- * >- * @param offsets is a parameter received by <code>indexOfSpecial</code> >- * or <code>processSpecial</code>, uniquely to be used as argument >- * for calls to <code>processSeparator</code> and other methods used >- * by processors. >- * >- * @param separLocation offset of the separator in the <i>lean</i> text. >- * It must be a non-negative number smaller than the length >- * of the <i>lean</i> text. >+ * @param separLocation offset of the separator in the <i>lean</i> text. >+ * It must be a non-negative number smaller than the length >+ * of the <i>lean</i> text. > */ > public static final void processSeparator(String text, byte[] dirProps, int[] offsets, int separLocation) { > STextImpl.processSeparator(text, dirProps, offsets, separLocation); > } > > /** >- * Indicate the separators to use for the current processor. >- * This methode is invoked before starting the processing. >+ * Indicate the separators to use for the current processor. >+ * This method is invoked before starting the processing. >+ * <p> >+ * If no separators are specified, this method returns an empty string. >+ * </p> >+ * @param environment the current environment, which may affect the behavior of >+ * the processor. This parameter may be specified as >+ * <code>null</code>, in which case the >+ * {@link STextEnvironment#DEFAULT DEFAULT} >+ * environment should be assumed. > * >- * @param environment the current environment, which may affect the behavior of >- * the processor. This parameter may be specified as >- * <code>null</code>, in which case the >- * {@link STextEnvironment#DEFAULT DEFAULT} >- * environment should be assumed. >+ * @param text is the structured text string to process. > * >- * @param text is the structured text string to process. >+ * @param dirProps is a parameter received uniquely to be used as argument >+ * for calls to <code>getDirProp</code> and other methods used >+ * by processors. > * >- * @param dirProps is a parameter received uniquely to be used as argument >- * for calls to <code>getDirProp</code> and other methods used >- * by processors. >- * >- * @return a string grouping one-character separators which separate >- * the structured text into tokens. >- * >- * <p>If not overridden, this method returns an empty string; >+ * @return a string grouping one-character separators which separate >+ * the structured text into tokens. > */ > public String getSeparators(STextEnvironment environment, String text, byte[] dirProps) { >- return ""; //$NON-NLS-1$ >+ return separators; > } > > /** >- * Indicate the base text direction appropriate for an instance >- * of structured text. >- * This methode is invoked before starting the processing. >+ * Indicate the base text direction appropriate for an instance of structured text. >+ * This method is invoked before starting the processing. >+ * <p> >+ * If not overridden, this method returns <code>DIR_LTR</code>. >+ * </p> >+ * @param environment the current environment, which may affect the behavior of >+ * the processor. This parameter may be specified as >+ * <code>null</code>, in which case the >+ * {@link STextEnvironment#DEFAULT DEFAULT} >+ * environment should be assumed. > * >- * @param environment the current environment, which may affect the behavior of >- * the processor. This parameter may be specified as >- * <code>null</code>, in which case the >- * {@link STextEnvironment#DEFAULT DEFAULT} >- * environment should be assumed. >+ * @param text is the structured text string to process. > * >- * @param text is the structured text string to process. >+ * @param dirProps is a parameter received uniquely to be used as argument >+ * for calls to <code>getDirProp</code> and other methods used >+ * by processors. > * >- * @param dirProps is a parameter received uniquely to be used as argument >- * for calls to <code>getDirProp</code> and other methods used >- * by processors. >- * >- * @return the base direction of the structured text. This direction >- * may not be the same depending on the environment and on >- * whether the structured text contains Arabic or Hebrew >- * letters.<br> >- * The value returned is either >- * {@link STextEngine#DIR_LTR DIR_LTR} or {@link STextEngine#DIR_RTL DIR_RTL}. >- * >- * <p>If not overridden, this method returns <code>DIR_LTR</code>. >+ * @return the base direction of the structured text. This direction >+ * may not be the same depending on the environment and on >+ * whether the structured text contains Arabic or Hebrew >+ * letters.<br> >+ * The value returned is either >+ * {@link STextEngine#DIR_LTR DIR_LTR} or {@link STextEngine#DIR_RTL DIR_RTL}. > */ > public int getDirection(STextEnvironment environment, String text, byte[] dirProps) { > return STextEngine.DIR_LTR; > } > > /** >- * Indicate the number of special cases handled by the current processor. >- * This methode is invoked before starting the processing. >- * If the number returned is zero, >- * {@link #indexOfSpecial indexOfSpecial} and >- * {@link #processSpecial processSpecial} will not be invoked. >+ * Indicate the number of special cases handled by the current processor. >+ * This method is invoked before starting the processing. >+ * If the number returned is zero, {@link #indexOfSpecial} and >+ * {@link #processSpecial} will not be invoked. >+ * <p> >+ * If not overridden, this method returns <code>zero</code>. >+ * </p> >+ * @param environment the current environment, which may affect the behavior of >+ * the processor. This parameter may be specified as >+ * <code>null</code>, in which case the >+ * {@link STextEnvironment#DEFAULT DEFAULT} >+ * environment should be assumed. > * >- * @param environment the current environment, which may affect the behavior of >- * the processor. This parameter may be specified as >- * <code>null</code>, in which case the >- * {@link STextEnvironment#DEFAULT DEFAULT} >- * environment should be assumed. >+ * @param text is the structured text string to process. > * >- * @param text is the structured text string to process. >+ * @param dirProps is a parameter received uniquely to be used as argument >+ * for calls to <code>getDirProp</code> and other methods used >+ * by processors. > * >- * @param dirProps is a parameter received uniquely to be used as argument >- * for calls to <code>getDirProp</code> and other methods used >- * by processors. >+ * @return the number of special cases for the associated processor. >+ * Special cases exist for some types of structured text >+ * processors. They are implemented by overriding methods >+ * {@link STextProcessor#indexOfSpecial} and {@link STextProcessor#processSpecial}. >+ * Examples of special cases are comments, literals, or >+ * anything which is not identified by a one-character separator. > * >- * @return the number of special cases for the associated processor. >- * Special cases exist for some types of structured text >- * processors. They are implemented by overriding methods >- * {@link STextProcessor#indexOfSpecial indexOfSpecial} and >- * {@link STextProcessor#processSpecial processSpecial}. >- * Examples of special cases are comments, literals, or >- * anything which is not identified by a one-character separator. >- * >- * <p>If not overridden, this method returns <code>zero</code>. > */ > public int getSpecialsCount(STextEnvironment environment, String text, byte[] dirProps) { > return 0; > } > > /** >- * Check if there is a need for processing structured text. >- * This methode is invoked before starting the processing. If the >- * processor returns <code>true</code>, no directional formatting >- * characters are added to the <i>lean</i> text and the processing >- * is shortened. >+ * Checks if there is a need for processing structured text. >+ * This method is invoked before starting the processing. If the >+ * processor returns <code>true</code>, no directional formatting >+ * characters are added to the <i>lean</i> text and the processing >+ * is shortened. >+ * <p> >+ * If not overridden, this method returns <code>false</code>. >+ * </p> >+ * @param environment the current environment, which may affect the behavior of >+ * the processor. This parameter may be specified as >+ * <code>null</code>, in which case the >+ * {@link STextEnvironment#DEFAULT DEFAULT} >+ * environment should be assumed. > * >- * @param environment the current environment, which may affect the behavior of >- * the processor. This parameter may be specified as >- * <code>null</code>, in which case the >- * {@link STextEnvironment#DEFAULT DEFAULT} >- * environment should be assumed. >+ * @param text is the structured text string to process. > * >- * @param text is the structured text string to process. >+ * @param dirProps is a parameter received uniquely to be used as argument >+ * for calls to <code>getDirProp</code> and other methods used >+ * by processors. > * >- * @param dirProps is a parameter received uniquely to be used as argument >- * for calls to <code>getDirProp</code> and other methods used >- * by processors. >+ * @return a flag indicating if there is no need to process the structured >+ * text to add directional formatting characters. > * >- * @return a flag indicating if there is no need to process the structured >- * text to add directional formatting characters. >- * >- * <p>If not overridden, this method returns <code>false</code>. > */ > public boolean skipProcessing(STextEnvironment environment, String text, byte[] dirProps) { > return false; >diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/STextDelims.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/STextDelims.java >index 5bbe015..f6061fd 100644 >--- a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/STextDelims.java >+++ b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/STextDelims.java >@@ -14,17 +14,24 @@ > import org.eclipse.equinox.bidi.custom.STextProcessor; > > /** >- * <code>STextDelims</code> is a processor for structured text >- * composed of text segments separated by separators where the text segments >- * may include delimited parts within which separators are treated like >- * regular characters. >- * >- * <p>A delimited part is bounded by a start delimiter and an end delimiter. >- * >+ * A base processor for structured text composed of text segments separated >+ * by separators where the text segments may include delimited parts within >+ * which separators are treated like regular characters. >+ * <p> >+ * A delimited part is bounded by a start delimiter and an end delimiter. >+ * </p> > * @author Matitiahu Allouche > */ > public abstract class STextDelims extends STextProcessor { > >+ public STextDelims() { >+ // placeholder >+ } >+ >+ public STextDelims(String separators) { >+ super(separators); >+ } >+ > /** > * This method locates occurrences of start delimiters. > * >diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/STextDelimsEsc.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/STextDelimsEsc.java >index 67f944d..564cead 100644 >--- a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/STextDelimsEsc.java >+++ b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/STextDelimsEsc.java >@@ -14,23 +14,33 @@ > import org.eclipse.equinox.bidi.custom.STextProcessor; > > /** >- * <code>STextDelims</code> is a processor for structured text >- * composed of text segments separated by separators where the text segments >- * may include delimited parts within which separators are treated like >- * regular characters and the delimiters may be escaped. >- * This is similar to {@link STextDelims} except >- * that delimiters can be escaped using the backslash character. >+ * A base processor for structured text composed of text segments separated >+ * by separators where the text segments may include delimited parts within >+ * which separators are treated like regular characters and the delimiters >+ * may be escaped. >+ * <p> >+ * This is similar to {@link STextDelims} except that delimiters can be escaped >+ * using the backslash character. > * <ul> > * <li>Two consecutive backslashes in a delimited part are treated like > * one regular character.</li> > * <li>An ending delimiter preceded by an odd number of backslashes is > * treated like a regular character within the delimited part.</li> > * </ul> >+ * </p> > * > * @author Matitiahu Allouche > */ > public abstract class STextDelimsEsc extends STextDelims { > >+ public STextDelimsEsc() { >+ // placeholder >+ } >+ >+ public STextDelimsEsc(String separator) { >+ super(separator); >+ } >+ > /** > * This method handles the text between start and end delimiters > * as a token. >diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/STextImpl.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/STextImpl.java >index d7ddb75..77d365a 100644 >--- a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/STextImpl.java >+++ b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/STextImpl.java >@@ -239,6 +239,46 @@ > } > > /** >+ * When the orientation is <code>ORIENT_LTR</code> and the >+ * structured text has a RTL base direction, >+ * {@link STextEngine#leanToFullText leanToFullText} >+ * adds RLE+RLM at the head of the <i>full</i> text and RLM+PDF at its >+ * end. >+ * <p> >+ * When the orientation is <code>ORIENT_RTL</code> and the >+ * structured text has a LTR base direction, >+ * {@link STextEngine#leanToFullText leanToFullText} >+ * adds LRE+LRM at the head of the <i>full</i> text and LRM+PDF at its >+ * end. >+ * <p> >+ * When the orientation is <code>ORIENT_CONTEXTUAL_LTR</code> or >+ * <code>ORIENT_CONTEXTUAL_RTL</code> and the data content would resolve >+ * to a RTL orientation while the structured text has a LTR base >+ * direction, {@link STextEngine#leanToFullText leanToFullText} >+ * adds LRM at the head of the <i>full</i> text. >+ * <p> >+ * When the orientation is <code>ORIENT_CONTEXTUAL_LTR</code> or >+ * <code>ORIENT_CONTEXTUAL_RTL</code> and the data content would resolve >+ * to a LTR orientation while the structured text has a RTL base >+ * direction, {@link STextEngine#leanToFullText leanToFullText} >+ * adds RLM at the head of the <i>full</i> text. >+ * <p> >+ * When the orientation is <code>ORIENT_UNKNOWN</code> and the >+ * structured text has a LTR base direction, >+ * {@link STextEngine#leanToFullText leanToFullText} >+ * adds LRE+LRM at the head of the <i>full</i> text and LRM+PDF at its >+ * end. >+ * <p> >+ * When the orientation is <code>ORIENT_UNKNOWN</code> and the >+ * structured text has a RTL base direction, >+ * {@link STextEngine#leanToFullText leanToFullText} >+ * adds RLE+RLM at the head of the <i>full</i> text and RLM+PDF at its >+ * end. >+ * <p> >+ * When the orientation is <code>ORIENT_IGNORE</code>, >+ * {@link STextEngine#leanToFullText leanToFullText} does not add any directional >+ * formatting characters as either prefix or suffix of the <i>full</i> text. >+ * <p> > * @see STextEngine#leanToFullText STextEngine.leanToFullText > */ > public static String leanToFullText(STextProcessor processor, STextEnvironment environment, String text, int[] state) { >diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/STextSingle.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/STextSingle.java >index ec8ec0a..2407a7b 100644 >--- a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/STextSingle.java >+++ b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/STextSingle.java >@@ -14,8 +14,7 @@ > import org.eclipse.equinox.bidi.custom.STextProcessor; > > /** >- * <code>STextSingle</code> is a processor for structured text >- * composed of two parts separated by a separator. >+ * A base processor for structured text composed of two parts separated by a separator. > * The first occurrence of the separator delimits the end of the first part > * and the start of the second part. Further occurrences of the separator, > * if any, are treated like regular characters of the second text part. >@@ -30,7 +29,11 @@ > * > * @author Matitiahu Allouche > */ >-public abstract class STextSingle extends STextProcessor { >+public class STextSingle extends STextProcessor { >+ >+ public STextSingle(String separator) { >+ super(separator); >+ } > > /** > * This method locates occurrences of the separator. >diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextComma.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextComma.java >index dc29ad2..418873f 100644 >--- a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextComma.java >+++ b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextComma.java >@@ -10,7 +10,6 @@ > ******************************************************************************/ > package org.eclipse.equinox.bidi.internal.consumable; > >-import org.eclipse.equinox.bidi.STextEnvironment; > import org.eclipse.equinox.bidi.custom.STextProcessor; > > /** >@@ -20,12 +19,7 @@ > * </pre> > */ > public class STextComma extends STextProcessor { >- >- /** >- * @return one separator (comma). >- */ >- public String getSeparators(STextEnvironment environment, String text, byte[] dirProps) { >- return ","; //$NON-NLS-1$ >+ public STextComma() { >+ super(","); //$NON-NLS-1$ > } >- > } >diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextEmail.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextEmail.java >index 05bfaba..2b7cb61 100644 >--- a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextEmail.java >+++ b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextEmail.java >@@ -23,11 +23,8 @@ > static final byte R = Character.DIRECTIONALITY_RIGHT_TO_LEFT; > static final byte AL = Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC; > >- /** >- * @return separators "<>.:,;@". >- */ >- public String getSeparators(STextEnvironment environment, String text, byte[] dirProps) { >- return "<>.:,;@"; //$NON-NLS-1$ >+ public STextEmail() { >+ super("<>.:,;@"); //$NON-NLS-1$ > } > > /** >diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextFile.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextFile.java >index cc7b2fd..d7185d3 100644 >--- a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextFile.java >+++ b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextFile.java >@@ -10,18 +10,14 @@ > ******************************************************************************/ > package org.eclipse.equinox.bidi.internal.consumable; > >-import org.eclipse.equinox.bidi.STextEnvironment; > import org.eclipse.equinox.bidi.custom.STextProcessor; > > /** > * Processor adapted to processing directory and file paths. > */ > public class STextFile extends STextProcessor { >- /** >- * @return separators ":/\.". >- */ >- public String getSeparators(STextEnvironment environment, String text, byte[] dirProps) { >- return ":/\\."; //$NON-NLS-1$ >- } > >+ public STextFile() { >+ super(":/\\."); //$NON-NLS-1$ >+ } > } >diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextJava.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextJava.java >index 4b717c1..5562e41 100644 >--- a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextJava.java >+++ b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextJava.java >@@ -13,6 +13,7 @@ > import org.eclipse.equinox.bidi.STextEngine; > import org.eclipse.equinox.bidi.STextEnvironment; > import org.eclipse.equinox.bidi.custom.STextProcessor; >+import org.eclipse.equinox.bidi.internal.STextActivator; > > /** > * <code>STextJava</code> is a processor for structured text >@@ -35,13 +36,10 @@ > */ > public class STextJava extends STextProcessor { > private static final byte WS = Character.DIRECTIONALITY_WHITESPACE; >- static final String lineSep = STextEnvironment.getLineSep(); >+ static final String lineSep = STextActivator.getInstance().getProperty("line.separator"); //$NON-NLS-1$ > >- /** >- * @return the separators for Java syntax >- */ >- public String getSeparators(STextEnvironment environment, String text, byte[] dirProps) { >- return "[](){}.+-<>=~!&*/%^|?:,;\t"; //$NON-NLS-1$ >+ public STextJava() { >+ super("[](){}.+-<>=~!&*/%^|?:,;\t"); //$NON-NLS-1$ > } > > /** >diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextMath.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextMath.java >index 8bafbb1..450aef9 100644 >--- a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextMath.java >+++ b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextMath.java >@@ -24,11 +24,8 @@ > static final byte AL = Character.DIRECTIONALITY_RIGHT_TO_LEFT_ARABIC; > static final byte AN = Character.DIRECTIONALITY_ARABIC_NUMBER; > >- /** >- * @return "+-/*()=" as separators specific to this processor. >- */ >- public String getSeparators(STextEnvironment environment, String text, byte[] dirProps) { >- return "+-/*()="; //$NON-NLS-1$ >+ public STextMath() { >+ super("+-/*()="); //$NON-NLS-1$ > } > > /** >diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextProperty.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextProperty.java >index 1cd1b0e..994a80e 100644 >--- a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextProperty.java >+++ b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextProperty.java >@@ -10,7 +10,6 @@ > ******************************************************************************/ > package org.eclipse.equinox.bidi.internal.consumable; > >-import org.eclipse.equinox.bidi.STextEnvironment; > import org.eclipse.equinox.bidi.internal.STextSingle; > > /** >@@ -21,11 +20,8 @@ > * </pre> > */ > public class STextProperty extends STextSingle { >- /** >- * @return one separator (equal sign). >- */ >- public String getSeparators(STextEnvironment environment, String text, byte[] dirProps) { >- return "="; //$NON-NLS-1$ >- } > >+ public STextProperty() { >+ super("="); //$NON-NLS-1$ >+ } > } >diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextSql.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextSql.java >index 9c0965c..971a7d8 100644 >--- a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextSql.java >+++ b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextSql.java >@@ -13,6 +13,7 @@ > import org.eclipse.equinox.bidi.STextEngine; > import org.eclipse.equinox.bidi.STextEnvironment; > import org.eclipse.equinox.bidi.custom.STextProcessor; >+import org.eclipse.equinox.bidi.internal.STextActivator; > > /** > * <code>STextSql</code> is a processor for structured text >@@ -35,13 +36,10 @@ > */ > public class STextSql extends STextProcessor { > private static final byte WS = Character.DIRECTIONALITY_WHITESPACE; >- static final String lineSep = STextEnvironment.getLineSep(); >+ static final String lineSep = STextActivator.getInstance().getProperty("line.separator"); //$NON-NLS-1$ > >- /** >- * @return separators "\t!#%&()*+,-./:;<=>?|[]{}". >- */ >- public String getSeparators(STextEnvironment environment, String text, byte[] dirProps) { >- return "\t!#%&()*+,-./:;<=>?|[]{}"; //$NON-NLS-1$ >+ public STextSql() { >+ super("\t!#%&()*+,-./:;<=>?|[]{}"); //$NON-NLS-1$ > } > > /** >diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextSystem.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextSystem.java >index d31d4da..32b2307 100644 >--- a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextSystem.java >+++ b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextSystem.java >@@ -10,7 +10,6 @@ > ******************************************************************************/ > package org.eclipse.equinox.bidi.internal.consumable; > >-import org.eclipse.equinox.bidi.STextEnvironment; > import org.eclipse.equinox.bidi.internal.STextSingle; > > /** >@@ -20,11 +19,9 @@ > * </pre> > */ > public class STextSystem extends STextSingle { >- /** >- * @return "(" for the separators specific to this processor. >- */ >- public String getSeparators(STextEnvironment environment, String text, byte[] dirProps) { >- return "("; //$NON-NLS-1$ >+ >+ public STextSystem() { >+ super("("); //$NON-NLS-1$ > } > > } >diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextURL.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextURL.java >index 956f9b2..5b2df1a 100644 >--- a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextURL.java >+++ b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextURL.java >@@ -10,18 +10,13 @@ > ******************************************************************************/ > package org.eclipse.equinox.bidi.internal.consumable; > >-import org.eclipse.equinox.bidi.STextEnvironment; > import org.eclipse.equinox.bidi.custom.STextProcessor; > > /** > * Processor adapted to processing URLs. > */ > public class STextURL extends STextProcessor { >- /** >- * @return ":?#/@.[]" as the separators specific to this processor. >- */ >- public String getSeparators(STextEnvironment environment, String text, byte[] dirProps) { >- return ":?#/@.[]"; //$NON-NLS-1$ >+ public STextURL() { >+ super(":?#/@.[]"); //$NON-NLS-1$ > } >- > } >diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextUnderscore.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextUnderscore.java >index cefe9ab..eae11f6 100644 >--- a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextUnderscore.java >+++ b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextUnderscore.java >@@ -10,7 +10,6 @@ > ******************************************************************************/ > package org.eclipse.equinox.bidi.internal.consumable; > >-import org.eclipse.equinox.bidi.STextEnvironment; > import org.eclipse.equinox.bidi.custom.STextProcessor; > > /** >@@ -21,11 +20,8 @@ > * </pre> > */ > public class STextUnderscore extends STextProcessor { >- /** >- * @return "_" as the separators specific to this processor. >- */ >- public String getSeparators(STextEnvironment environment, String text, byte[] dirProps) { >- return "_"; //$NON-NLS-1$ >- } > >+ public STextUnderscore() { >+ super("_"); //$NON-NLS-1$ >+ } > } >diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextXPath.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextXPath.java >index e115b89..67ec4c5 100644 >--- a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextXPath.java >+++ b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/internal/consumable/STextXPath.java >@@ -17,11 +17,9 @@ > * Processor adapted to processing XPath expressions. > */ > public class STextXPath extends STextDelims { >- /** >- * @return " /[]<>=!:@.|()+-*" as the separators specific to this processor. >- */ >- public String getSeparators(STextEnvironment environment, String text, byte[] dirProps) { >- return " /[]<>=!:@.|()+-*"; //$NON-NLS-1$ >+ >+ public STextXPath() { >+ super(" /[]<>=!:@.|()+-*"); //$NON-NLS-1$ > } > > /**
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 183164
:
148967
|
157821
|
158092
|
158531
|
160015
|
160017
|
160081
|
160698
|
160858
|
162228
|
162229
|
164476
|
186038
|
186054
|
186488
|
186490
|
188406
|
188407
|
188408
|
188627
|
194078
|
194079
|
195082
|
195084
|
196575
|
196576
|
199068
|
199070
|
199113
| 199855 |
200008
|
200389
|
200629
|
200630
|
200631
|
200742
|
200743
|
200803
|
200805
|
200905
|
200907
|
201464
|
201465
|
201467
|
201468
|
201469
|
201470
|
201676
|
201677
|
201785
|
201787
|
202172
|
202173
|
205767
|
205768
|
206588
|
210657