aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Besedin2011-07-18 15:03:21 (EDT)
committerOleg Besedin2011-07-18 15:03:21 (EDT)
commit2883815e408713e8fb8200d84294a2b8789943e7 (patch)
tree992fdea3e57b6b95f757a213a8c271bb3edb8aaa
parent505db885a3cc29e925aa9e42f52cc5e4f0b5f194 (diff)
downloadrt.equinox.bundles-2883815e408713e8fb8200d84294a2b8789943e7.zip
rt.equinox.bundles-2883815e408713e8fb8200d84294a2b8789943e7.tar.gz
rt.equinox.bundles-2883815e408713e8fb8200d84294a2b8789943e7.tar.bz2
Bug 183164 - [Implementation for] Display of Complex Expressionsv20110718-1559
Containing Bidirectional Text
-rw-r--r--bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextExtensibilityTest.java15
-rw-r--r--bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextExtensionsTest.java27
-rw-r--r--bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextFullToLeanTest.java7
-rw-r--r--bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextMathTest.java5
-rw-r--r--bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextMethodsTest.java13
-rw-r--r--bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextStringRecordTest.java32
-rw-r--r--bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextUtilTest.java6
-rw-r--r--bundles/org.eclipse.equinox.bidi/schema/STextType.exsd284
-rw-r--r--bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/STextEngine.java89
-rw-r--r--bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/STextProcessorFactory.java119
-rw-r--r--bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/custom/STextStringProcessor.java40
11 files changed, 313 insertions, 324 deletions
diff --git a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextExtensibilityTest.java b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextExtensibilityTest.java
index e1b2910..736621d 100644
--- a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextExtensibilityTest.java
+++ b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextExtensibilityTest.java
@@ -11,9 +11,10 @@
package org.eclipse.equinox.bidi.internal.tests;
+import org.eclipse.equinox.bidi.STextProcessorFactory;
+
import org.eclipse.equinox.bidi.STextEngine;
import org.eclipse.equinox.bidi.custom.STextProcessor;
-import org.eclipse.equinox.bidi.custom.STextStringProcessor;
/**
* Tests contribution of BiDi processors.
@@ -21,35 +22,35 @@ import org.eclipse.equinox.bidi.custom.STextStringProcessor;
public class STextExtensibilityTest extends STextTestBase {
public void testBaseContributions() {
- String[] types = STextStringProcessor.getKnownTypes();
+ String[] types = STextProcessorFactory.getAllProcessorIDs();
assertNotNull(types);
assertTrue(types.length > 0);
// check one of the types that we know should be there
assertTrue(isTypePresent(types, "regex"));
- STextProcessor processor = STextStringProcessor.getProcessor("regex");
+ STextProcessor processor = STextProcessorFactory.getProcessor("regex");
assertNotNull(processor);
}
public void testOtherContributions() {
- String[] types = STextStringProcessor.getKnownTypes();
+ String[] types = STextProcessorFactory.getAllProcessorIDs();
assertNotNull(types);
assertTrue(types.length > 0);
// check the type added by the test bundle
assertTrue(isTypePresent(types, "test"));
- STextProcessor processor = STextStringProcessor.getProcessor("test");
+ STextProcessor processor = STextProcessorFactory.getProcessor("test");
assertNotNull(processor);
- processor = STextStringProcessor.getProcessor("badtest");
+ processor = STextProcessorFactory.getProcessor("badtest");
assertNull(processor);
String data, lean, full, model;
data = "ABC.DEF:HOST-COM=HELLO";
lean = toUT16(data);
- processor = STextStringProcessor.getProcessor("test");
+ processor = STextProcessorFactory.getProcessor("test");
full = STextEngine.leanToFullText(processor, null, lean, null);
model = "ABC@.DEF@:HOST@-COM@=HELLO";
assertEquals("Test 'test' plugin", model, toPseudo(full));
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 b7486eb..a9d9f04 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,7 @@
package org.eclipse.equinox.bidi.internal.tests;
-import org.eclipse.equinox.bidi.STextEngine;
-import org.eclipse.equinox.bidi.STextEnvironment;
+import org.eclipse.equinox.bidi.*;
import org.eclipse.equinox.bidi.custom.STextProcessor;
/**
@@ -49,12 +48,12 @@ public class STextExtensionsTest extends STextTestBase {
public void testExtensions() {
String data;
- processor = STextEngine.PROC_COMMA_DELIMITED;
+ processor = STextProcessorFactory.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;
+ processor = STextProcessorFactory.PROC_EMAIL;
state[0] = STextEngine.STATE_INITIAL;
doTest1("Email #1", "abc.DEF:GHI", "abc.DEF@:GHI");
doTest1("Email #2", "DEF.GHI \"A.B\":JK ", "DEF@.GHI @\"A.B\"@:JK ");
@@ -70,11 +69,11 @@ public class STextExtensionsTest extends STextTestBase {
data = toUT16("peter.pan") + "@" + toUT16("DEF.GHI");
doTest2("Email #9", data, "peter.pan@DEF@.GHI");
- processor = STextEngine.PROC_FILE;
+ processor = STextProcessorFactory.PROC_FILE;
state[0] = STextEngine.STATE_INITIAL;
doTest1("File #1", "c:\\A\\B\\FILE.EXT", "c:\\A@\\B@\\FILE@.EXT");
- processor = STextEngine.PROC_JAVA;
+ processor = STextProcessorFactory.PROC_JAVA;
state[0] = STextEngine.STATE_INITIAL;
doTest1("Java #1", "A = B + C;", "A@ = B@ + C;");
doTest1("Java #2", "A = B + C;", "A@ = B@ + C;");
@@ -87,13 +86,13 @@ public class STextExtensionsTest extends STextTestBase {
doTest1("Java #9", "A = //B+C* D;", "A@ = //B+C* D;");
doTest1("Java #10", "A = //B+C`|D+E;", "A@ = //B+C`|D@+E;");
- processor = STextEngine.PROC_PROPERTY;
+ processor = STextProcessorFactory.PROC_PROPERTY;
state[0] = STextEngine.STATE_INITIAL;
doTest1("Property #0", "NAME,VAL1,VAL2", "NAME,VAL1,VAL2");
doTest1("Property #1", "NAME=VAL1,VAL2", "NAME@=VAL1,VAL2");
doTest1("Property #2", "NAME=VAL1,VAL2=VAL3", "NAME@=VAL1,VAL2=VAL3");
- processor = STextEngine.PROC_REGEXP;
+ processor = STextProcessorFactory.PROC_REGEXP;
state[0] = STextEngine.STATE_INITIAL;
data = toUT16("ABC(?") + "#" + toUT16("DEF)GHI");
doTest2("Regex #0.0", data, "A@B@C@(?#DEF)@G@H@I");
@@ -177,7 +176,7 @@ public class STextExtensionsTest extends STextTestBase {
doTest2("Regex #16.2", data, "<&#HI\\eJKL&^");
env = envHebrew;
- processor = STextEngine.PROC_SQL;
+ processor = STextProcessorFactory.PROC_SQL;
state[0] = STextEngine.STATE_INITIAL;
doTest1("SQL #0", "abc GHI", "abc GHI");
doTest1("SQL #1", "abc DEF GHI", "abc DEF@ GHI");
@@ -196,26 +195,26 @@ public class STextExtensionsTest extends STextTestBase {
doTest1("SQL #12", "ABC\"DEF \"\" G I\" JKL,MN", "ABC@\"DEF \"\" G I\"@ JKL@,MN");
doTest1("SQL #13", "ABC--DEF GHI`|JKL MN", "ABC@--DEF GHI`|JKL@ MN");
- processor = STextEngine.PROC_SYSTEM_USER;
+ processor = STextProcessorFactory.PROC_SYSTEM_USER;
state[0] = STextEngine.STATE_INITIAL;
doTest1("System #1", "HOST(JACK)", "HOST@(JACK)");
- processor = STextEngine.PROC_UNDERSCORE;
+ processor = STextProcessorFactory.PROC_UNDERSCORE;
state[0] = STextEngine.STATE_INITIAL;
doTest1("Underscore #1", "A_B_C_d_e_F_G", "A@_B@_C_d_e_F@_G");
- processor = STextEngine.PROC_URL;
+ processor = STextProcessorFactory.PROC_URL;
state[0] = STextEngine.STATE_INITIAL;
doTest1("URL #1", "WWW.DOMAIN.COM/DIR1/DIR2/dir3/DIR4", "WWW@.DOMAIN@.COM@/DIR1@/DIR2/dir3/DIR4");
- processor = STextEngine.PROC_XPATH;
+ processor = STextProcessorFactory.PROC_XPATH;
state[0] = STextEngine.STATE_INITIAL;
doTest1("Xpath #1", "abc(DEF)GHI", "abc(DEF@)GHI");
doTest1("Xpath #2", "DEF.GHI \"A.B\":JK ", "DEF@.GHI@ \"A.B\"@:JK ");
doTest1("Xpath #3", "DEF!GHI 'A!B'=JK ", "DEF@!GHI@ 'A!B'@=JK ");
doTest1("Xpath #4", "DEF.GHI 'A.B :JK ", "DEF@.GHI@ 'A.B :JK ");
- processor = STextEngine.PROC_EMAIL;
+ processor = STextProcessorFactory.PROC_EMAIL;
state[0] = STextEngine.STATE_INITIAL;
assertEquals("<>.:,;@", processor.getSeparators(null, "", null));
doTest3("DelimsEsc #1", "abc.DEF.GHI", "abc.DEF@.GHI");
diff --git a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextFullToLeanTest.java b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextFullToLeanTest.java
index 5c466fc..8c0358b 100644
--- a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextFullToLeanTest.java
+++ b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextFullToLeanTest.java
@@ -11,8 +11,7 @@
package org.eclipse.equinox.bidi.internal.tests;
-import org.eclipse.equinox.bidi.STextEngine;
-import org.eclipse.equinox.bidi.STextEnvironment;
+import org.eclipse.equinox.bidi.*;
import org.eclipse.equinox.bidi.custom.STextProcessor;
/**
@@ -96,7 +95,7 @@ public class STextFullToLeanTest extends STextTestBase {
public void testFullToLean() {
- processor = STextEngine.PROC_COMMA_DELIMITED;
+ processor = STextProcessorFactory.PROC_COMMA_DELIMITED;
doTest1("testFullToLean #1 - ", "", "", "", new int[0], new int[0], "", "", new int[0], new int[0]);
int[] map1 = new int[] {0, 1, 2, 3, 4};
int[] map2 = new int[] {2, 3, 4, 5, 6};
@@ -243,7 +242,7 @@ public class STextFullToLeanTest extends STextTestBase {
doTest1("testFullToLean #37 - ", ">>>@@@@@^^^", "", "", map1, map2, "", "", map1, map2);
// test fullToLeanText with initial state
- processor = STextEngine.PROC_SQL;
+ processor = STextProcessorFactory.PROC_SQL;
doTest2("testFullToLean #38 - ");
}
}
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 b334e5a..a52112b 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,8 +11,7 @@
package org.eclipse.equinox.bidi.internal.tests;
-import org.eclipse.equinox.bidi.STextEngine;
-import org.eclipse.equinox.bidi.STextEnvironment;
+import org.eclipse.equinox.bidi.*;
import org.eclipse.equinox.bidi.custom.STextProcessor;
/**
@@ -23,7 +22,7 @@ public class STextMathTest extends STextTestBase {
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;
+ STextProcessor processor = STextProcessorFactory.PROC_RTL_ARITHMETIC;
private void verifyOneLine(String msg, String data, String resLTR, String resRTL) {
String lean = toUT16(data);
diff --git a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextMethodsTest.java b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextMethodsTest.java
index c6c49ec..ebfabd9 100644
--- a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextMethodsTest.java
+++ b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextMethodsTest.java
@@ -11,8 +11,7 @@
package org.eclipse.equinox.bidi.internal.tests;
-import org.eclipse.equinox.bidi.STextEngine;
-import org.eclipse.equinox.bidi.STextEnvironment;
+import org.eclipse.equinox.bidi.*;
import org.eclipse.equinox.bidi.custom.STextProcessor;
/**
@@ -77,7 +76,7 @@ public class STextMethodsTest extends STextTestBase {
String data, lean, full, model;
int[] state = new int[1];
state[0] = -1;
- processor = STextEngine.PROC_JAVA;
+ processor = STextProcessorFactory.PROC_JAVA;
data = "A=B+C;/* D=E+F;";
lean = toUT16(data);
full = STextEngine.leanToFullText(processor, null, lean, state);
@@ -131,7 +130,7 @@ public class STextMethodsTest extends STextTestBase {
private void doTestLeanOffsets() {
String lean, data, label;
int[] state = new int[1];
- processor = STextEngine.PROC_JAVA;
+ processor = STextProcessorFactory.PROC_JAVA;
int[] offsets;
int[] model;
@@ -153,7 +152,7 @@ public class STextMethodsTest extends STextTestBase {
private void doTestFullOffsets(String label, String data, int[] resLTR, int[] resRTL, int[] resCon) {
String full, lean, msg;
int[] offsets;
- processor = STextEngine.PROC_COMMA_DELIMITED;
+ processor = STextProcessorFactory.PROC_COMMA_DELIMITED;
lean = toUT16(data);
full = STextEngine.leanToFullText(processor, envLTR, lean, null);
@@ -269,7 +268,7 @@ public class STextMethodsTest extends STextTestBase {
doTestOrientation();
- processor = STextEngine.PROC_COMMA_DELIMITED;
+ processor = STextProcessorFactory.PROC_COMMA_DELIMITED;
doTestOrient("Methods #1 ", "", "", "", "");
doTestOrient("Methods #2 ", "abc", "abc", ">@abc@^", "abc");
doTestOrient("Methods #3 ", "ABC", "ABC", ">@ABC@^", "@ABC");
@@ -290,7 +289,7 @@ public class STextMethodsTest extends STextTestBase {
doTestDirection();
- processor = STextEngine.PROC_COMMA_DELIMITED;
+ processor = STextProcessorFactory.PROC_COMMA_DELIMITED;
String data = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z";
String lean = toUT16(data);
String full = STextEngine.leanToFullText(processor, null, lean, null);
diff --git a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextStringRecordTest.java b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextStringRecordTest.java
index 2539897..5ba6506 100644
--- a/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextStringRecordTest.java
+++ b/bundles/org.eclipse.equinox.bidi.tests/src/org/eclipse/equinox/bidi/internal/tests/STextStringRecordTest.java
@@ -11,7 +11,7 @@
package org.eclipse.equinox.bidi.internal.tests;
-import org.eclipse.equinox.bidi.STextEngine;
+import org.eclipse.equinox.bidi.STextProcessorFactory;
import org.eclipse.equinox.bidi.STextStringRecord;
/**
@@ -24,7 +24,7 @@ public class STextStringRecordTest extends STextTestBase {
// check handling of invalid arguments
catchFlag = false;
try {
- sr = STextStringRecord.addRecord(null, 1, STextEngine.PROC_EMAIL, 0, 1);
+ sr = STextStringRecord.addRecord(null, 1, STextProcessorFactory.PROC_EMAIL, 0, 1);
} catch (IllegalArgumentException e) {
catchFlag = true;
}
@@ -38,35 +38,35 @@ public class STextStringRecordTest extends STextTestBase {
assertTrue("Catch null processor argument", catchFlag);
catchFlag = false;
try {
- sr = STextStringRecord.addRecord("abc", 0, STextEngine.PROC_EMAIL, 0, 1);
+ sr = STextStringRecord.addRecord("abc", 0, STextProcessorFactory.PROC_EMAIL, 0, 1);
} catch (IllegalArgumentException e) {
catchFlag = true;
}
assertTrue("Catch invalid segment count argument", catchFlag);
catchFlag = false;
try {
- sr = STextStringRecord.addRecord("abc", 1, STextEngine.PROC_EMAIL, -1, 1);
+ sr = STextStringRecord.addRecord("abc", 1, STextProcessorFactory.PROC_EMAIL, -1, 1);
} catch (IllegalArgumentException e) {
catchFlag = true;
}
assertTrue("Catch invalid start argument", catchFlag);
catchFlag = false;
try {
- sr = STextStringRecord.addRecord("abc", 1, STextEngine.PROC_EMAIL, 4, 1);
+ sr = STextStringRecord.addRecord("abc", 1, STextProcessorFactory.PROC_EMAIL, 4, 1);
} catch (IllegalArgumentException e) {
catchFlag = true;
}
assertTrue("Catch invalid start argument", catchFlag);
catchFlag = false;
try {
- sr = STextStringRecord.addRecord("abc", 1, STextEngine.PROC_EMAIL, 0, 0);
+ sr = STextStringRecord.addRecord("abc", 1, STextProcessorFactory.PROC_EMAIL, 0, 0);
} catch (IllegalArgumentException e) {
catchFlag = true;
}
assertTrue("Catch invalid limit argument", catchFlag);
catchFlag = false;
try {
- sr = STextStringRecord.addRecord("abc", 1, STextEngine.PROC_EMAIL, 0, 5);
+ sr = STextStringRecord.addRecord("abc", 1, STextProcessorFactory.PROC_EMAIL, 0, 5);
} catch (IllegalArgumentException e) {
catchFlag = true;
}
@@ -78,7 +78,7 @@ public class STextStringRecordTest extends STextTestBase {
assertEquals(null, sr);
for (int i = 0; i < lim; i++) {
String str = Integer.toString(i);
- sr = STextStringRecord.addRecord(str, 1, STextEngine.PROC_EMAIL, 0, 1);
+ sr = STextStringRecord.addRecord(str, 1, STextProcessorFactory.PROC_EMAIL, 0, 1);
}
sr = STextStringRecord.getRecord(null);
assertEquals(null, sr);
@@ -96,7 +96,7 @@ public class STextStringRecordTest extends STextTestBase {
for (int i = lim; i <= poolSize; i++) {
String str = Integer.toString(i);
- sr = STextStringRecord.addRecord(str, 1, STextEngine.PROC_EMAIL, 0, 1);
+ sr = STextStringRecord.addRecord(str, 1, STextProcessorFactory.PROC_EMAIL, 0, 1);
}
for (int i = 1; i <= poolSize; i++) {
String str = Integer.toString(i);
@@ -105,20 +105,20 @@ public class STextStringRecordTest extends STextTestBase {
}
sr = STextStringRecord.getRecord("0");
assertEquals(null, sr);
- sr = STextStringRecord.addRecord("thisisalongstring", 3, STextEngine.PROC_EMAIL, 0, 2);
- sr.addSegment(STextEngine.PROC_JAVA, 4, 5);
- sr.addSegment(STextEngine.PROC_FILE, 6, 7);
+ sr = STextStringRecord.addRecord("thisisalongstring", 3, STextProcessorFactory.PROC_EMAIL, 0, 2);
+ sr.addSegment(STextProcessorFactory.PROC_JAVA, 4, 5);
+ sr.addSegment(STextProcessorFactory.PROC_FILE, 6, 7);
catchFlag = false;
try {
- sr.addSegment(STextEngine.PROC_EMAIL, 10, 13);
+ sr.addSegment(STextProcessorFactory.PROC_EMAIL, 10, 13);
} catch (IllegalStateException e) {
catchFlag = true;
}
assertTrue("Catch too many segments", catchFlag);
assertEquals(3, sr.getSegmentCount());
- assertEquals(STextEngine.PROC_EMAIL, sr.getProcessor(0));
- assertEquals(STextEngine.PROC_JAVA, sr.getProcessor(1));
- assertEquals(STextEngine.PROC_FILE, sr.getProcessor(2));
+ assertEquals(STextProcessorFactory.PROC_EMAIL, sr.getProcessor(0));
+ assertEquals(STextProcessorFactory.PROC_JAVA, sr.getProcessor(1));
+ assertEquals(STextProcessorFactory.PROC_FILE, sr.getProcessor(2));
assertEquals(0, sr.getStart(0));
assertEquals(4, sr.getStart(1));
assertEquals(6, sr.getStart(2));
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 385f8c6..4eb0726 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
@@ -12,7 +12,7 @@
package org.eclipse.equinox.bidi.internal.tests;
import java.util.Locale;
-import org.eclipse.equinox.bidi.STextEngine;
+import org.eclipse.equinox.bidi.STextProcessorFactory;
import org.eclipse.equinox.bidi.STextUtil;
/**
@@ -83,9 +83,9 @@ public class STextUtilTest extends STextTestBase {
}
private void doTest3(String msg, String data, String result, String resLean) {
- String full = STextUtil.process(toUT16(data), STextEngine.PROC_COMMA_DELIMITED);
+ String full = STextUtil.process(toUT16(data), STextProcessorFactory.PROC_COMMA_DELIMITED);
assertEquals(msg + "full", result, toPseudo(full));
- String lean = STextUtil.deprocess(full, STextEngine.PROC_COMMA_DELIMITED);
+ String lean = STextUtil.deprocess(full, STextProcessorFactory.PROC_COMMA_DELIMITED);
assertEquals(msg + "lean", resLean, toPseudo(lean));
}
diff --git a/bundles/org.eclipse.equinox.bidi/schema/STextType.exsd b/bundles/org.eclipse.equinox.bidi/schema/STextType.exsd
index 664383f..543ea94 100644
--- a/bundles/org.eclipse.equinox.bidi/schema/STextType.exsd
+++ b/bundles/org.eclipse.equinox.bidi/schema/STextType.exsd
@@ -1,142 +1,142 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.equinox.bidi" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appInfo>
- <meta.schema plugin="org.eclipse.equinox.bidi" id="org.eclipse.equinox.bidi.bidiTypes" name="String types that need special bidirectional handling"/>
- </appInfo>
- <documentation>
- Use this extension point to describe processing for strings that need special bidirectional handling, such as file paths, SQL statements, or Java code.
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <appInfo>
- <meta.element />
- </appInfo>
- </annotation>
- <complexType>
- <sequence>
- <element ref="typeDescription" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- Unique identifier of this extension
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="typeDescription">
- <complexType>
- <attribute name="type" type="string" use="required">
- <annotation>
- <documentation>
- Type of the structured text that this processor will work on.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string">
- <annotation>
- <documentation>
- The processor that provides specialized bidirectional handling for this type of strings.
- </documentation>
- <appInfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.equinox.bidi.custom.ISTextProcessor"/>
- </appInfo>
- </annotation>
- </attribute>
- <attribute name="description" type="string">
- <annotation>
- <documentation>
- The description of the string type.
- </documentation>
- <appInfo>
- <meta.attribute translatable="true"/>
- </appInfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appInfo>
- <meta.section type="since"/>
- </appInfo>
- <documentation>
- 1.0
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="examples"/>
- </appInfo>
- <documentation>
- A processor for the structured text strings that support &quot;minus&quot; delimiters can be described as:
-
-&lt;pre&gt;
-public class STextSepMinus extends STextProcessor
-{
- public STextSepMinus()
- {
- super(&quot;-&quot;);
- }
-}
-&lt;/pre&gt;
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="apiinfo"/>
- </appInfo>
- <documentation>
- TBD
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="implementation"/>
- </appInfo>
- <documentation>
- All the classes mentioned as Examples
- </documentation>
- </annotation>
-
- <annotation>
- <appInfo>
- <meta.section type="copyright"/>
- </appInfo>
- <documentation>
- Copyright (c) 2011 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which
-accompanies this distribution, and is available at
-&lt;a
-href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
- </annotation>
-
-</schema>
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.equinox.bidi" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.equinox.bidi" id="org.eclipse.equinox.bidi.bidiTypes" name="String types that need special bidirectional handling"/>
+ </appInfo>
+ <documentation>
+ Use this extension point to describe processing for strings that need special bidirectional handling, such as file paths, SQL statements, or Java code.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="typeDescription" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ Unique identifier of this extension
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="typeDescription">
+ <complexType>
+ <attribute name="type" type="string" use="required">
+ <annotation>
+ <documentation>
+ Type of the structured text that this processor will work on.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+ The processor that provides specialized bidirectional handling for this type of strings.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.equinox.bidi.custom.STextProcessor:"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+ The description of the string type.
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 1.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ A processor for the structured text strings that support &quot;minus&quot; delimiters can be described as:
+
+&lt;pre&gt;
+public class STextSepMinus extends STextProcessor
+{
+ public STextSepMinus()
+ {
+ super(&quot;-&quot;);
+ }
+}
+&lt;/pre&gt;
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ TBD
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ All the classes mentioned as Examples
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2011 IBM Corporation and others.&lt;br&gt;
+All rights reserved. This program and the accompanying materials are made
+available under the terms of the Eclipse Public License v1.0 which
+accompanies this distribution, and is available at
+&lt;a
+href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
+ </documentation>
+ </annotation>
+
+</schema>
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 e2cc528..aa90a66 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
@@ -11,7 +11,6 @@
package org.eclipse.equinox.bidi;
import org.eclipse.equinox.bidi.custom.STextProcessor;
-import org.eclipse.equinox.bidi.custom.STextStringProcessor;
import org.eclipse.equinox.bidi.internal.STextImpl;
/**
@@ -20,7 +19,7 @@ import org.eclipse.equinox.bidi.internal.STextImpl;
* <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}
+ * {@link org.eclipse.equinox.bidi.STextProcessorFactory#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>
@@ -79,92 +78,6 @@ import org.eclipse.equinox.bidi.internal.STextImpl;
*
*/
public class STextEngine {
- /**
- * Constant indicating a type of structured text processor adapted
- * to processing property file statements. It expects the following
- * format:
- * <pre>
- * name=value
- * </pre>
- */
- public static final STextProcessor PROC_PROPERTY = STextStringProcessor.getProcessor("property"); //$NON-NLS-1$
-
- /**
- * Constant indicating a type of structured text processor adapted
- * to processing compound names.
- * This type covers names made of one or more parts separated by underscores:
- * <pre>
- * part1_part2_part3
- * </pre>
- */
- public static final STextProcessor PROC_UNDERSCORE = STextStringProcessor.getProcessor("underscore"); //$NON-NLS-1$
-
- /**
- * Constant indicating a type of structured text processor adapted
- * to processing comma-delimited lists, such as:
- * <pre>
- * part1,part2,part3
- * </pre>
- */
- public static final STextProcessor PROC_COMMA_DELIMITED = STextStringProcessor.getProcessor("comma"); //$NON-NLS-1$
-
- /**
- * Constant indicating a type of structured text processor adapted
- * to processing strings with the following format:
- * <pre>
- * system(user)
- * </pre>
- */
- public static final STextProcessor PROC_SYSTEM_USER = STextStringProcessor.getProcessor("system"); //$NON-NLS-1$
-
- /**
- * Constant indicating a type of structured text processor adapted
- * to processing directory and file paths.
- */
- public static final STextProcessor PROC_FILE = STextStringProcessor.getProcessor("file"); //$NON-NLS-1$
-
- /**
- * Constant indicating a type of structured text processor adapted
- * to processing e-mail addresses.
- */
- public static final STextProcessor PROC_EMAIL = STextStringProcessor.getProcessor("email"); //$NON-NLS-1$
-
- /**
- * Constant indicating a type of structured text processor adapted
- * to processing URLs.
- */
- public static final STextProcessor PROC_URL = STextStringProcessor.getProcessor("url"); //$NON-NLS-1$
-
- /**
- * Constant indicating a type of structured text processor adapted
- * to processing regular expressions, possibly spanning more than one
- * line.
- */
- public static final STextProcessor PROC_REGEXP = STextStringProcessor.getProcessor("regex"); //$NON-NLS-1$
-
- /**
- * Constant indicating a type of structured text processor adapted
- * to processing XPath expressions.
- */
- public static final STextProcessor PROC_XPATH = STextStringProcessor.getProcessor("xpath"); //$NON-NLS-1$
-
- /**
- * Constant indicating a type of structured text processor adapted
- * to processing Java code, possibly spanning more than one line.
- */
- public static final STextProcessor PROC_JAVA = STextStringProcessor.getProcessor("java"); //$NON-NLS-1$
-
- /**
- * Constant indicating a type of structured text processor adapted
- * to processing SQL statements, possibly spanning more than one line.
- */
- public static final STextProcessor PROC_SQL = STextStringProcessor.getProcessor("sql"); //$NON-NLS-1$
-
- /**
- * Constant indicating a type of structured text processor adapted
- * to processing arithmetic expressions, possibly with a RTL base direction.
- */
- public static final STextProcessor PROC_RTL_ARITHMETIC = STextStringProcessor.getProcessor("math"); //$NON-NLS-1$
/**
* Constant specifying that the base direction of a structured text is LTR.
diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/STextProcessorFactory.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/STextProcessorFactory.java
new file mode 100644
index 0000000..d15f338
--- /dev/null
+++ b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/STextProcessorFactory.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * Copyright (c) 2010, 2011 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.bidi;
+
+import org.eclipse.equinox.bidi.custom.STextProcessor;
+import org.eclipse.equinox.bidi.internal.STextTypesCollector;
+
+/**
+ * This class provides access to registered structured text processors.
+ *
+ * @noinstantiate This class is not intended to be instantiated by clients.
+ */
+final public class STextProcessorFactory {
+
+ /**
+ * Structured text processor for property file statements. It expects the following format:
+ * <pre>
+ * name=value
+ * </pre>
+ */
+ public static final STextProcessor PROC_PROPERTY = getProcessor("property"); //$NON-NLS-1$
+
+ /**
+ * Structured text processor for compound names. It expects text to be made of one or more
+ * parts separated by underscores:
+ * <pre>
+ * part1_part2_part3
+ * </pre>
+ */
+ public static final STextProcessor PROC_UNDERSCORE = getProcessor("underscore"); //$NON-NLS-1$
+
+ /**
+ * Structured text processor for comma-delimited lists, such as:
+ * <pre>
+ * part1,part2,part3
+ * </pre>
+ */
+ public static final STextProcessor PROC_COMMA_DELIMITED = getProcessor("comma"); //$NON-NLS-1$
+
+ /**
+ * Structured text processor for strings with the following format:
+ * <pre>
+ * system(user)
+ * </pre>
+ */
+ public static final STextProcessor PROC_SYSTEM_USER = getProcessor("system"); //$NON-NLS-1$
+
+ /**
+ * Structured text processor for directory and file paths.
+ */
+ public static final STextProcessor PROC_FILE = getProcessor("file"); //$NON-NLS-1$
+
+ /**
+ * Structured text processor for e-mail addresses.
+ */
+ public static final STextProcessor PROC_EMAIL = getProcessor("email"); //$NON-NLS-1$
+
+ /**
+ * Structured text processor for URLs.
+ */
+ public static final STextProcessor PROC_URL = getProcessor("url"); //$NON-NLS-1$
+
+ /**
+ * Structured text processor for regular expressions, possibly spanning multiple lines.
+ */
+ public static final STextProcessor PROC_REGEXP = getProcessor("regex"); //$NON-NLS-1$
+
+ /**
+ * Structured text processor for XPath expressions.
+ */
+ public static final STextProcessor PROC_XPATH = getProcessor("xpath"); //$NON-NLS-1$
+
+ /**
+ * Structured text processor for Java code, possibly spanning multiple lines.
+ */
+ public static final STextProcessor PROC_JAVA = getProcessor("java"); //$NON-NLS-1$
+
+ /**
+ * Structured text processor for SQL statements, possibly spanning multiple lines.
+ */
+ public static final STextProcessor PROC_SQL = getProcessor("sql"); //$NON-NLS-1$
+
+ /**
+ * Structured text processor for arithmetic expressions, possibly with a RTL base direction.
+ */
+ public static final STextProcessor PROC_RTL_ARITHMETIC = getProcessor("math"); //$NON-NLS-1$
+
+ /**
+ * Prevents instantiation
+ */
+ private STextProcessorFactory() {
+ // placeholder
+ }
+
+ /**
+ * Retrieve all IDs of registered structured text processors.
+ * @return an array of text processor IDs.
+ */
+ static public String[] getAllProcessorIDs() {
+ return STextTypesCollector.getInstance().getTypes();
+ }
+
+ /**
+ * Obtain a structured text processor of a given type.
+ * @param id string identifying processor
+ * @return a processor of the required type, or <code>null</code> if the type is unknown
+ */
+ static public STextProcessor getProcessor(String id) {
+ return STextTypesCollector.getInstance().getProcessor(id);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/custom/STextStringProcessor.java b/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/custom/STextStringProcessor.java
deleted file mode 100644
index 04e9479..0000000
--- a/bundles/org.eclipse.equinox.bidi/src/org/eclipse/equinox/bidi/custom/STextStringProcessor.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2011 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-package org.eclipse.equinox.bidi.custom;
-
-import org.eclipse.equinox.bidi.internal.STextTypesCollector;
-
-/**
- * This class provides access to registered structured text processors.
- */
-public class STextStringProcessor {
- /**
- * Retrieve all registered types of structured text processors.
- *
- * @return an array of strings, each string identifying a type of
- * structured text processor.
- */
- static public String[] getKnownTypes() {
- return STextTypesCollector.getInstance().getTypes();
- }
-
- /**
- * Get access to a structured text processor of a given type.
- *
- * @param type string identifying a type of processor
- *
- * @return a reference to an instance of a processor of the
- * required type. If the type is unknown, return <code>null</code>.
- */
- static public STextProcessor getProcessor(String type) {
- return STextTypesCollector.getInstance().getProcessor(type);
- }
-}