You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by al...@apache.org on 2006/11/22 17:50:31 UTC

svn commit: r478232 [21/22] - in /incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima: taeconfigurator/ taeconfigurator/editors/ taeconfigurator/editors/ui/ taeconfigurator/editors/ui/dialogs/ taeconfigurator/editors/xml/ tae...

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/FsIndexCollectionNewWizard.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/FsIndexCollectionNewWizard.java?view=diff&rev=478232&r1=478231&r2=478232
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/FsIndexCollectionNewWizard.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/FsIndexCollectionNewWizard.java Wed Nov 22 08:50:24 2006
@@ -24,38 +24,34 @@
 import org.eclipse.ui.INewWizard;
 
 /**
- * Create a new file resource in the provided container. 
- * If the container resource (a folder or a project) is selected 
- * in the workspace when the wizard is opened, it will accept 
- * it as the target container. If a sample multi-page editor 
- * is registered for the same extension, it will be able to open it.
+ * Create a new file resource in the provided container. If the container resource (a folder or a
+ * project) is selected in the workspace when the wizard is opened, it will accept it as the target
+ * container. If a sample multi-page editor is registered for the same extension, it will be able to
+ * open it.
  */
 
 public class FsIndexCollectionNewWizard extends AbstractNewWizard implements INewWizard {
 
-  public static final String FSINDEXCOLLECTION_TEMPLATE = 
-    "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
-    + "<fsIndexCollection " + XMLNS_PART
-    + "<name>{0}</name>\n"
-    + "<description></description>\n"
-    + "<version>1.0</version>\n"
-    + "<vendor></vendor>\n"
-    + "{1}"
-    + "</fsIndexCollection>\n";
+  public static final String FSINDEXCOLLECTION_TEMPLATE = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
+                  + "<fsIndexCollection "
+                  + XMLNS_PART
+                  + "<name>{0}</name>\n"
+                  + "<description></description>\n"
+                  + "<version>1.0</version>\n"
+                  + "<vendor></vendor>\n" + "{1}" + "</fsIndexCollection>\n";
 
-  
-	public FsIndexCollectionNewWizard() {
-		super("New Index Collection Descriptor File");
-	}
-	
-	public void addPages() {
-		page = new FsIndexCollectionNewWizardPage(selection);
-		addPage(page);
-	}
+  public FsIndexCollectionNewWizard() {
+    super("New Index Collection Descriptor File");
+  }
 
-	public String getPrototypeDescriptor(String name) {
-	  return MessageFormat.format(FSINDEXCOLLECTION_TEMPLATE, new Object[] {
-        name, "<fsIndexDescription></fsIndexDescription>\n"});
-	}
+  public void addPages() {
+    page = new FsIndexCollectionNewWizardPage(selection);
+    addPage(page);
+  }
+
+  public String getPrototypeDescriptor(String name) {
+    return MessageFormat.format(FSINDEXCOLLECTION_TEMPLATE, new Object[] { name,
+        "<fsIndexDescription></fsIndexDescription>\n" });
+  }
 
 }

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/FsIndexCollectionNewWizardPage.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/FsIndexCollectionNewWizardPage.java?view=diff&rev=478232&r1=478231&r2=478232
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/FsIndexCollectionNewWizardPage.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/FsIndexCollectionNewWizardPage.java Wed Nov 22 08:50:24 2006
@@ -22,19 +22,17 @@
 import org.eclipse.jface.viewers.ISelection;
 
 /**
- * The "New" wizard page allows setting the container for
- * the new file as well as the file name. Will only accept 
- * file name without the extension OR with the extension 
- * that matches the expected one (xml).
+ * The "New" wizard page allows setting the container for the new file as well as the file name.
+ * Will only accept file name without the extension OR with the extension that matches the expected
+ * one (xml).
  */
 
 public class FsIndexCollectionNewWizardPage extends AbstractNewWizardPage {
 
-	public FsIndexCollectionNewWizardPage(ISelection selection) {
-	  super(selection, "big_ae.gif",
-	      "Index Collection Descriptor File",
-	      "Create a new Index Collection Descriptor file",
-	      "indexCollectionDescriptor.xml");
-	}
+  public FsIndexCollectionNewWizardPage(ISelection selection) {
+    super(selection, "big_ae.gif", "Index Collection Descriptor File",
+                    "Create a new Index Collection Descriptor file",
+                    "indexCollectionDescriptor.xml");
+  }
 
 }

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/ResourceManagerConfigurationNewWizard.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/ResourceManagerConfigurationNewWizard.java?view=diff&rev=478232&r1=478231&r2=478232
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/ResourceManagerConfigurationNewWizard.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/ResourceManagerConfigurationNewWizard.java Wed Nov 22 08:50:24 2006
@@ -24,38 +24,37 @@
 import org.eclipse.ui.INewWizard;
 
 /**
- * Create a new file resource in the provided container. 
- * If the container resource (a folder or a project) is selected 
- * in the workspace when the wizard is opened, it will accept 
- * it as the target container. If a sample multi-page editor 
- * is registered for the same extension, it will be able to open it.
+ * Create a new file resource in the provided container. If the container resource (a folder or a
+ * project) is selected in the workspace when the wizard is opened, it will accept it as the target
+ * container. If a sample multi-page editor is registered for the same extension, it will be able to
+ * open it.
  */
 
 public class ResourceManagerConfigurationNewWizard extends AbstractNewWizard implements INewWizard {
 
-  public static final String RESOURCEMANGERCONFIGURATION_TEMPLATE = 
-    "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
-    + "<resourceManagerConfiguration " + XMLNS_PART
-    + "<name>{0}</name>\n"
-    + "<description></description>\n"
-    + "<version>1.0</version>\n"
-    + "{1}"
-    + "</resourceManagerConfiguration>\n";
+  public static final String RESOURCEMANGERCONFIGURATION_TEMPLATE = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
+                  + "<resourceManagerConfiguration "
+                  + XMLNS_PART
+                  + "<name>{0}</name>\n"
+                  + "<description></description>\n"
+                  + "<version>1.0</version>\n"
+                  + "{1}"
+                  + "</resourceManagerConfiguration>\n";
 
-  
-	public ResourceManagerConfigurationNewWizard() {
-		super("External Resource and Bindings (Resource Manager Configuration) Descriptor File");
-	}
-	
-	public void addPages() {
-		page = new ResourceManagerConfigurationNewWizardPage(selection);
-		addPage(page);
-	}
+  public ResourceManagerConfigurationNewWizard() {
+    super("External Resource and Bindings (Resource Manager Configuration) Descriptor File");
+  }
 
-	public String getPrototypeDescriptor(String name) {
-	  return MessageFormat.format(RESOURCEMANGERCONFIGURATION_TEMPLATE, new Object[] {
-        name, "<externalResources></externalResources>\n" +
-            "<externalResourceBindings></externalResourceBindings>\n"}); 
-	}
+  public void addPages() {
+    page = new ResourceManagerConfigurationNewWizardPage(selection);
+    addPage(page);
+  }
+
+  public String getPrototypeDescriptor(String name) {
+    return MessageFormat.format(RESOURCEMANGERCONFIGURATION_TEMPLATE, new Object[] {
+        name,
+        "<externalResources></externalResources>\n"
+                        + "<externalResourceBindings></externalResourceBindings>\n" });
+  }
 
 }

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/ResourceManagerConfigurationNewWizardPage.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/ResourceManagerConfigurationNewWizardPage.java?view=diff&rev=478232&r1=478231&r2=478232
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/ResourceManagerConfigurationNewWizardPage.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/ResourceManagerConfigurationNewWizardPage.java Wed Nov 22 08:50:24 2006
@@ -22,19 +22,20 @@
 import org.eclipse.jface.viewers.ISelection;
 
 /**
- * The "New" wizard page allows setting the container for
- * the new file as well as the file name. Will only accept 
- * file name without the extension OR with the extension 
- * that matches the expected one (xml).
+ * The "New" wizard page allows setting the container for the new file as well as the file name.
+ * Will only accept file name without the extension OR with the extension that matches the expected
+ * one (xml).
  */
 
 public class ResourceManagerConfigurationNewWizardPage extends AbstractNewWizardPage {
 
-	public ResourceManagerConfigurationNewWizardPage(ISelection selection) {
-	  super(selection, "big_ae.gif",
-	      "External Resources and Bindings (Resource Manager Configuration) Descriptor File",
-	      "Create a new External Resource and Bindings (Resource Manager Configuration) Descriptor file",
-	      "extResAndBindingsDescriptor.xml");
-	}
+  public ResourceManagerConfigurationNewWizardPage(ISelection selection) {
+    super(
+                    selection,
+                    "big_ae.gif",
+                    "External Resources and Bindings (Resource Manager Configuration) Descriptor File",
+                    "Create a new External Resource and Bindings (Resource Manager Configuration) Descriptor file",
+                    "extResAndBindingsDescriptor.xml");
+  }
 
 }

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TAEConfiguratorNewWizard.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TAEConfiguratorNewWizard.java?view=diff&rev=478232&r1=478231&r2=478232
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TAEConfiguratorNewWizard.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TAEConfiguratorNewWizard.java Wed Nov 22 08:50:24 2006
@@ -22,54 +22,46 @@
 import org.eclipse.ui.INewWizard;
 
 /**
- * Create a new file resource in the provided container. 
- * If the container resource (a folder or a project) is selected 
- * in the workspace when the wizard is opened, it will accept 
- * it as the target container. If a sample multi-page editor 
- * is registered for the same extension, it will be able to open it.
+ * Create a new file resource in the provided container. If the container resource (a folder or a
+ * project) is selected in the workspace when the wizard is opened, it will accept it as the target
+ * container. If a sample multi-page editor is registered for the same extension, it will be able to
+ * open it.
  * 
- * Following Eclipse conventions, the new Wizard will actually create
- * the resource in the file system and in the Eclipse resource space,
- * with initial contents, and then open the resource with the CDE.
+ * Following Eclipse conventions, the new Wizard will actually create the resource in the file
+ * system and in the Eclipse resource space, with initial contents, and then open the resource with
+ * the CDE.
  */
 
 public class TAEConfiguratorNewWizard extends AbstractNewWizard implements INewWizard {
 
-  public TAEConfiguratorNewWizard () {
+  public TAEConfiguratorNewWizard() {
     super("New Analysis Engine Descriptor File");
   }
-  
-	public void addPages() {
-		page = new TAEConfiguratorNewWizardPage(selection);
-		addPage(page);
-	}
-	
-	public String getPrototypeDescriptor(String name) {
-	  return "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
-	  +  "<analysisEngineDescription " + XMLNS_PART
-	  +    "<frameworkImplementation>org.apache.uima.java</frameworkImplementation>\n"
-	  +    "<primitive>true</primitive>\n"
-	  +    "<annotatorImplementationName></annotatorImplementationName>\n"
-	  +    "<analysisEngineMetaData>\n"
-	  +      "<name>" + name + "</name>\n"
-    +      "<description></description>\n"
-    +      "<version>1.0</version>\n"
-    +      "<vendor></vendor>\n"
-	  +      "<configurationParameters></configurationParameters>\n"
-	  +      "<configurationParameterSettings></configurationParameterSettings>\n"
-	  +      "<typeSystemDescription></typeSystemDescription>\n"
-    +      "<typePriorities></typePriorities>\n"
-    +      "<fsIndexCollection></fsIndexCollection>\n"
-	  +      "<capabilities>\n"
-	  +        "<capability>\n"
-	  +          "<inputs></inputs>\n"
-	  +          "<outputs></outputs>\n"
-	  +          "<languagesSupported></languagesSupported>\n"
-	  +        "</capability>\n"
-	  +      "</capabilities>\n"
-	  +    "</analysisEngineMetaData>\n"
-    +    "<externalResourceDependencies></externalResourceDependencies>\n"
-    +    "<resourceManagerConfiguration></resourceManagerConfiguration>\n"
-	  +  "</analysisEngineDescription>\n";
-	}
+
+  public void addPages() {
+    page = new TAEConfiguratorNewWizardPage(selection);
+    addPage(page);
+  }
+
+  public String getPrototypeDescriptor(String name) {
+    return "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" + "<analysisEngineDescription "
+                    + XMLNS_PART
+                    + "<frameworkImplementation>org.apache.uima.java</frameworkImplementation>\n"
+                    + "<primitive>true</primitive>\n"
+                    + "<annotatorImplementationName></annotatorImplementationName>\n"
+                    + "<analysisEngineMetaData>\n" + "<name>" + name + "</name>\n"
+                    + "<description></description>\n" + "<version>1.0</version>\n"
+                    + "<vendor></vendor>\n"
+                    + "<configurationParameters></configurationParameters>\n"
+                    + "<configurationParameterSettings></configurationParameterSettings>\n"
+                    + "<typeSystemDescription></typeSystemDescription>\n"
+                    + "<typePriorities></typePriorities>\n"
+                    + "<fsIndexCollection></fsIndexCollection>\n" + "<capabilities>\n"
+                    + "<capability>\n" + "<inputs></inputs>\n" + "<outputs></outputs>\n"
+                    + "<languagesSupported></languagesSupported>\n" + "</capability>\n"
+                    + "</capabilities>\n" + "</analysisEngineMetaData>\n"
+                    + "<externalResourceDependencies></externalResourceDependencies>\n"
+                    + "<resourceManagerConfiguration></resourceManagerConfiguration>\n"
+                    + "</analysisEngineDescription>\n";
+  }
 }

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TAEConfiguratorNewWizardPage.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TAEConfiguratorNewWizardPage.java?view=diff&rev=478232&r1=478231&r2=478232
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TAEConfiguratorNewWizardPage.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TAEConfiguratorNewWizardPage.java Wed Nov 22 08:50:24 2006
@@ -22,18 +22,15 @@
 import org.eclipse.jface.viewers.ISelection;
 
 /**
- * The "New" wizard page allows setting the container for
- * the new file as well as the file name. Will only accept 
- * file name without the extension OR with the extension 
- * that matches the expected one (xml).
+ * The "New" wizard page allows setting the container for the new file as well as the file name.
+ * Will only accept file name without the extension OR with the extension that matches the expected
+ * one (xml).
  */
 
 public class TAEConfiguratorNewWizardPage extends AbstractNewWizardPage {
 
   public TAEConfiguratorNewWizardPage(ISelection selection) {
-	  super(selection, "big_ae.gif",
-	      "Analysis Engine (AE) Descriptor File",
-	      "Create a new AE Descriptor File",
-	      "aeDescriptor.xml");		
-	}
+    super(selection, "big_ae.gif", "Analysis Engine (AE) Descriptor File",
+                    "Create a new AE Descriptor File", "aeDescriptor.xml");
+  }
 }

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TypePrioritiesNewWizard.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TypePrioritiesNewWizard.java?view=diff&rev=478232&r1=478231&r2=478232
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TypePrioritiesNewWizard.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TypePrioritiesNewWizard.java Wed Nov 22 08:50:24 2006
@@ -24,37 +24,34 @@
 import org.eclipse.ui.INewWizard;
 
 /**
- * Create a new file resource in the provided container. 
- * If the container resource (a folder or a project) is selected 
- * in the workspace when the wizard is opened, it will accept 
- * it as the target container. If a sample multi-page editor 
- * is registered for the same extension, it will be able to open it.
+ * Create a new file resource in the provided container. If the container resource (a folder or a
+ * project) is selected in the workspace when the wizard is opened, it will accept it as the target
+ * container. If a sample multi-page editor is registered for the same extension, it will be able to
+ * open it.
  */
 
 public class TypePrioritiesNewWizard extends AbstractNewWizard implements INewWizard {
 
-  public static final String TYPEPRIORITIES_TEMPLATE = 
-    "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
-    + "<typePriorities " + XMLNS_PART
-    + "<name>{0}</name>\n"
-    + "<description></description>\n"
-    + "<version>1.0</version>\n"
-    + "<vendor></vendor>\n"
-    + "{1}"
-    + "</typePriorities>\n";
+  public static final String TYPEPRIORITIES_TEMPLATE = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
+                  + "<typePriorities "
+                  + XMLNS_PART
+                  + "<name>{0}</name>\n"
+                  + "<description></description>\n"
+                  + "<version>1.0</version>\n"
+                  + "<vendor></vendor>\n" + "{1}" + "</typePriorities>\n";
 
-	public TypePrioritiesNewWizard() {
-		super("New Type Priorities Descriptor File");
-	}
-	
-	public void addPages() {
-		page = new TypePrioritiesNewWizardPage(selection);
-		addPage(page);
-	}
+  public TypePrioritiesNewWizard() {
+    super("New Type Priorities Descriptor File");
+  }
 
-	public String getPrototypeDescriptor(String name) {
-	  return MessageFormat.format(TYPEPRIORITIES_TEMPLATE, new Object[] {
-        name, "<priorityLists></priorityLists>\n"});
-	}
+  public void addPages() {
+    page = new TypePrioritiesNewWizardPage(selection);
+    addPage(page);
+  }
+
+  public String getPrototypeDescriptor(String name) {
+    return MessageFormat.format(TYPEPRIORITIES_TEMPLATE, new Object[] { name,
+        "<priorityLists></priorityLists>\n" });
+  }
 
 }

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TypePrioritiesNewWizardPage.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TypePrioritiesNewWizardPage.java?view=diff&rev=478232&r1=478231&r2=478232
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TypePrioritiesNewWizardPage.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TypePrioritiesNewWizardPage.java Wed Nov 22 08:50:24 2006
@@ -22,19 +22,16 @@
 import org.eclipse.jface.viewers.ISelection;
 
 /**
- * The "New" wizard page allows setting the container for
- * the new file as well as the file name. Will only accept 
- * file name without the extension OR with the extension 
- * that matches the expected one (xml).
+ * The "New" wizard page allows setting the container for the new file as well as the file name.
+ * Will only accept file name without the extension OR with the extension that matches the expected
+ * one (xml).
  */
 
 public class TypePrioritiesNewWizardPage extends AbstractNewWizardPage {
 
-	public TypePrioritiesNewWizardPage(ISelection selection) {
-	  super(selection, "big_t_s_.gif",
-	      "Type Priorities Descriptor File",
-	      "Create a new Type Priorities Descriptor file",
-	      "typePrioritiesDescriptor.xml");
-	}
+  public TypePrioritiesNewWizardPage(ISelection selection) {
+    super(selection, "big_t_s_.gif", "Type Priorities Descriptor File",
+                    "Create a new Type Priorities Descriptor file", "typePrioritiesDescriptor.xml");
+  }
 
 }

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TypeSystemNewWizard.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TypeSystemNewWizard.java?view=diff&rev=478232&r1=478231&r2=478232
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TypeSystemNewWizard.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TypeSystemNewWizard.java Wed Nov 22 08:50:24 2006
@@ -24,37 +24,30 @@
 import org.eclipse.ui.INewWizard;
 
 /**
- * Create a new file resource in the provided container. 
- * If the container resource (a folder or a project) is selected 
- * in the workspace when the wizard is opened, it will accept 
- * it as the target container. If a sample multi-page editor 
- * is registered for the same extension, it will be able to open it.
+ * Create a new file resource in the provided container. If the container resource (a folder or a
+ * project) is selected in the workspace when the wizard is opened, it will accept it as the target
+ * container. If a sample multi-page editor is registered for the same extension, it will be able to
+ * open it.
  */
 
 public class TypeSystemNewWizard extends AbstractNewWizard implements INewWizard {
 
-  public static final String TYPESYSTEM_TEMPLATE = 
-    "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
-    + "<typeSystemDescription " + XMLNS_PART
-    + "<name>{0}</name>\n"
-    + "<description></description>\n"
-    + "<version>1.0</version>\n"
-    + "<vendor></vendor>\n"
-    + "{1}"
-    + "</typeSystemDescription>\n";
-  
-	public TypeSystemNewWizard() {
-		super("New Type System Descriptor File");
-	}
-	
-	public void addPages() {
-		page = new TypeSystemNewWizardPage(selection);
-		addPage(page);
-	}
+  public static final String TYPESYSTEM_TEMPLATE = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
+                  + "<typeSystemDescription " + XMLNS_PART + "<name>{0}</name>\n"
+                  + "<description></description>\n" + "<version>1.0</version>\n"
+                  + "<vendor></vendor>\n" + "{1}" + "</typeSystemDescription>\n";
 
-	public String getPrototypeDescriptor(String name) {
-	  return MessageFormat.format(TYPESYSTEM_TEMPLATE, new Object[] {
-        name, "<types></types>\n"});
-	}
+  public TypeSystemNewWizard() {
+    super("New Type System Descriptor File");
+  }
+
+  public void addPages() {
+    page = new TypeSystemNewWizardPage(selection);
+    addPage(page);
+  }
+
+  public String getPrototypeDescriptor(String name) {
+    return MessageFormat.format(TYPESYSTEM_TEMPLATE, new Object[] { name, "<types></types>\n" });
+  }
 
 }

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TypeSystemNewWizardPage.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TypeSystemNewWizardPage.java?view=diff&rev=478232&r1=478231&r2=478232
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TypeSystemNewWizardPage.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/taeconfigurator/wizards/TypeSystemNewWizardPage.java Wed Nov 22 08:50:24 2006
@@ -22,19 +22,16 @@
 import org.eclipse.jface.viewers.ISelection;
 
 /**
- * The "New" wizard page allows setting the container for
- * the new file as well as the file name. Will only accept 
- * file name without the extension OR with the extension 
- * that matches the expected one (xml).
+ * The "New" wizard page allows setting the container for the new file as well as the file name.
+ * Will only accept file name without the extension OR with the extension that matches the expected
+ * one (xml).
  */
 
 public class TypeSystemNewWizardPage extends AbstractNewWizardPage {
 
-	public TypeSystemNewWizardPage(ISelection selection) {
-	  super(selection, "big_t_s_.gif",
-	      "Type System Descriptor File",
-	      "Create a new Type System Descriptor file",
-	      "typeSystemDescriptor.xml");
-	}
+  public TypeSystemNewWizardPage(ISelection selection) {
+    super(selection, "big_t_s_.gif", "Type System Descriptor File",
+                    "Create a new Type System Descriptor file", "typeSystemDescriptor.xml");
+  }
 
 }

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/typesystem/ITypeSystemInfo.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/typesystem/ITypeSystemInfo.java?view=diff&rev=478232&r1=478231&r2=478232
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/typesystem/ITypeSystemInfo.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/typesystem/ITypeSystemInfo.java Wed Nov 22 08:50:24 2006
@@ -21,26 +21,25 @@
 
 public interface ITypeSystemInfo {
 
-	/**
-	 * Returns the type system full name.
-	 * 
-	 * @return the type system full name.
-	 */
-	public String getFullName();
-	
-	/**
-	 * Returns the type system name.
-	 * 
-	 * @return the type system name.
-	 */
-	public String getName();
-	
-	/**
-	 * Returns the type system package name.
-	 * 
-	 * @return the type system package name.
-	 */ 
-	public String getPackageName();
-	
+  /**
+   * Returns the type system full name.
+   * 
+   * @return the type system full name.
+   */
+  public String getFullName();
+
+  /**
+   * Returns the type system name.
+   * 
+   * @return the type system name.
+   */
+  public String getName();
+
+  /**
+   * Returns the type system package name.
+   * 
+   * @return the type system package name.
+   */
+  public String getPackageName();
 
 }

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/typesystem/OpenTypeSystemSelectionDialog.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/typesystem/OpenTypeSystemSelectionDialog.java?view=diff&rev=478232&r1=478231&r2=478232
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/typesystem/OpenTypeSystemSelectionDialog.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/typesystem/OpenTypeSystemSelectionDialog.java Wed Nov 22 08:50:24 2006
@@ -28,137 +28,139 @@
 
 import org.eclipse.jface.dialogs.IDialogSettings;
 
-
 /**
- * A dialog to select a type from a list of types. The selected type will be
- * opened in the editor.
+ * A dialog to select a type from a list of types. The selected type will be opened in the editor.
  */
 public class OpenTypeSystemSelectionDialog extends TypeSystemSelectionDialog {
 
-	/** The dialog location. */
-	private Point fLocation;
-	/** The dialog size. */
-	private Point fSize;
-
-	/**
-	 * Constructs an instance of <code>OpenTypeSelectionDialog</code>.
-	 * @param parent  the parent shell.
-	 * @param typeSystemList an ArrayList of ITypeSystemInfo to be searched.
-	 */
-	public OpenTypeSystemSelectionDialog(Shell parent, ArrayList typeSystemList) {
-		super(parent, typeSystemList);
-	}
-	
-	/*
-	 * @see org.eclipse.jface.window.Window#configureShell(Shell)
-	 */
-	protected void configureShell(Shell newShell) {
-		super.configureShell(newShell);
-		//WorkbenchHelp.setHelp(newShell, IJavaHelpContextIds.OPEN_TYPE_DIALOG);
-	}
-
-	/*
-	 * @see Window#close()
-	 */
-	public boolean close() {
-		writeSettings();
-		return super.close();
-	}
-
-	/*
-	 * @see org.eclipse.jface.window.Window#createContents(org.eclipse.swt.widgets.Composite)
-	 */
-	protected Control createContents(Composite parent) {
-		Control control= super.createContents(parent);
-		readSettings();
-		return control;
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.eclipse.jface.window.Window#getInitialSize()
-	 */
-	protected Point getInitialSize() {
-		Point result= super.getInitialSize();
-		if (fSize != null) {
-			result.x= Math.max(result.x, fSize.x);
-			result.y= Math.max(result.y, fSize.y);
-			Rectangle display= getShell().getDisplay().getClientArea();
-			result.x= Math.min(result.x, display.width);
-			result.y= Math.min(result.y, display.height);
-		}
-		return result;
-	}
-	
-	/* (non-Javadoc)
-	 * @see org.eclipse.jface.window.Window#getInitialLocation(org.eclipse.swt.graphics.Point)
-	 */
-	protected Point getInitialLocation(Point initialSize) {
-		Point result= super.getInitialLocation(initialSize);
-		if (fLocation != null) {
-			result.x= fLocation.x;
-			result.y= fLocation.y;
-			Rectangle display= getShell().getDisplay().getClientArea();
-			int xe= result.x + initialSize.x;
-			if (xe > display.width) {
-				result.x-= xe - display.width; 
-			}
-			int ye= result.y + initialSize.y;
-			if (ye > display.height) {
-				result.y-= ye - display.height; 
-			}
-		}
-		return result;
-	}
-
-
-
-	/**
-	 * Initializes itself from the dialog settings with the same state
-	 * as at the previous invocation.
-	 */
-	private void readSettings() {
-		IDialogSettings s= getDialogSettings();
-		try {
-			int x= s.getInt("x"); //$NON-NLS-1$
-			int y= s.getInt("y"); //$NON-NLS-1$
-			fLocation= new Point(x, y);
-			int width= s.getInt("width"); //$NON-NLS-1$
-			int height= s.getInt("height"); //$NON-NLS-1$
-			fSize= new Point(width, height);
-
-		} catch (NumberFormatException e) {
-			fLocation= null;
-			fSize= null;
-		}
-	}
-
-	/**
-	 * Stores it current configuration in the dialog store.
-	 */
-	private void writeSettings() {
-		IDialogSettings s= getDialogSettings();
-
-		Point location= getShell().getLocation();
-		s.put("x", location.x); //$NON-NLS-1$
-		s.put("y", location.y); //$NON-NLS-1$
-
-		Point size= getShell().getSize();
-		s.put("width", size.x); //$NON-NLS-1$
-		s.put("height", size.y); //$NON-NLS-1$
-	}
-
-	/**
-	 * Returns the dialog settings object used to share state
-	 * between several find/replace dialogs.
-	 *
-	 * @return the dialog settings to be used
-	 */
-	private IDialogSettings getDialogSettings() {
-		IDialogSettings settings= TypeSystemSelectionPlugin.getDefault().getDialogSettings();
-		String sectionName= getClass().getName();
-		IDialogSettings subSettings= settings.getSection(sectionName);
-		if (subSettings == null)
-			subSettings= settings.addNewSection(sectionName);
-		return subSettings;
-	}
+  /** The dialog location. */
+  private Point fLocation;
+
+  /** The dialog size. */
+  private Point fSize;
+
+  /**
+   * Constructs an instance of <code>OpenTypeSelectionDialog</code>.
+   * 
+   * @param parent
+   *          the parent shell.
+   * @param typeSystemList
+   *          an ArrayList of ITypeSystemInfo to be searched.
+   */
+  public OpenTypeSystemSelectionDialog(Shell parent, ArrayList typeSystemList) {
+    super(parent, typeSystemList);
+  }
+
+  /*
+   * @see org.eclipse.jface.window.Window#configureShell(Shell)
+   */
+  protected void configureShell(Shell newShell) {
+    super.configureShell(newShell);
+    // WorkbenchHelp.setHelp(newShell, IJavaHelpContextIds.OPEN_TYPE_DIALOG);
+  }
+
+  /*
+   * @see Window#close()
+   */
+  public boolean close() {
+    writeSettings();
+    return super.close();
+  }
+
+  /*
+   * @see org.eclipse.jface.window.Window#createContents(org.eclipse.swt.widgets.Composite)
+   */
+  protected Control createContents(Composite parent) {
+    Control control = super.createContents(parent);
+    readSettings();
+    return control;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.window.Window#getInitialSize()
+   */
+  protected Point getInitialSize() {
+    Point result = super.getInitialSize();
+    if (fSize != null) {
+      result.x = Math.max(result.x, fSize.x);
+      result.y = Math.max(result.y, fSize.y);
+      Rectangle display = getShell().getDisplay().getClientArea();
+      result.x = Math.min(result.x, display.width);
+      result.y = Math.min(result.y, display.height);
+    }
+    return result;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.window.Window#getInitialLocation(org.eclipse.swt.graphics.Point)
+   */
+  protected Point getInitialLocation(Point initialSize) {
+    Point result = super.getInitialLocation(initialSize);
+    if (fLocation != null) {
+      result.x = fLocation.x;
+      result.y = fLocation.y;
+      Rectangle display = getShell().getDisplay().getClientArea();
+      int xe = result.x + initialSize.x;
+      if (xe > display.width) {
+        result.x -= xe - display.width;
+      }
+      int ye = result.y + initialSize.y;
+      if (ye > display.height) {
+        result.y -= ye - display.height;
+      }
+    }
+    return result;
+  }
+
+  /**
+   * Initializes itself from the dialog settings with the same state as at the previous invocation.
+   */
+  private void readSettings() {
+    IDialogSettings s = getDialogSettings();
+    try {
+      int x = s.getInt("x"); //$NON-NLS-1$
+      int y = s.getInt("y"); //$NON-NLS-1$
+      fLocation = new Point(x, y);
+      int width = s.getInt("width"); //$NON-NLS-1$
+      int height = s.getInt("height"); //$NON-NLS-1$
+      fSize = new Point(width, height);
+
+    } catch (NumberFormatException e) {
+      fLocation = null;
+      fSize = null;
+    }
+  }
+
+  /**
+   * Stores it current configuration in the dialog store.
+   */
+  private void writeSettings() {
+    IDialogSettings s = getDialogSettings();
+
+    Point location = getShell().getLocation();
+    s.put("x", location.x); //$NON-NLS-1$
+    s.put("y", location.y); //$NON-NLS-1$
+
+    Point size = getShell().getSize();
+    s.put("width", size.x); //$NON-NLS-1$
+    s.put("height", size.y); //$NON-NLS-1$
+  }
+
+  /**
+   * Returns the dialog settings object used to share state between several find/replace dialogs.
+   * 
+   * @return the dialog settings to be used
+   */
+  private IDialogSettings getDialogSettings() {
+    IDialogSettings settings = TypeSystemSelectionPlugin.getDefault().getDialogSettings();
+    String sectionName = getClass().getName();
+    IDialogSettings subSettings = settings.getSection(sectionName);
+    if (subSettings == null)
+      subSettings = settings.addNewSection(sectionName);
+    return subSettings;
+  }
 }

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/typesystem/StringMatcher.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/typesystem/StringMatcher.java?view=diff&rev=478232&r1=478231&r2=478232
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/typesystem/StringMatcher.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/typesystem/StringMatcher.java Wed Nov 22 08:50:24 2006
@@ -24,379 +24,407 @@
  * A string pattern matcher. Supports '*' and '?' wildcards.
  */
 public class StringMatcher {
-	protected String fPattern;
-	protected int fLength; // pattern length
-	protected boolean fIgnoreWildCards;
-	protected boolean fIgnoreCase;
-	protected boolean fHasLeadingStar;
-	protected boolean fHasTrailingStar;
-	protected String fSegments[]; //the given pattern is split into * separated segments
-
-	/* boundary value beyond which we don't need to search in the text */
-	protected int fBound= 0;
-	
-
-	protected static final char fSingleWildCard= '\u0000';
-	
-	public static class Position {
-		int start; //inclusive
-		int end; //exclusive
-		public Position(int start, int end) {
-			this.start= start;
-			this.end= end;
-		}
-		public int getStart() {
-			return start;
-		}
-		public int getEnd() {
-			return end;
-		}
-	}
-	/**
-	 * StringMatcher constructor takes in a String object that is a simple 
-	 * pattern. The pattern may contain '*' for 0 and many characters and
-	 * '?' for exactly one character.  
-	 *
-	 * Literal '*' and '?' characters must be escaped in the pattern 
-	 * e.g., "\*" means literal "*", etc.
-	 *
-	 * Escaping any other character (including the escape character itself), 
-	 * just results in that character in the pattern.
-	 * e.g., "\a" means "a" and "\\" means "\"
-	 *
-	 * If invoking the StringMatcher with string literals in Java, don't forget
-	 * escape characters are represented by "\\".
-	 *
-	 * @param pattern the pattern to match text against
-	 * @param ignoreCase if true, case is ignored
-	 * @param ignoreWildCards if true, wild cards and their escape sequences are ignored
-	 * 		  (everything is taken literally).
-	 */
-	public StringMatcher(String pattern, boolean ignoreCase, boolean ignoreWildCards) {
-		if (pattern == null)
-			throw new IllegalArgumentException();
-		fIgnoreCase= ignoreCase;
-		fIgnoreWildCards= ignoreWildCards;
-		fPattern= pattern;
-		fLength= pattern.length();
-		
-		if (fIgnoreWildCards) {
-			parseNoWildCards();
-		} else {
-			parseWildCards();
-		}
-	}
-	/**
-	 * Find the first occurrence of the pattern between <code>start</code)(inclusive) 
-	 * and <code>end</code>(exclusive).  
-	 * @param <code>text</code>, the String object to search in 
-	 * @param <code>start</code>, the starting index of the search range, inclusive
-	 * @param <code>end</code>, the ending index of the search range, exclusive
-	 * @return an <code>StringMatcher.Position</code> object that keeps the starting 
-	 * (inclusive) and ending positions (exclusive) of the first occurrence of the 
-	 * pattern in the specified range of the text; return null if not found or subtext
-	 * is empty (start==end). A pair of zeros is returned if pattern is empty string
-	 * Note that for pattern like "*abc*" with leading and trailing stars, position of "abc"
-	 * is returned. For a pattern like"*??*" in text "abcdf", (1,3) is returned
-	 */
-	public StringMatcher.Position find(String text, int start, int end) {
-		if (text == null)
-			throw new IllegalArgumentException();
-			
-		int tlen= text.length();
-		if (start < 0)
-			start= 0;
-		if (end > tlen)
-			end= tlen;
-		if (end < 0 ||start >= end )
-			return null;
-		if (fLength == 0)
-			return new Position(start, start);
-		if (fIgnoreWildCards) {
-			int x= posIn(text, start, end);
-			if (x < 0)
-				return null;
-			return new Position(x, x+fLength);
-		}
-
-		int segCount= fSegments.length;
-		if (segCount == 0)//pattern contains only '*'(s)
-			return new Position (start, end);
-					
-		int curPos= start;
-		int matchStart= -1;
-		int i;
-		for (i= 0; i < segCount && curPos < end; ++i) {
-			String current= fSegments[i];
-			int nextMatch= regExpPosIn(text, curPos, end, current);
-			if (nextMatch < 0 )
-				return null;
-			if(i == 0)
-				matchStart= nextMatch;
-			curPos= nextMatch + current.length();
-		}
-		if (i < segCount)
-			return null;
-		return new Position(matchStart, curPos);
-	}
-	/**
-	 * match the given <code>text</code> with the pattern 
-	 * @return true if matched eitherwise false
-	 * @param <code>text</code>, a String object 
-	 */
-	public boolean match(String text) {
-		return match(text, 0, text.length());
-	}
-	/**
-	 * Given the starting (inclusive) and the ending (exclusive) positions in the   
-	 * <code>text</code>, determine if the given substring matches with aPattern  
-	 * @return true if the specified portion of the text matches the pattern
-	 * @param String <code>text</code>, a String object that contains the substring to match 
-	 * @param int <code>start<code> marks the starting position (inclusive) of the substring
-	 * @param int <code>end<code> marks the ending index (exclusive) of the substring 
-	 */
-	public boolean match(String text, int start, int end) {
-		if (null == text)
-			throw new IllegalArgumentException();
-			
-		if (start > end)
-			return false;
-		
-		if (fIgnoreWildCards)
-			return (end - start == fLength) && fPattern.regionMatches(fIgnoreCase, 0, text, start, fLength);
-		int segCount= fSegments.length;
-		if (segCount == 0 && (fHasLeadingStar || fHasTrailingStar))  // pattern contains only '*'(s)
-			return true;
-		if (start == end)
-			return fLength == 0;
-		if (fLength == 0)
-			return start == end;	
-		 
-		int tlen= text.length();
-		if (start < 0)
-			start= 0;
-		if (end > tlen)
-			end= tlen; 
-					
-		int tCurPos= start;
-		int bound= end - fBound;
-		if ( bound < 0)
-			return false;
-		int i=0;
-		String current= fSegments[i];
-		int segLength= current.length();
-
-		/* process first segment */
-		if (!fHasLeadingStar){ 
-			if(!regExpRegionMatches(text, start, current, 0, segLength)) {
-				return false;
-			} else {
-				++i;
-				tCurPos= tCurPos + segLength;
-			}
-		}
-		if ((fSegments.length == 1) && (!fHasLeadingStar) && (!fHasTrailingStar)) {
-			// only one segment to match, no wildcards specified
-			return tCurPos == end;
-		}
-		/* process middle segments */	
-		while (i < segCount) {
-			current= fSegments[i];
-			int currentMatch;
-			int k= current.indexOf(fSingleWildCard);
-			if (k < 0) {
-				currentMatch= textPosIn(text, tCurPos, end, current);
-				if (currentMatch < 0)
-					return false;
-			} else { 
-				currentMatch= regExpPosIn(text, tCurPos, end, current);
-				if (currentMatch < 0)
-					return false;
-			}
-			tCurPos= currentMatch + current.length();
-			i++;
-		}
-
-		/* process final segment */
-		if (!fHasTrailingStar && tCurPos != end) {
-			int clen= current.length();
-			return regExpRegionMatches(text, end - clen, current, 0, clen);
-		}
-		return i == segCount ;
-	}
-
-	/**
-	 * This method parses the given pattern into segments seperated by wildcard '*' characters.
-	 * Since wildcards are not being used in this case, the pattern consists of a single segment.
-	 */
-	private void parseNoWildCards() {
-		fSegments= new String[1];
-		fSegments[0]= fPattern;
-		fBound= fLength;
-	}
-	/**
-	 * Parses the given pattern into segments seperated by wildcard '*' characters.
-	 * @param p, a String object that is a simple regular expression with '*' and/or '?'
-	 */
-	private void parseWildCards() {
-		if(fPattern.startsWith("*"))//$NON-NLS-1$
-			fHasLeadingStar= true;
-		if(fPattern.endsWith("*")) {//$NON-NLS-1$
-			/* make sure it's not an escaped wildcard */
-			if (fLength > 1 && fPattern.charAt(fLength - 2) != '\\') {
-				fHasTrailingStar= true;
-			}
-		}
-
-		Vector temp= new Vector();
-
-		int pos= 0;
-		StringBuffer buf= new StringBuffer();
-		while (pos < fLength) {
-			char c= fPattern.charAt(pos++);
-			switch (c) {
-				case '\\':
-					if (pos >= fLength) {
-						buf.append(c);
-					} else {
-						char next= fPattern.charAt(pos++);
-						/* if it's an escape sequence */
-						if (next == '*' || next == '?' || next == '\\') {
-							buf.append(next);
-						} else {
-							/* not an escape sequence, just insert literally */
-							buf.append(c);
-							buf.append(next);
-						}
-					}
-				break;
-				case '*':
-					if (buf.length() > 0) {
-						/* new segment */
-						temp.addElement(buf.toString());
-						fBound += buf.length();
-						buf.setLength(0);
-					}
-				break;
-				case '?':
-					/* append special character representing single match wildcard */
-					buf.append(fSingleWildCard);
-				break;
-				default:
-					buf.append(c);
-			}
-		}
-
-		/* add last buffer to segment list */
-		if (buf.length() > 0) {
-			temp.addElement(buf.toString());
-			fBound += buf.length();
-		}
-			
-		fSegments= new String[temp.size()];
-		temp.copyInto(fSegments);
-	}
-	/** 
-	 * @param <code>text</code>, a string which contains no wildcard
-	 * @param <code>start</code>, the starting index in the text for search, inclusive
-	 * @param <code>end</code>, the stopping point of search, exclusive
-	 * @return the starting index in the text of the pattern , or -1 if not found 
-	 */
-	protected int posIn(String text, int start, int end) {//no wild card in pattern
-		int max= end - fLength;
-		
-		if (!fIgnoreCase) {
-			int i= text.indexOf(fPattern, start);
-			if (i == -1 || i > max)
-				return -1;
-			return i;
-		}
-		
-		for (int i= start; i <= max; ++i) {
-			if (text.regionMatches(true, i, fPattern, 0, fLength))
-				return i;
-		}
-		
-		return -1;
-	}
-	/** 
-	 * @param <code>text</code>, a simple regular expression that may only contain '?'(s)
-	 * @param <code>start</code>, the starting index in the text for search, inclusive
-	 * @param <code>end</code>, the stopping point of search, exclusive
-	 * @param <code>p</code>, a simple regular expression that may contains '?'
-	 * @param <code>caseIgnored</code>, wether the pattern is not casesensitive
-	 * @return the starting index in the text of the pattern , or -1 if not found 
-	 */
-	protected int regExpPosIn(String text, int start, int end, String p) {
-		int plen= p.length();
-		
-		int max= end - plen;
-		for (int i= start; i <= max; ++i) {
-			if (regExpRegionMatches(text, i, p, 0, plen))
-				return i;
-		}
-		return -1;
-	}
-	/**
-	 * 
-	 * @return boolean
-	 * @param <code>text</code>, a String to match
-	 * @param <code>start</code>, int that indicates the starting index of match, inclusive
-	 * @param <code>end</code> int that indicates the ending index of match, exclusive
-	 * @param <code>p</code>, String,  String, a simple regular expression that may contain '?'
-	 * @param <code>ignoreCase</code>, boolean indicating wether code>p</code> is case sensitive
-	 */
-	protected boolean regExpRegionMatches(String text, int tStart, String p, int pStart, int plen) {
-		while (plen-- > 0) {
-			char tchar= text.charAt(tStart++);
-			char pchar= p.charAt(pStart++);
-
-			/* process wild cards */
-			if (!fIgnoreWildCards) {
-				/* skip single wild cards */
-				if (pchar == fSingleWildCard) {
-					continue;
-				}
-			}
-			if (pchar == tchar)
-				continue;
-			if (fIgnoreCase) {
-				if (Character.toUpperCase(tchar) == Character.toUpperCase(pchar))
-					continue;
-				// comparing after converting to upper case doesn't handle all cases;
-				// also compare after converting to lower case
-				if (Character.toLowerCase(tchar) == Character.toLowerCase(pchar))
-					continue;
-			}
-			return false;
-		}
-		return true;
-	}
-	/** 
-	 * @param <code>text</code>, the string to match
-	 * @param <code>start</code>, the starting index in the text for search, inclusive
-	 * @param <code>end</code>, the stopping point of search, exclusive
-	 * @param code>p</code>, a string that has no wildcard
-	 * @param <code>ignoreCase</code>, boolean indicating wether code>p</code> is case sensitive
-	 * @return the starting index in the text of the pattern , or -1 if not found 
-	 */
-	protected int textPosIn(String text, int start, int end, String p) { 
-		
-		int plen= p.length();
-		int max= end - plen;
-		
-		if (!fIgnoreCase) {
-			int i= text.indexOf(p, start);
-			if (i == -1 || i > max)
-				return -1;
-			return i;
-		}
-		
-		for (int i= start; i <= max; ++i) {
-			if (text.regionMatches(true, i, p, 0, plen))
-				return i;
-		}
-		
-		return -1;
-	}
+  protected String fPattern;
+
+  protected int fLength; // pattern length
+
+  protected boolean fIgnoreWildCards;
+
+  protected boolean fIgnoreCase;
+
+  protected boolean fHasLeadingStar;
+
+  protected boolean fHasTrailingStar;
+
+  protected String fSegments[]; // the given pattern is split into * separated segments
+
+  /* boundary value beyond which we don't need to search in the text */
+  protected int fBound = 0;
+
+  protected static final char fSingleWildCard = '\u0000';
+
+  public static class Position {
+    int start; // inclusive
+
+    int end; // exclusive
+
+    public Position(int start, int end) {
+      this.start = start;
+      this.end = end;
+    }
+
+    public int getStart() {
+      return start;
+    }
+
+    public int getEnd() {
+      return end;
+    }
+  }
+
+  /**
+   * StringMatcher constructor takes in a String object that is a simple pattern. The pattern may
+   * contain '*' for 0 and many characters and '?' for exactly one character.
+   * 
+   * Literal '*' and '?' characters must be escaped in the pattern e.g., "\*" means literal "*",
+   * etc.
+   * 
+   * Escaping any other character (including the escape character itself), just results in that
+   * character in the pattern. e.g., "\a" means "a" and "\\" means "\"
+   * 
+   * If invoking the StringMatcher with string literals in Java, don't forget escape characters are
+   * represented by "\\".
+   * 
+   * @param pattern
+   *          the pattern to match text against
+   * @param ignoreCase
+   *          if true, case is ignored
+   * @param ignoreWildCards
+   *          if true, wild cards and their escape sequences are ignored (everything is taken
+   *          literally).
+   */
+  public StringMatcher(String pattern, boolean ignoreCase, boolean ignoreWildCards) {
+    if (pattern == null)
+      throw new IllegalArgumentException();
+    fIgnoreCase = ignoreCase;
+    fIgnoreWildCards = ignoreWildCards;
+    fPattern = pattern;
+    fLength = pattern.length();
+
+    if (fIgnoreWildCards) {
+      parseNoWildCards();
+    } else {
+      parseWildCards();
+    }
+  }
+
+  /**
+   * Find the first occurrence of the pattern between <code>start</code)(inclusive) 
+   * and <code>end</code>(exclusive).  
+   * @param <code>text</code>, the String object to search in 
+   * @param <code>start</code>, the starting index of the search range, inclusive
+   * @param <code>end</code>, the ending index of the search range, exclusive
+   * @return an <code>StringMatcher.Position</code> object that keeps the starting 
+   * (inclusive) and ending positions (exclusive) of the first occurrence of the 
+   * pattern in the specified range of the text; return null if not found or subtext
+   * is empty (start==end). A pair of zeros is returned if pattern is empty string
+   * Note that for pattern like "*abc*" with leading and trailing stars, position of "abc"
+   * is returned. For a pattern like"*??*" in text "abcdf", (1,3) is returned
+   */
+  public StringMatcher.Position find(String text, int start, int end) {
+    if (text == null)
+      throw new IllegalArgumentException();
+
+    int tlen = text.length();
+    if (start < 0)
+      start = 0;
+    if (end > tlen)
+      end = tlen;
+    if (end < 0 || start >= end)
+      return null;
+    if (fLength == 0)
+      return new Position(start, start);
+    if (fIgnoreWildCards) {
+      int x = posIn(text, start, end);
+      if (x < 0)
+        return null;
+      return new Position(x, x + fLength);
+    }
+
+    int segCount = fSegments.length;
+    if (segCount == 0)// pattern contains only '*'(s)
+      return new Position(start, end);
+
+    int curPos = start;
+    int matchStart = -1;
+    int i;
+    for (i = 0; i < segCount && curPos < end; ++i) {
+      String current = fSegments[i];
+      int nextMatch = regExpPosIn(text, curPos, end, current);
+      if (nextMatch < 0)
+        return null;
+      if (i == 0)
+        matchStart = nextMatch;
+      curPos = nextMatch + current.length();
+    }
+    if (i < segCount)
+      return null;
+    return new Position(matchStart, curPos);
+  }
+
+  /**
+   * match the given <code>text</code> with the pattern
+   * 
+   * @return true if matched eitherwise false
+   * @param <code>text</code>, a String object
+   */
+  public boolean match(String text) {
+    return match(text, 0, text.length());
+  }
+
+  /**
+   * Given the starting (inclusive) and the ending (exclusive) positions in the <code>text</code>,
+   * determine if the given substring matches with aPattern
+   * 
+   * @return true if the specified portion of the text matches the pattern
+   * @param String
+   *          <code>text</code>, a String object that contains the substring to match
+   * @param int
+   *          <code>start<code> marks the starting position (inclusive) of the substring
+   * @param int <code>end<code> marks the ending index (exclusive) of the substring
+   */
+  public boolean match(String text, int start, int end) {
+    if (null == text)
+      throw new IllegalArgumentException();
+
+    if (start > end)
+      return false;
+
+    if (fIgnoreWildCards)
+      return (end - start == fLength)
+                      && fPattern.regionMatches(fIgnoreCase, 0, text, start, fLength);
+    int segCount = fSegments.length;
+    if (segCount == 0 && (fHasLeadingStar || fHasTrailingStar)) // pattern contains only '*'(s)
+      return true;
+    if (start == end)
+      return fLength == 0;
+    if (fLength == 0)
+      return start == end;
+
+    int tlen = text.length();
+    if (start < 0)
+      start = 0;
+    if (end > tlen)
+      end = tlen;
+
+    int tCurPos = start;
+    int bound = end - fBound;
+    if (bound < 0)
+      return false;
+    int i = 0;
+    String current = fSegments[i];
+    int segLength = current.length();
+
+    /* process first segment */
+    if (!fHasLeadingStar) {
+      if (!regExpRegionMatches(text, start, current, 0, segLength)) {
+        return false;
+      } else {
+        ++i;
+        tCurPos = tCurPos + segLength;
+      }
+    }
+    if ((fSegments.length == 1) && (!fHasLeadingStar) && (!fHasTrailingStar)) {
+      // only one segment to match, no wildcards specified
+      return tCurPos == end;
+    }
+    /* process middle segments */
+    while (i < segCount) {
+      current = fSegments[i];
+      int currentMatch;
+      int k = current.indexOf(fSingleWildCard);
+      if (k < 0) {
+        currentMatch = textPosIn(text, tCurPos, end, current);
+        if (currentMatch < 0)
+          return false;
+      } else {
+        currentMatch = regExpPosIn(text, tCurPos, end, current);
+        if (currentMatch < 0)
+          return false;
+      }
+      tCurPos = currentMatch + current.length();
+      i++;
+    }
+
+    /* process final segment */
+    if (!fHasTrailingStar && tCurPos != end) {
+      int clen = current.length();
+      return regExpRegionMatches(text, end - clen, current, 0, clen);
+    }
+    return i == segCount;
+  }
+
+  /**
+   * This method parses the given pattern into segments seperated by wildcard '*' characters. Since
+   * wildcards are not being used in this case, the pattern consists of a single segment.
+   */
+  private void parseNoWildCards() {
+    fSegments = new String[1];
+    fSegments[0] = fPattern;
+    fBound = fLength;
+  }
+
+  /**
+   * Parses the given pattern into segments seperated by wildcard '*' characters.
+   * 
+   * @param p,
+   *          a String object that is a simple regular expression with '*' and/or '?'
+   */
+  private void parseWildCards() {
+    if (fPattern.startsWith("*"))//$NON-NLS-1$
+      fHasLeadingStar = true;
+    if (fPattern.endsWith("*")) {//$NON-NLS-1$
+      /* make sure it's not an escaped wildcard */
+      if (fLength > 1 && fPattern.charAt(fLength - 2) != '\\') {
+        fHasTrailingStar = true;
+      }
+    }
+
+    Vector temp = new Vector();
+
+    int pos = 0;
+    StringBuffer buf = new StringBuffer();
+    while (pos < fLength) {
+      char c = fPattern.charAt(pos++);
+      switch (c) {
+        case '\\':
+          if (pos >= fLength) {
+            buf.append(c);
+          } else {
+            char next = fPattern.charAt(pos++);
+            /* if it's an escape sequence */
+            if (next == '*' || next == '?' || next == '\\') {
+              buf.append(next);
+            } else {
+              /* not an escape sequence, just insert literally */
+              buf.append(c);
+              buf.append(next);
+            }
+          }
+          break;
+        case '*':
+          if (buf.length() > 0) {
+            /* new segment */
+            temp.addElement(buf.toString());
+            fBound += buf.length();
+            buf.setLength(0);
+          }
+          break;
+        case '?':
+          /* append special character representing single match wildcard */
+          buf.append(fSingleWildCard);
+          break;
+        default:
+          buf.append(c);
+      }
+    }
+
+    /* add last buffer to segment list */
+    if (buf.length() > 0) {
+      temp.addElement(buf.toString());
+      fBound += buf.length();
+    }
+
+    fSegments = new String[temp.size()];
+    temp.copyInto(fSegments);
+  }
+
+  /**
+   * @param <code>text</code>, a string which contains no wildcard
+   * @param <code>start</code>, the starting index in the text for search, inclusive
+   * @param <code>end</code>, the stopping point of search, exclusive
+   * @return the starting index in the text of the pattern , or -1 if not found
+   */
+  protected int posIn(String text, int start, int end) {// no wild card in pattern
+    int max = end - fLength;
+
+    if (!fIgnoreCase) {
+      int i = text.indexOf(fPattern, start);
+      if (i == -1 || i > max)
+        return -1;
+      return i;
+    }
+
+    for (int i = start; i <= max; ++i) {
+      if (text.regionMatches(true, i, fPattern, 0, fLength))
+        return i;
+    }
+
+    return -1;
+  }
+
+  /**
+   * @param <code>text</code>, a simple regular expression that may only contain '?'(s)
+   * @param <code>start</code>, the starting index in the text for search, inclusive
+   * @param <code>end</code>, the stopping point of search, exclusive
+   * @param <code>p</code>, a simple regular expression that may contains '?'
+   * @param <code>caseIgnored</code>, wether the pattern is not casesensitive
+   * @return the starting index in the text of the pattern , or -1 if not found
+   */
+  protected int regExpPosIn(String text, int start, int end, String p) {
+    int plen = p.length();
+
+    int max = end - plen;
+    for (int i = start; i <= max; ++i) {
+      if (regExpRegionMatches(text, i, p, 0, plen))
+        return i;
+    }
+    return -1;
+  }
+
+  /**
+   * 
+   * @return boolean
+   * @param <code>text</code>, a String to match
+   * @param <code>start</code>, int that indicates the starting index of match, inclusive
+   * @param <code>end</code> int that indicates the ending index of match, exclusive
+   * @param <code>p</code>, String, String, a simple regular expression that may contain '?'
+   * @param <code>ignoreCase</code>, boolean indicating wether code>p</code> is case sensitive
+   */
+  protected boolean regExpRegionMatches(String text, int tStart, String p, int pStart, int plen) {
+    while (plen-- > 0) {
+      char tchar = text.charAt(tStart++);
+      char pchar = p.charAt(pStart++);
+
+      /* process wild cards */
+      if (!fIgnoreWildCards) {
+        /* skip single wild cards */
+        if (pchar == fSingleWildCard) {
+          continue;
+        }
+      }
+      if (pchar == tchar)
+        continue;
+      if (fIgnoreCase) {
+        if (Character.toUpperCase(tchar) == Character.toUpperCase(pchar))
+          continue;
+        // comparing after converting to upper case doesn't handle all cases;
+        // also compare after converting to lower case
+        if (Character.toLowerCase(tchar) == Character.toLowerCase(pchar))
+          continue;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * @param <code>text</code>, the string to match
+   * @param <code>start</code>, the starting index in the text for search, inclusive
+   * @param <code>end</code>, the stopping point of search, exclusive
+   * @param code>p
+   *          </code>, a string that has no wildcard
+   * @param <code>
+   *          ignoreCase</code>, boolean indicating wether code>p</code> is case sensitive
+   * @return the starting index in the text of the pattern , or -1 if not found
+   */
+  protected int textPosIn(String text, int start, int end, String p) {
+
+    int plen = p.length();
+    int max = end - plen;
+
+    if (!fIgnoreCase) {
+      int i = text.indexOf(p, start);
+      if (i == -1 || i > max)
+        return -1;
+      return i;
+    }
+
+    for (int i = start; i <= max; ++i) {
+      if (text.regionMatches(true, i, p, 0, plen))
+        return i;
+    }
+
+    return -1;
+  }
 }

Modified: incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/typesystem/Strings.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/typesystem/Strings.java?view=diff&rev=478232&r1=478231&r2=478232
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/typesystem/Strings.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-configurator/src/main/java/org/apache/uima/typesystem/Strings.java Wed Nov 22 08:50:24 2006
@@ -26,427 +26,429 @@
 import org.eclipse.jface.text.ILineTracker;
 import org.eclipse.jface.text.IRegion;
 
-
 /**
  * Helper class to provide String manipulation functions not available in standard JDK.
  */
 public class Strings {
-	
-	private Strings(){}
-	
-	/**
-	 * Indent char is a space char but not a line delimiters.
-	 * <code>== Character.isWhitespace(ch) && ch != '\n' && ch != '\r'</code>
-	 */
-	public static boolean isIndentChar(char ch) {
-		return Character.isWhitespace(ch) && !isLineDelimiterChar(ch);
-	}
-	
-	/**
-	 * tests if a char is lower case. Fix for 26529 
-	 */
-	public static boolean isLowerCase(char ch) {
-		return Character.toLowerCase(ch) == ch;
-	}	
-	
-	/**
-	 * Line delimiter chars are  '\n' and '\r'.
-	 */
-	public static boolean isLineDelimiterChar(char ch) {
-		return ch == '\n' || ch == '\r';
-	}	
-
-	public static String removeNewLine(String message) {
-		StringBuffer result= new StringBuffer();
-		int current= 0;
-		int index= message.indexOf('\n', 0);
-		while (index != -1) {
-			result.append(message.substring(current, index));
-			if (current < index && index != 0)
-				result.append(' ');
-			current= index + 1;
-			index= message.indexOf('\n', current);
-		}
-		result.append(message.substring(current));
-		return result.toString();
-	}
-
-	/**
-	 * Converts the given string into an array of lines. The lines 
-	 * don't contain any line delimiter characters.
-	 *
-	 * @return the string converted into an array of strings. Returns <code>
-	 * 	null</code> if the input string can't be converted in an array of lines.
-	 */
-	public static String[] convertIntoLines(String input) {
-		try {
-			ILineTracker tracker= new DefaultLineTracker();
-			tracker.set(input);
-			int size= tracker.getNumberOfLines();
-			String result[]= new String[size];
-			for (int i= 0; i < size; i++) {
-				IRegion region= tracker.getLineInformation(i);
-				int offset= region.getOffset();
-				result[i]= input.substring(offset, offset + region.getLength());
-			}
-			return result;
-		} catch (BadLocationException e) {
-			return null;
-		}
-	}
-
-	/**
-	 * Returns <code>true</code> if the given string only consists of
-	 * white spaces according to Java. If the string is empty, <code>true
-	 * </code> is returned.
-	 * 
-	 * @return <code>true</code> if the string only consists of white
-	 * 	spaces; otherwise <code>false</code> is returned
-	 * 
-	 * @see java.lang.Character#isWhitespace(char)
-	 */
-	public static boolean containsOnlyWhitespaces(String s) {
-		int size= s.length();
-		for (int i= 0; i < size; i++) {
-			if (!Character.isWhitespace(s.charAt(i)))
-				return false;
-		}
-		return true;
-	}
-	
-	/**
-	 * Removes leading tabs and spaces from the given string. If the string
-	 * doesn't contain any leading tabs or spaces then the string itself is 
-	 * returned.
-	 */
-	public static String trimLeadingTabsAndSpaces(String line) {
-		int size= line.length();
-		int start= size;
-		for (int i= 0; i < size; i++) {
-			char c= line.charAt(i);
-			if (!isIndentChar(c)) {
-				start= i;
-				break;
-			}
-		}
-		if (start == 0)
-			return line;
-		else if (start == size)
-			return ""; //$NON-NLS-1$
-		else
-			return line.substring(start);
-	}
-	
-	public static String trimTrailingTabsAndSpaces(String line) {
-		int size= line.length();
-		int end= size;
-		for (int i= size - 1; i >= 0; i--) {
-			char c= line.charAt(i);
-			if (isIndentChar(c)) {
-				end= i;
-			} else {
-				break;
-			}
-		}
-		if (end == size)
-			return line;
-		else if (end == 0)
-			return ""; //$NON-NLS-1$
-		else
-			return line.substring(0, end);
-	}
-	
-	/**
-	 * Returns the indent of the given string.
-	 * 
-	 * @param line the text line
-	 * @param tabWidth the width of the '\t' character.
-	 */
-	public static int computeIndent(String line, int tabWidth) {
-		int result= 0;
-		int blanks= 0;
-		int size= line.length();
-		for (int i= 0; i < size; i++) {
-			char c= line.charAt(i);
-			if (c == '\t') {
-				result++;
-				blanks= 0;
-			} else if (isIndentChar(c)) {
-				blanks++;
-				if (blanks == tabWidth) {
-					result++;
-					blanks= 0;
-				}
-			} else {
-				return result;
-			}
-		}
-		return result;
-	}
-	
-	/**
-	 * Removes the given number of idents from the line. Asserts that the given line 
-	 * has the requested number of indents. If <code>indentsToRemove <= 0</code>
-	 * the line is returned.
-	 */
-	public static String trimIndent(String line, int indentsToRemove, int tabWidth) {
-		if (line == null || indentsToRemove <= 0)
-			return line;
-			
-		int start= 0;
-		int indents= 0;
-		int blanks= 0;
-		int size= line.length();
-		for (int i= 0; i < size; i++) {
-			char c= line.charAt(i);
-			if (c == '\t') {
-				indents++;
-				blanks= 0;
-			} else if (isIndentChar(c)) {
-					blanks++;
-					if (blanks == tabWidth) {
-						indents++;
-						blanks= 0;
-					}
-			} else {
-				// Assert.isTrue(false, "Line does not have requested number of indents"); //$NON-NLS-1$
-				start= i;
-				break; 
-			}
-			if (indents == indentsToRemove) {
-				start= i + 1;
-				break;
-			}	
-		}
-		if (start == size)
-			return ""; //$NON-NLS-1$
-		else
-			return line.substring(start);
-	}
-	
-	/**
-	 * Removes the common number of indents from all lines. If a line
-	 * only consists out of white space it is ignored.
-	 */
-	public static void trimIndentation(String[] lines, int tabWidth) {
-		trimIndentation(lines, tabWidth, true);
-	}
-	
-	/**
-	 * Removes the common number of indents from all lines. If a line
-	 * only consists out of white space it is ignored. If <code>
-	 * considerFirstLine</code> is false the first line will be ignored.
-	 */
-	public static void trimIndentation(String[] lines, int tabWidth, boolean considerFirstLine) {
-		String[] toDo= new String[lines.length];
-		// find indentation common to all lines
-		int minIndent= Integer.MAX_VALUE; // very large
-		for (int i= considerFirstLine ? 0 : 1; i < lines.length; i++) {
-			String line= lines[i];
-			if (containsOnlyWhitespaces(line))
-				continue;
-			toDo[i]= line;
-			int indent= computeIndent(line, tabWidth);
-			if (indent < minIndent) {
-				minIndent= indent;
-			}
-		}
-		
-		if (minIndent > 0) {
-			// remove this indent from all lines
-			for (int i= considerFirstLine ? 0 : 1; i < toDo.length; i++) {
-				String s= toDo[i];
-				if (s != null)
-					lines[i]= trimIndent(s, minIndent, tabWidth);
-				else {
-					String line= lines[i];
-					int indent= computeIndent(line, tabWidth);
-					if (indent > minIndent)
-						lines[i]= trimIndent(line, minIndent, tabWidth);
-					else
-						lines[i]= trimLeadingTabsAndSpaces(line);
-				}
-			}
-		}
-	}
-	
-	public static String getIndentString(String line, int tabWidth) {
-		int size= line.length();
-		int end= 0;
-		int blanks= 0;
-		for (int i= 0; i < size; i++) {
-			char c= line.charAt(i);
-			if (c == '\t') {
-				end= i + 1;
-				blanks= 0;
-			} else if (isIndentChar(c)) {
-				blanks++;
-				if (blanks == tabWidth) {
-					end= i + 1;
-					blanks= 0;
-				}
-			} else {
-				break;
-			}
-		}
-		if (end == 0)
-			return ""; //$NON-NLS-1$
-		else if (end == size)
-			return line;
-		else
-			return line.substring(0, end);
-	}
-	
-	/**
-	 * Returns the length of the string representing the number of 
-	 * indents in the given string <code>line</code>. Returns 
-	 * <code>-1<code> if the line isn't prefixed with an indent of
-	 * the given number of indents. 
-	 * @throws Exception
-	 */
-	public static int computeIndentLength(String line, int numberOfIndents, int tabWidth) throws Exception {
-		if (!(numberOfIndents >= 0) || !(tabWidth >= 0)) {
-			throw new Exception("Assert Failed");
-		}
-		int size= line.length();
-		int result= -1;
-		int indents= 0;
-		int blanks= 0;
-		for (int i= 0; i < size && indents < numberOfIndents; i++) {
-			char c= line.charAt(i);
-			if (c == '\t') {
-				indents++;
-				result= i;
-				blanks= 0;
-			} else if (isIndentChar(c)) {
-				blanks++;
-				if (blanks == tabWidth) {
-					result= i;
-					indents++;
-					blanks= 0;
-				}
-			} else {
-				break;
-			}
-		}
-		if (indents < numberOfIndents)
-			return -1;
-		return result + 1;
-	}
-	
-	public static String[] removeTrailingEmptyLines(String[] sourceLines) {
-		int lastNonEmpty= findLastNonEmptyLineIndex(sourceLines);
-		String[] result= new String[lastNonEmpty + 1];
-		for (int i= 0; i < result.length; i++) {
-			result[i]= sourceLines[i];
-		}
-		return result;
-	}
-
-	private static int findLastNonEmptyLineIndex(String[] sourceLines) {
-		for (int i= sourceLines.length - 1; i >= 0; i--) {
-			if (! sourceLines[i].trim().equals(""))//$NON-NLS-1$
-				return i;
-		}
-		return -1;
-	}
-	
-	/**
-	 * Change the indent of, possible muti-line, code range. The current indent is removed, a new indent added.
-	 * The first line of the code will not be changed. (It is considered to have no indent as it might start in
-	 * the middle of a line)
-	 */
-	public static String changeIndent(String code, int codeIndentLevel, int tabWidth, String newIndent, String lineDelim) {
-		try {
-			ILineTracker tracker= new DefaultLineTracker();
-			tracker.set(code);
-			int nLines= tracker.getNumberOfLines();
-			if (nLines == 1) {
-				return code;
-			}
-			
-			StringBuffer buf= new StringBuffer();
-			
-			for (int i= 0; i < nLines; i++) {
-				IRegion region= tracker.getLineInformation(i);
-				int start= region.getOffset();
-				int end= start + region.getLength();
-				String line= code.substring(start, end);
-				
-				if (i == 0) {  // no indent for first line (contained in the formatted string)
-					buf.append(line);
-				} else { // no new line after last line
-					buf.append(lineDelim);
-					buf.append(newIndent); 
-					buf.append(trimIndent(line, codeIndentLevel, tabWidth));
-				}
-			}
-			return buf.toString();
-		} catch (BadLocationException e) {
-			// can not happen
-			return code;
-		}
-	}
-	
-	public static String trimIndentation(String source, int tabWidth, boolean considerFirstLine) throws Exception {
-		try {
-			ILineTracker tracker= new DefaultLineTracker();
-			tracker.set(source);
-			int size= tracker.getNumberOfLines();
-			if (size == 1)
-				return source;
-			String lines[]= new String[size];
-			for (int i= 0; i < size; i++) {
-				IRegion region= tracker.getLineInformation(i);
-				int offset= region.getOffset();
-				lines[i]= source.substring(offset, offset + region.getLength());
-			}
-			Strings.trimIndentation(lines, tabWidth, considerFirstLine);
-			StringBuffer result= new StringBuffer();
-			int last= size - 1;
-			for (int i= 0; i < size; i++) {
-				result.append(lines[i]);
-				if (i < last)
-					result.append(tracker.getLineDelimiter(i));
-			}
-			return result.toString();
-		} catch (BadLocationException e) {
-			throw new Exception("Bad Location");
-			//return null;
-		}
-	}
-		
-	
-	/**
-	 * Concatenate the given strings into one strings using the passed line delimiter as a
-	 * delimiter. No delimiter is added to the last line.
-	 */
-	public static String concatenate(String[] lines, String delimiter) {
-		StringBuffer buffer= new StringBuffer();
-		for (int i= 0; i < lines.length; i++) {
-			if (i > 0)
-				buffer.append(delimiter);
-			buffer.append(lines[i]);
-		}
-		return buffer.toString();
-	}
-	
-	public static boolean equals(String s, char[] c) {
-		if (s.length() != c.length)
-			return false;
-
-		for (int i = c.length; --i >= 0;)
-			if (s.charAt(i) != c[i])
-				return false;
-		return true;
-	}
-	
-	public static String[] splitByToken(String fullString, String splitToken) {
-		StringTokenizer tokenizer= new StringTokenizer(fullString, splitToken);
-		String[] tokens= new String[tokenizer.countTokens()];
-		for (int i= 0; tokenizer.hasMoreTokens(); i++) {
-			tokens[i]= tokenizer.nextToken();
-		}
-		return tokens;
-	}
+
+  private Strings() {
+  }
+
+  /**
+   * Indent char is a space char but not a line delimiters.
+   * <code>== Character.isWhitespace(ch) && ch != '\n' && ch != '\r'</code>
+   */
+  public static boolean isIndentChar(char ch) {
+    return Character.isWhitespace(ch) && !isLineDelimiterChar(ch);
+  }
+
+  /**
+   * tests if a char is lower case. Fix for 26529
+   */
+  public static boolean isLowerCase(char ch) {
+    return Character.toLowerCase(ch) == ch;
+  }
+
+  /**
+   * Line delimiter chars are '\n' and '\r'.
+   */
+  public static boolean isLineDelimiterChar(char ch) {
+    return ch == '\n' || ch == '\r';
+  }
+
+  public static String removeNewLine(String message) {
+    StringBuffer result = new StringBuffer();
+    int current = 0;
+    int index = message.indexOf('\n', 0);
+    while (index != -1) {
+      result.append(message.substring(current, index));
+      if (current < index && index != 0)
+        result.append(' ');
+      current = index + 1;
+      index = message.indexOf('\n', current);
+    }
+    result.append(message.substring(current));
+    return result.toString();
+  }
+
+  /**
+   * Converts the given string into an array of lines. The lines don't contain any line delimiter
+   * characters.
+   * 
+   * @return the string converted into an array of strings. Returns <code>
+   * 	null</code> if the input
+   *         string can't be converted in an array of lines.
+   */
+  public static String[] convertIntoLines(String input) {
+    try {
+      ILineTracker tracker = new DefaultLineTracker();
+      tracker.set(input);
+      int size = tracker.getNumberOfLines();
+      String result[] = new String[size];
+      for (int i = 0; i < size; i++) {
+        IRegion region = tracker.getLineInformation(i);
+        int offset = region.getOffset();
+        result[i] = input.substring(offset, offset + region.getLength());
+      }
+      return result;
+    } catch (BadLocationException e) {
+      return null;
+    }
+  }
+
+  /**
+   * Returns <code>true</code> if the given string only consists of white spaces according to
+   * Java. If the string is empty, <code>true
+   * </code> is returned.
+   * 
+   * @return <code>true</code> if the string only consists of white spaces; otherwise
+   *         <code>false</code> is returned
+   * 
+   * @see java.lang.Character#isWhitespace(char)
+   */
+  public static boolean containsOnlyWhitespaces(String s) {
+    int size = s.length();
+    for (int i = 0; i < size; i++) {
+      if (!Character.isWhitespace(s.charAt(i)))
+        return false;
+    }
+    return true;
+  }
+
+  /**
+   * Removes leading tabs and spaces from the given string. If the string doesn't contain any
+   * leading tabs or spaces then the string itself is returned.
+   */
+  public static String trimLeadingTabsAndSpaces(String line) {
+    int size = line.length();
+    int start = size;
+    for (int i = 0; i < size; i++) {
+      char c = line.charAt(i);
+      if (!isIndentChar(c)) {
+        start = i;
+        break;
+      }
+    }
+    if (start == 0)
+      return line;
+    else if (start == size)
+      return ""; //$NON-NLS-1$
+    else
+      return line.substring(start);
+  }
+
+  public static String trimTrailingTabsAndSpaces(String line) {
+    int size = line.length();
+    int end = size;
+    for (int i = size - 1; i >= 0; i--) {
+      char c = line.charAt(i);
+      if (isIndentChar(c)) {
+        end = i;
+      } else {
+        break;
+      }
+    }
+    if (end == size)
+      return line;
+    else if (end == 0)
+      return ""; //$NON-NLS-1$
+    else
+      return line.substring(0, end);
+  }
+
+  /**
+   * Returns the indent of the given string.
+   * 
+   * @param line
+   *          the text line
+   * @param tabWidth
+   *          the width of the '\t' character.
+   */
+  public static int computeIndent(String line, int tabWidth) {
+    int result = 0;
+    int blanks = 0;
+    int size = line.length();
+    for (int i = 0; i < size; i++) {
+      char c = line.charAt(i);
+      if (c == '\t') {
+        result++;
+        blanks = 0;
+      } else if (isIndentChar(c)) {
+        blanks++;
+        if (blanks == tabWidth) {
+          result++;
+          blanks = 0;
+        }
+      } else {
+        return result;
+      }
+    }
+    return result;
+  }
+
+  /**
+   * Removes the given number of idents from the line. Asserts that the given line has the requested
+   * number of indents. If <code>indentsToRemove <= 0</code> the line is returned.
+   */
+  public static String trimIndent(String line, int indentsToRemove, int tabWidth) {
+    if (line == null || indentsToRemove <= 0)
+      return line;
+
+    int start = 0;
+    int indents = 0;
+    int blanks = 0;
+    int size = line.length();
+    for (int i = 0; i < size; i++) {
+      char c = line.charAt(i);
+      if (c == '\t') {
+        indents++;
+        blanks = 0;
+      } else if (isIndentChar(c)) {
+        blanks++;
+        if (blanks == tabWidth) {
+          indents++;
+          blanks = 0;
+        }
+      } else {
+        // Assert.isTrue(false, "Line does not have requested number of indents"); //$NON-NLS-1$
+        start = i;
+        break;
+      }
+      if (indents == indentsToRemove) {
+        start = i + 1;
+        break;
+      }
+    }
+    if (start == size)
+      return ""; //$NON-NLS-1$
+    else
+      return line.substring(start);
+  }
+
+  /**
+   * Removes the common number of indents from all lines. If a line only consists out of white space
+   * it is ignored.
+   */
+  public static void trimIndentation(String[] lines, int tabWidth) {
+    trimIndentation(lines, tabWidth, true);
+  }
+
+  /**
+   * Removes the common number of indents from all lines. If a line only consists out of white space
+   * it is ignored. If <code>
+   * considerFirstLine</code> is false the first line will be ignored.
+   */
+  public static void trimIndentation(String[] lines, int tabWidth, boolean considerFirstLine) {
+    String[] toDo = new String[lines.length];
+    // find indentation common to all lines
+    int minIndent = Integer.MAX_VALUE; // very large
+    for (int i = considerFirstLine ? 0 : 1; i < lines.length; i++) {
+      String line = lines[i];
+      if (containsOnlyWhitespaces(line))
+        continue;
+      toDo[i] = line;
+      int indent = computeIndent(line, tabWidth);
+      if (indent < minIndent) {
+        minIndent = indent;
+      }
+    }
+
+    if (minIndent > 0) {
+      // remove this indent from all lines
+      for (int i = considerFirstLine ? 0 : 1; i < toDo.length; i++) {
+        String s = toDo[i];
+        if (s != null)
+          lines[i] = trimIndent(s, minIndent, tabWidth);
+        else {
+          String line = lines[i];
+          int indent = computeIndent(line, tabWidth);
+          if (indent > minIndent)
+            lines[i] = trimIndent(line, minIndent, tabWidth);
+          else
+            lines[i] = trimLeadingTabsAndSpaces(line);
+        }
+      }
+    }
+  }
+
+  public static String getIndentString(String line, int tabWidth) {
+    int size = line.length();
+    int end = 0;
+    int blanks = 0;
+    for (int i = 0; i < size; i++) {
+      char c = line.charAt(i);
+      if (c == '\t') {
+        end = i + 1;
+        blanks = 0;
+      } else if (isIndentChar(c)) {
+        blanks++;
+        if (blanks == tabWidth) {
+          end = i + 1;
+          blanks = 0;
+        }
+      } else {
+        break;
+      }
+    }
+    if (end == 0)
+      return ""; //$NON-NLS-1$
+    else if (end == size)
+      return line;
+    else
+      return line.substring(0, end);
+  }
+
+  /**
+   * Returns the length of the string representing the number of indents in the given string
+   * <code>line</code>. Returns <code>-1<code> if the line isn't prefixed with an indent of
+   * the given number of indents. 
+   * @throws Exception
+   */
+  public static int computeIndentLength(String line, int numberOfIndents, int tabWidth)
+                  throws Exception {
+    if (!(numberOfIndents >= 0) || !(tabWidth >= 0)) {
+      throw new Exception("Assert Failed");
+    }
+    int size = line.length();
+    int result = -1;
+    int indents = 0;
+    int blanks = 0;
+    for (int i = 0; i < size && indents < numberOfIndents; i++) {
+      char c = line.charAt(i);
+      if (c == '\t') {
+        indents++;
+        result = i;
+        blanks = 0;
+      } else if (isIndentChar(c)) {
+        blanks++;
+        if (blanks == tabWidth) {
+          result = i;
+          indents++;
+          blanks = 0;
+        }
+      } else {
+        break;
+      }
+    }
+    if (indents < numberOfIndents)
+      return -1;
+    return result + 1;
+  }
+
+  public static String[] removeTrailingEmptyLines(String[] sourceLines) {
+    int lastNonEmpty = findLastNonEmptyLineIndex(sourceLines);
+    String[] result = new String[lastNonEmpty + 1];
+    for (int i = 0; i < result.length; i++) {
+      result[i] = sourceLines[i];
+    }
+    return result;
+  }
+
+  private static int findLastNonEmptyLineIndex(String[] sourceLines) {
+    for (int i = sourceLines.length - 1; i >= 0; i--) {
+      if (!sourceLines[i].trim().equals(""))//$NON-NLS-1$
+        return i;
+    }
+    return -1;
+  }
+
+  /**
+   * Change the indent of, possible muti-line, code range. The current indent is removed, a new
+   * indent added. The first line of the code will not be changed. (It is considered to have no
+   * indent as it might start in the middle of a line)
+   */
+  public static String changeIndent(String code, int codeIndentLevel, int tabWidth,
+                  String newIndent, String lineDelim) {
+    try {
+      ILineTracker tracker = new DefaultLineTracker();
+      tracker.set(code);
+      int nLines = tracker.getNumberOfLines();
+      if (nLines == 1) {
+        return code;
+      }
+
+      StringBuffer buf = new StringBuffer();
+
+      for (int i = 0; i < nLines; i++) {
+        IRegion region = tracker.getLineInformation(i);
+        int start = region.getOffset();
+        int end = start + region.getLength();
+        String line = code.substring(start, end);
+
+        if (i == 0) { // no indent for first line (contained in the formatted string)
+          buf.append(line);
+        } else { // no new line after last line
+          buf.append(lineDelim);
+          buf.append(newIndent);
+          buf.append(trimIndent(line, codeIndentLevel, tabWidth));
+        }
+      }
+      return buf.toString();
+    } catch (BadLocationException e) {
+      // can not happen
+      return code;
+    }
+  }
+
+  public static String trimIndentation(String source, int tabWidth, boolean considerFirstLine)
+                  throws Exception {
+    try {
+      ILineTracker tracker = new DefaultLineTracker();
+      tracker.set(source);
+      int size = tracker.getNumberOfLines();
+      if (size == 1)
+        return source;
+      String lines[] = new String[size];
+      for (int i = 0; i < size; i++) {
+        IRegion region = tracker.getLineInformation(i);
+        int offset = region.getOffset();
+        lines[i] = source.substring(offset, offset + region.getLength());
+      }
+      Strings.trimIndentation(lines, tabWidth, considerFirstLine);
+      StringBuffer result = new StringBuffer();
+      int last = size - 1;
+      for (int i = 0; i < size; i++) {
+        result.append(lines[i]);
+        if (i < last)
+          result.append(tracker.getLineDelimiter(i));
+      }
+      return result.toString();
+    } catch (BadLocationException e) {
+      throw new Exception("Bad Location");
+      // return null;
+    }
+  }
+
+  /**
+   * Concatenate the given strings into one strings using the passed line delimiter as a delimiter.
+   * No delimiter is added to the last line.
+   */
+  public static String concatenate(String[] lines, String delimiter) {
+    StringBuffer buffer = new StringBuffer();
+    for (int i = 0; i < lines.length; i++) {
+      if (i > 0)
+        buffer.append(delimiter);
+      buffer.append(lines[i]);
+    }
+    return buffer.toString();
+  }
+
+  public static boolean equals(String s, char[] c) {
+    if (s.length() != c.length)
+      return false;
+
+    for (int i = c.length; --i >= 0;)
+      if (s.charAt(i) != c[i])
+        return false;
+    return true;
+  }
+
+  public static String[] splitByToken(String fullString, String splitToken) {
+    StringTokenizer tokenizer = new StringTokenizer(fullString, splitToken);
+    String[] tokens = new String[tokenizer.countTokens()];
+    for (int i = 0; tokenizer.hasMoreTokens(); i++) {
+      tokens[i] = tokenizer.nextToken();
+    }
+    return tokens;
+  }
 }