You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by jo...@apache.org on 2011/08/12 13:14:21 UTC

svn commit: r1157050 [5/11] - in /uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons: ./ .settings/ META-INF/ icons/ schema/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/uima/ src/main/java/o...

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/BasicTypeSystem.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/BasicTypeSystem.xml?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/BasicTypeSystem.xml (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/BasicTypeSystem.xml Fri Aug 12 11:14:14 2011
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<typeSystemDescription xmlns="http://uima.apache.org/resourceSpecifier">
+  <name>BasicTypeSystem</name>
+  <description/>
+  <version>1.0</version>
+  <vendor/>
+  <imports>
+    <import location="InternalTypeSystem.xml"/>
+  </imports>
+  <types>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.ALL</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.BasicAnnotation</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.ANY</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.ALL</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.MARKUP</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.ALL</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.CW</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.W</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.W</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.ANY</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.SW</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.W</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.PM</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.ANY</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.CAP</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.W</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.COLON</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.PM</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.PERIOD</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.SENTENCEEND</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.SENTENCEEND</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.PM</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.QUESTION</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.SENTENCEEND</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.COMMA</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.PM</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.EXCLAMATION</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.SENTENCEEND</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.SEMICOLON</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.PM</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.WS</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.ANY</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.NUM</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.ANY</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.SPECIAL</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.ANY</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.NBSP</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.ANY</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.AMP</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.ANY</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.SPACE</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.WS</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.BREAK</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.WS</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.Document</name>
+      <description/>
+      <supertypeName>uima.tcas.DocumentAnnotation</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.BasicAnnotation</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.TextMarkerBasic</supertypeName>
+    </typeDescription>
+  </types>
+</typeSystemDescription>

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/BasicTypeSystem.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/BasicTypeSystem.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/ExportActionHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/ExportActionHandler.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/ExportActionHandler.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/ExportActionHandler.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.query.ui;
+
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+public class ExportActionHandler extends AbstractHandler {
+
+  @Override
+  public Object execute(ExecutionEvent event) throws ExecutionException {
+    QueryView view = (QueryView) HandlerUtil.getActivePart(event);
+    QueryComposite composite = (QueryComposite) view.getComposite();
+
+    TableViewer viewer = composite.getResultViewer();
+    Shell shell = HandlerUtil.getActiveShell(event);
+
+    StringBuilder sb = new StringBuilder();
+
+    List<QueryResult> dataList = (List<QueryResult>) viewer.getInput();
+
+    for (QueryResult entry : dataList) {
+      String text = entry.getText();
+      text = text.replaceAll("[\\n\\r]", " ").replaceAll("[\\s]+", " ");
+      sb.append(text);
+      sb.append("\n");
+    }
+
+    ResultListDialog dialog = new ResultListDialog(shell, sb.toString());
+    dialog.open();
+
+    // MessageDialog.openConfirm(shell, "Evaluation Data", text);
+
+    return null;
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/ExportActionHandler.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/ExportActionHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/InternalTypeSystem.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/InternalTypeSystem.xml?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/InternalTypeSystem.xml (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/InternalTypeSystem.xml Fri Aug 12 11:14:14 2011
@@ -0,0 +1,296 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements.  See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  
+  http://www.apache.org/licenses/LICENSE-2.0
+  
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied.  See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<typeSystemDescription xmlns="http://uima.apache.org/resourceSpecifier">
+  <name>InternalTypeSystem</name>
+  <description/>
+  <version>1.0</version>
+  <vendor/>
+  <types>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.TextMarkerBasic</name>
+      <description/>
+      <supertypeName>uima.tcas.Annotation</supertypeName>
+      <features>
+        <featureDescription>
+          <name>replacement</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.TextMarkerAnnotation</name>
+      <description/>
+      <supertypeName>uima.tcas.Annotation</supertypeName>
+      <features>
+        <featureDescription>
+          <name>score</name>
+          <description/>
+          <rangeTypeName>uima.cas.Double</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>annotation</name>
+          <description/>
+          <rangeTypeName>uima.tcas.Annotation</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.DebugRuleApply</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.DebugScriptApply</supertypeName>
+      <features>
+        <featureDescription>
+          <name>applied</name>
+          <description/>
+          <rangeTypeName>uima.cas.Integer</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>tried</name>
+          <description/>
+          <rangeTypeName>uima.cas.Integer</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>rules</name>
+          <description/>
+          <rangeTypeName>uima.cas.FSArray</rangeTypeName>
+          <elementType>org.apache.uima.textmarker.type.DebugRuleMatch</elementType>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.DebugRuleMatch</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.ProfiledAnnotation</supertypeName>
+      <features>
+        <featureDescription>
+          <name>elements</name>
+          <description/>
+          <rangeTypeName>uima.cas.FSArray</rangeTypeName>
+          <elementType>org.apache.uima.textmarker.type.DebugRuleElementMatches</elementType>
+        </featureDescription>
+        <featureDescription>
+          <name>matched</name>
+          <description/>
+          <rangeTypeName>uima.cas.Boolean</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>delegates</name>
+          <description/>
+          <rangeTypeName>uima.cas.FSArray</rangeTypeName>
+          <elementType>org.apache.uima.textmarker.type.DebugScriptApply</elementType>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.DebugScriptApply</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.ProfiledAnnotation</supertypeName>
+      <features>
+        <featureDescription>
+          <name>element</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.DebugBlockApply</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.DebugRuleApply</supertypeName>
+      <features>
+        <featureDescription>
+          <name>innerApply</name>
+          <description/>
+          <rangeTypeName>uima.cas.FSArray</rangeTypeName>
+          <elementType>org.apache.uima.textmarker.type.DebugScriptApply</elementType>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.DebugRuleElementMatch</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.ProfiledAnnotation</supertypeName>
+      <features>
+        <featureDescription>
+          <name>baseCondition</name>
+          <description/>
+          <rangeTypeName>org.apache.uima.textmarker.type.DebugEvaluatedCondition</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>conditions</name>
+          <description/>
+          <rangeTypeName>uima.cas.FSArray</rangeTypeName>
+          <elementType>org.apache.uima.textmarker.type.DebugEvaluatedCondition</elementType>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.DebugRuleElementMatches</name>
+      <description/>
+      <supertypeName>uima.cas.TOP</supertypeName>
+      <features>
+        <featureDescription>
+          <name>matches</name>
+          <description/>
+          <rangeTypeName>uima.cas.FSArray</rangeTypeName>
+          <elementType>org.apache.uima.textmarker.type.DebugRuleElementMatch</elementType>
+        </featureDescription>
+        <featureDescription>
+          <name>element</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.TextMarkerColoring</name>
+      <description/>
+      <supertypeName>uima.tcas.Annotation</supertypeName>
+      <features>
+        <featureDescription>
+          <name>bgColor</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>targetType</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>fgColor</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>selected</name>
+          <description/>
+          <rangeTypeName>uima.cas.Boolean</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.DebugEvaluatedCondition</name>
+      <description/>
+      <supertypeName>uima.cas.TOP</supertypeName>
+      <features>
+        <featureDescription>
+          <name>element</name>
+          <description/>
+          <rangeTypeName>uima.cas.String</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>value</name>
+          <description/>
+          <rangeTypeName>uima.cas.Boolean</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>conditions</name>
+          <description/>
+          <rangeTypeName>uima.cas.FSArray</rangeTypeName>
+          <elementType>org.apache.uima.textmarker.type.DebugEvaluatedCondition</elementType>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.DebugMatchedRuleMatch</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.DebugRuleMatch</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.DebugFailedRuleMatch</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.DebugRuleMatch</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.FalsePositive</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.EvalAnnotation</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.EvalAnnotation</name>
+      <description/>
+      <supertypeName>uima.tcas.Annotation</supertypeName>
+      <features>
+        <featureDescription>
+          <name>original</name>
+          <description/>
+          <rangeTypeName>uima.tcas.Annotation</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.FalseNegative</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.EvalAnnotation</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.ProfiledAnnotation</name>
+      <description/>
+      <supertypeName>uima.tcas.Annotation</supertypeName>
+      <features>
+        <featureDescription>
+          <name>time</name>
+          <description/>
+          <rangeTypeName>uima.cas.Long</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.TextMarkerFrame</name>
+      <description/>
+      <supertypeName>uima.tcas.Annotation</supertypeName>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.Statistics</name>
+      <description/>
+      <supertypeName>uima.cas.TOP</supertypeName>
+      <features>
+        <featureDescription>
+          <name>name</name>
+          <description/>
+          <rangeTypeName>uima.cas.StringArray</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>total</name>
+          <description/>
+          <rangeTypeName>uima.cas.DoubleArray</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>amount</name>
+          <description/>
+          <rangeTypeName>uima.cas.IntegerArray</rangeTypeName>
+        </featureDescription>
+        <featureDescription>
+          <name>part</name>
+          <description/>
+          <rangeTypeName>uima.cas.DoubleArray</rangeTypeName>
+        </featureDescription>
+      </features>
+    </typeDescription>
+    <typeDescription>
+      <name>org.apache.uima.textmarker.type.TruePositive</name>
+      <description/>
+      <supertypeName>org.apache.uima.textmarker.type.EvalAnnotation</supertypeName>
+    </typeDescription>
+  </types>
+</typeSystemDescription>

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/InternalTypeSystem.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/InternalTypeSystem.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryActionHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryActionHandler.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryActionHandler.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryActionHandler.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,359 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.query.ui;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.uima.UIMAFramework;
+import org.apache.uima.analysis_engine.AnalysisEngine;
+import org.apache.uima.analysis_engine.AnalysisEngineDescription;
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.FSIterator;
+import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.impl.XmiCasDeserializer;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.jcas.cas.FSArray;
+import org.apache.uima.resource.ResourceManager;
+import org.apache.uima.resource.ResourceSpecifier;
+import org.apache.uima.resource.metadata.TypeSystemDescription;
+import org.apache.uima.textmarker.engine.TextMarkerEngine;
+import org.apache.uima.textmarker.ide.core.builder.TextMarkerProjectUtils;
+import org.apache.uima.util.CasCreationUtils;
+import org.apache.uima.util.FileUtils;
+import org.apache.uima.util.XMLInputSource;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.commands.IHandlerListener;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.dltk.core.DLTKCore;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+public class QueryActionHandler implements IHandler {
+
+  private class QueryJobChangeAdapter extends JobChangeAdapter {
+
+    private QueryComposite composite;
+
+    QueryJobChangeAdapter(QueryComposite composite) {
+      super();
+      this.composite = composite;
+    }
+
+    @Override
+    public void done(IJobChangeEvent event) {
+      if (event.getResult().isOK()) {
+        composite.getDisplay().asyncExec(new Runnable() {
+          public void run() {
+            composite.update();
+          }
+        });
+      }
+    }
+  }
+
+  private class QueryHandlerJob extends Job {
+    ExecutionEvent event;
+
+    private boolean recursive;
+
+    private String rules;
+
+    private String typeSystemLocation;
+
+    private String dataLocation;
+
+    QueryHandlerJob(ExecutionEvent event, String dir, String typeSystem, String rules,
+            boolean recurive) {
+      super("Query in " + dir + "...");
+      this.event = event;
+      this.dataLocation = dir;
+      this.typeSystemLocation = typeSystem;
+      this.rules = rules;
+      this.recursive = recurive;
+      setUser(true);
+    }
+
+    private String getText(File each) {
+      try {
+        return FileUtils.file2String(each, "UTF-8");
+      } catch (IOException e) {
+        DLTKCore.error(e.getMessage(), e);
+      }
+      return "";
+    }
+
+    @Override
+    public IStatus run(IProgressMonitor monitor) {
+      final QueryView queryView = (QueryView) HandlerUtil.getActivePart(event);
+      final QueryComposite queryComposite = (QueryComposite) queryView.getComposite();
+      // queryView.saveState();
+      queryView.showBusy(true);
+      monitor.beginTask("Initializing analysis engine...", 1);
+      queryComposite.getDisplay().asyncExec(new Runnable() {
+        @Override
+        public void run() {
+          queryComposite.setResult(null);
+        }
+      });
+
+      int files = 0;
+      int found = 0;
+
+      if (monitor.isCanceled())
+        return Status.CANCEL_STATUS;
+
+      final List<QueryResult> result = new ArrayList<QueryResult>();
+      String script = "PACKAGE query;\n\n";
+      // script += "TYPESYSTEM " + typeSystemFileText.getText();
+      script += rules;
+      try {
+        URL aedesc = getClass().getResource("BasicEngine.xml");
+        XMLInputSource inae = new XMLInputSource(aedesc);
+        ResourceSpecifier specifier = UIMAFramework.getXMLParser().parseResourceSpecifier(inae);
+        ResourceManager resMgr = UIMAFramework.newDefaultResourceManager();
+        AnalysisEngineDescription aed = (AnalysisEngineDescription) specifier;
+        TypeSystemDescription basicTypeSystem = aed.getAnalysisEngineMetaData().getTypeSystem();
+
+        if (!typeSystemLocation.equals("")) {
+          // TODO check on valid input and extend for scr
+          String tsLocation = typeSystemLocation;
+          Collection<TypeSystemDescription> tsds = new ArrayList<TypeSystemDescription>();
+          tsds.add(basicTypeSystem);
+          if (typeSystemLocation.endsWith(".tm")) {
+            IFile iFile = QueryComposite.getIFile(typeSystemLocation);
+            IPath scriptPath = iFile.getLocation();
+            IProject project = iFile.getProject();
+            IPath descriptorRootPath = TextMarkerProjectUtils.getDescriptorRootPath(project);
+            resMgr.setDataPath(descriptorRootPath.toPortableString());
+            IPath path = TextMarkerProjectUtils.getTypeSystemDescriptorPath(scriptPath, project);
+            tsLocation = path.toPortableString();
+          }
+          File tsFile = new File(tsLocation);
+          XMLInputSource ints = new XMLInputSource(tsFile);
+          TypeSystemDescription importTSD = (TypeSystemDescription) UIMAFramework.getXMLParser()
+                  .parseTypeSystemDescription(ints);
+          importTSD.resolveImports(resMgr);
+          tsds.add(importTSD);
+          TypeSystemDescription mergeTypeSystems = CasCreationUtils.mergeTypeSystems(tsds);
+          aed.getAnalysisEngineMetaData().setTypeSystem(mergeTypeSystems);
+        }
+        aed.resolveImports(resMgr);
+        AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(aed, resMgr, null);
+        File tempFile = File.createTempFile("TextMarkerQuery", ".tm");
+        tempFile.deleteOnExit();
+        FileUtils.saveString2File(script, tempFile, "UTF-8");
+        String portableString = Path.fromOSString(tempFile.getParentFile().getPath())
+                .toPortableString();
+        ae.setConfigParameterValue(TextMarkerEngine.SCRIPT_PATHS, new String[] { portableString });
+        String name = tempFile.getName().substring(0, tempFile.getName().length() - 3);
+        ae.setConfigParameterValue(TextMarkerEngine.MAIN_SCRIPT, name);
+
+        ae.setConfigParameterValue(TextMarkerEngine.CREATE_DEBUG_INFO, true);
+        ae.setConfigParameterValue(TextMarkerEngine.CREATE_MATCH_DEBUG_INFO, true);
+        ae.setConfigParameterValue(TextMarkerEngine.CREATE_PROFILING_INFO, false);
+        ae.setConfigParameterValue(TextMarkerEngine.CREATE_STATISTIC_INFO, false);
+        ae.reconfigure();
+        CAS cas = ae.newCAS();
+
+        monitor.worked(1);
+
+        if (monitor.isCanceled())
+          return Status.CANCEL_STATUS;
+
+        File dir = new File(dataLocation);
+        List<File> inputFiles = getFiles(dir, recursive);
+        monitor.beginTask("Query in " + dir.getName() + "...", inputFiles.size());
+
+        for (File each : inputFiles) {
+
+          monitor.setTaskName("Query in " + each.getName() + "...");
+
+          if (monitor.isCanceled())
+            return Status.CANCEL_STATUS;
+
+          cas.reset();
+          if (each.getName().endsWith("xmi")) {
+            XmiCasDeserializer.deserialize(new FileInputStream(each), cas, true);
+          } else {
+            cas.setDocumentText(getText(each));
+          }
+
+          ae.process(cas);
+
+          Type matchedType = cas.getTypeSystem().getType(
+                  "org.apache.uima.textmarker.type.DebugMatchedRuleMatch");
+          Type ruleApplyType = cas.getTypeSystem().getType(
+                  "org.apache.uima.textmarker.type.DebugRuleApply");
+          Type blockApplyType = cas.getTypeSystem().getType(
+                  "org.apache.uima.textmarker.type.DebugBlockApply");
+
+          Feature innerApplyFeature = blockApplyType.getFeatureByBaseName("innerApply");
+          Feature ruleApplyFeature = blockApplyType.getFeatureByBaseName("rules");
+          FSIterator<AnnotationFS> iterator = cas.getAnnotationIndex(blockApplyType).iterator();
+          boolean foundOne = false;
+          while (iterator.isValid()) {
+            if (monitor.isCanceled())
+              return Status.CANCEL_STATUS;
+            AnnotationFS fs = iterator.get();
+            int find = findRuleMatches(result, fs, each, queryComposite, matchedType,
+                    ruleApplyType, blockApplyType, innerApplyFeature, ruleApplyFeature);
+            iterator.moveToNext();
+            found += find;
+            if (!foundOne && find > 0) {
+              foundOne = true;
+              files++;
+            }
+
+            final int constFound = found;
+            final int constFiles = files;
+            queryComposite.getDisplay().asyncExec(new Runnable() {
+              @Override
+              public void run() {
+                queryComposite.setResultInfo(constFound, constFiles);
+              }
+            });
+          }
+
+          monitor.worked(1);
+        }
+        cas.release();
+        monitor.done();
+      } catch (Exception e) {
+        e.printStackTrace();
+      }
+
+      return Status.OK_STATUS;
+
+    }
+
+    public int findRuleMatches(final List<QueryResult> result, AnnotationFS fs, File file,
+            final QueryComposite queryComposite, Type matchedType, Type ruleApplyType,
+            Type blockApplyType, Feature innerApplyFeature, Feature ruleApplyFeature) {
+      int ret = 0;
+      if (fs.getType().equals(blockApplyType)) {
+        FeatureStructure featureValue = fs.getFeatureValue(innerApplyFeature);
+        FSArray array = (FSArray) featureValue;
+        for (int i = 0; i < array.size(); i++) {
+          AnnotationFS eachApply = (AnnotationFS) array.get(i);
+          ret += findRuleMatches(result, eachApply, file, queryComposite, matchedType,
+                  ruleApplyType, blockApplyType, innerApplyFeature, ruleApplyFeature);
+        }
+      } else if (fs.getType().equals(ruleApplyType)) {
+        FeatureStructure featureValue = fs.getFeatureValue(ruleApplyFeature);
+        FSArray array = (FSArray) featureValue;
+        for (int i = 0; i < array.size(); i++) {
+          AnnotationFS eachApply = (AnnotationFS) array.get(i);
+          ret += findRuleMatches(result, eachApply, file, queryComposite, matchedType,
+                  ruleApplyType, blockApplyType, innerApplyFeature, ruleApplyFeature);
+        }
+      } else if (fs.getType().equals(matchedType)) {
+        String text = fs.getCoveredText();
+        result.add(new QueryResult(text, file));
+        ret += 1;
+        queryComposite.getDisplay().asyncExec(new Runnable() {
+          @Override
+          public void run() {
+            queryComposite.setResult(result);
+          }
+        });
+
+      }
+      return ret;
+    }
+  }
+
+  @Override
+  public void addHandlerListener(IHandlerListener handlerListener) {
+
+  }
+
+  @Override
+  public void dispose() {
+
+  }
+
+  @Override
+  public Object execute(ExecutionEvent event) throws ExecutionException {
+
+    QueryView queryView = (QueryView) HandlerUtil.getActivePart(event);
+    QueryComposite queryComposite = (QueryComposite) queryView.getComposite();
+
+    String dir = queryComposite.getDataDirectory();
+    String typesystem = queryComposite.getTypeSystem();
+    String script = queryComposite.getScript();
+    boolean recurive = queryComposite.isRecursive();
+    QueryHandlerJob job = new QueryHandlerJob(event, dir, typesystem, script, recurive);
+
+    job.addJobChangeListener(new QueryJobChangeAdapter(queryComposite) {
+    });
+
+    job.schedule();
+
+    return null;
+  }
+
+  @Override
+  public boolean isEnabled() {
+    return true;
+  }
+
+  @Override
+  public boolean isHandled() {
+    return true;
+  }
+
+  @Override
+  public void removeHandlerListener(IHandlerListener handlerListener) {
+
+  }
+
+  public static List<File> getFiles(File dir, boolean recusive) {
+    List<File> result = new ArrayList<File>();
+    for (File each : dir.listFiles()) {
+      // TODO: find a solution for this hotfix
+      if (each.getName().endsWith(".svn")) {
+        continue;
+      }
+      result.add(each);
+      if (each.isDirectory() && recusive) {
+        result.addAll(getFiles(each, recusive));
+      }
+    }
+    return result;
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryActionHandler.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryActionHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryComposite.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryComposite.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryComposite.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryComposite.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,491 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.query.ui;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.apache.uima.textmarker.addons.TextMarkerAddonsPlugin;
+import org.apache.uima.textmarker.ide.core.TextMarkerLanguageToolkit;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.dltk.internal.ui.editor.ScriptSourceViewer;
+import org.eclipse.dltk.ui.DLTKUILanguageManager;
+import org.eclipse.dltk.ui.IDLTKUILanguageToolkit;
+import org.eclipse.dltk.ui.text.ScriptSourceViewerConfiguration;
+import org.eclipse.dltk.ui.text.ScriptTextTools;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTarget;
+import org.eclipse.swt.dnd.DropTargetAdapter;
+import org.eclipse.swt.dnd.DropTargetEvent;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+public class QueryComposite extends org.eclipse.swt.widgets.Composite {
+  protected ScriptSourceViewer viewer;
+
+  private HashMap<String, Image> images;
+
+  private Button dirButton;
+
+  private Text inputDirectoryText;
+
+  private Label label1;
+
+  private Label labelTypeSystem;
+
+  private Text typeSystemFileText;
+
+  private Button fileChooseButton;
+
+  private Button recursiveButton;
+
+  // private Button startButton;
+
+  private TableViewer resultViewer;
+
+  private Label resultLabel;
+
+  public QueryComposite(Composite parent, int style) {
+    super(parent, style);
+
+    // initImages();
+    initGUI();
+
+    ScrolledComposite sComp = new ScrolledComposite(parent, SWT.BORDER | SWT.V_SCROLL
+            | SWT.H_SCROLL);
+    this.setParent(sComp);
+    sComp.setMinSize(this.getSize());
+    sComp.setContent(this);
+    sComp.setExpandHorizontal(true);
+    sComp.setExpandVertical(true);
+  }
+
+  private void initGUI() {
+    try {
+      this.setLayout(new FormLayout());
+      this.setSize(600, 380);
+
+      label1 = new Label(this, SWT.NONE);
+      FormData label1LData = new FormData();
+      label1LData.left = new FormAttachment(0, 1000, 12);
+      label1LData.top = new FormAttachment(0, 1000, 10);
+      label1LData.width = 70;
+      label1.setLayoutData(label1LData);
+      label1.setText("Query Data:");
+
+      inputDirectoryText = new Text(this, SWT.SINGLE | SWT.BORDER);
+      FormData inputDirectoryTexLData = new FormData();
+      inputDirectoryTexLData.width = 150;
+      inputDirectoryTexLData.left = new FormAttachment(0, 1000, 90);
+      inputDirectoryTexLData.top = new FormAttachment(0, 1000, 10);
+      inputDirectoryTexLData.right = new FormAttachment(1000, 1000, -65);
+      inputDirectoryText.setLayoutData(inputDirectoryTexLData);
+      inputDirectoryText.setText("");
+      inputDirectoryText.addModifyListener(new ModifyListener() {
+        public void modifyText(ModifyEvent e) {
+          // without that listener, the text fields forget the
+          // last change when leaving with tab! don't know why!
+          // we also MUST call getText() otherwise the changes in
+          // the field are lost (what is this???!!)
+          Text t = (Text) e.widget;
+          t.getText();
+        }
+      });
+
+      dirButton = new Button(this, SWT.PUSH | SWT.CENTER);
+      FormData dirButtoLData = new FormData();
+      dirButtoLData.width = 25;
+      dirButtoLData.height = 25;
+      dirButtoLData.top = new FormAttachment(0, 1000, 8);
+      dirButtoLData.right = new FormAttachment(1000, 1000, -35);
+      dirButton.setLayoutData(dirButtoLData);
+      Image folderIcon = getImage("folder");
+      dirButton.setImage(folderIcon);
+      dirButton.addSelectionListener(new SelectionAdapter() {
+        @Override
+        public void widgetSelected(SelectionEvent event) {
+          DirectoryDialog dlg = new DirectoryDialog(getShell());
+          dlg.setFilterPath(inputDirectoryText.getText());
+          dlg.setText("Input Directory");
+          dlg.setMessage("Select a directory with input XMI files.");
+          String dir = dlg.open();
+          if (dir != null) {
+            inputDirectoryText.setText(dir);
+          }
+        }
+      });
+
+      recursiveButton = new Button(this, SWT.CHECK | SWT.LEFT);
+      FormData recuriveButtonLData = new FormData();
+      recuriveButtonLData.width = 20;
+      recuriveButtonLData.height = 18;
+      recuriveButtonLData.top = new FormAttachment(0, 1000, 10);
+      recuriveButtonLData.right = new FormAttachment(1000, 1000, -10);
+      recursiveButton.setLayoutData(recuriveButtonLData);
+      recursiveButton.setSelection(true);
+
+      labelTypeSystem = new Label(this, SWT.NONE);
+      FormData label3LData = new FormData();
+      label3LData.width = 70;
+      label3LData.left = new FormAttachment(0, 1000, 12);
+      label3LData.top = new FormAttachment(0, 1000, 34);
+      labelTypeSystem.setLayoutData(label3LData);
+      labelTypeSystem.setText("Type System:");
+
+      typeSystemFileText = new Text(this, SWT.SINGLE | SWT.BORDER);
+      FormData preFileTexLData = new FormData();
+      preFileTexLData.width = 150;
+      preFileTexLData.left = new FormAttachment(0, 1000, 90);
+      preFileTexLData.top = new FormAttachment(0, 1000, 34);
+      preFileTexLData.right = new FormAttachment(1000, 1000, -65);
+      typeSystemFileText.setLayoutData(preFileTexLData);
+      typeSystemFileText.setText("");
+      typeSystemFileText.addModifyListener(new ModifyListener() {
+        public void modifyText(ModifyEvent e) {
+          // without that listener, the text fields forget the
+          // last change when leaving with tab! don't know why!
+          // we also MUST call getText() otherwise the changes in
+          // the field are lost (what is this???!!)
+          Text t = (Text) e.widget;
+          t.getText();
+        }
+      });
+
+      fileChooseButton = new Button(this, SWT.PUSH | SWT.CENTER);
+      FormData fileChooseButtoLData = new FormData();
+      fileChooseButtoLData.width = 25;
+      fileChooseButtoLData.height = 25;
+      fileChooseButtoLData.top = new FormAttachment(0, 1000, 32);
+      fileChooseButtoLData.right = new FormAttachment(1000, 1000, -35);
+      fileChooseButton.setLayoutData(fileChooseButtoLData);
+      Image icon = getImage("prepFolder");
+      fileChooseButton.setImage(icon);
+      fileChooseButton.addSelectionListener(new SelectionAdapter() {
+        @Override
+        public void widgetSelected(SelectionEvent event) {
+          FileDialog fd = new FileDialog(getShell(), SWT.OPEN);
+          fd.setText("Choose Type System Descriptor or TextMarker Script");
+          String[] filterExt = { "*.tm", "*.*" };
+          fd.setFilterExtensions(filterExt);
+          String file = fd.open();
+          if (file != null) {
+            typeSystemFileText.setText(file);
+          }
+        }
+      });
+
+      Composite composite1 = new Composite(this, SWT.CENTER);
+      FormData compData = new FormData();
+      // compData.width = 300;
+      compData.height = 100;
+      compData.left = new FormAttachment(0, 1000, 10);
+      compData.top = new FormAttachment(0, 1000, 75);
+      compData.right = new FormAttachment(1000, 1000, -10);
+      // compData.left = new FormAttachment(0, 1000, 12);
+      // compData.top = new FormAttachment(0, 1000, 70);
+      // compData.bottom = new FormAttachment(0, 1000, -10);
+      // compData.right = new FormAttachment(1000, 1000, -10);
+      // compData.width = 109;
+      // composite1.setSize(500, 500);
+      composite1.setLayoutData(compData);
+      composite1.setLayout(new FillLayout());
+      IDLTKUILanguageToolkit toolkit = DLTKUILanguageManager
+              .getLanguageToolkit(TextMarkerLanguageToolkit.getDefault().getNatureId());
+      final ScriptTextTools textTools = toolkit.getTextTools();
+      IPreferenceStore store = toolkit.getCombinedPreferenceStore();
+      viewer = new ScriptSourceViewer(composite1, null, null, false, SWT.H_SCROLL | SWT.V_SCROLL
+              | SWT.BORDER, store);
+
+      ScriptSourceViewerConfiguration configuration = textTools.createSourceViewerConfiguraton(
+              store, (ITextEditor) null);
+      viewer.configure(configuration);
+      setInformation("");
+      composite1.layout();
+
+      resultLabel = new Label(this, SWT.NONE);
+      FormData resultLabelData = new FormData();
+      resultLabelData.left = new FormAttachment(0, 1000, 12);
+      resultLabelData.top = new FormAttachment(0, 1000, 180);
+      resultLabelData.width = 300;
+      resultLabel.setLayoutData(resultLabelData);
+      resultLabel.setText("Result:");
+
+      Composite composite2 = new Composite(this, SWT.CENTER);
+      FormData comp2Data = new FormData();
+      // comp2Data.width = 300;
+      // comp2Data.height = 200;
+      comp2Data.left = new FormAttachment(0, 1000, 10);
+      comp2Data.top = new FormAttachment(0, 1000, 195);
+      comp2Data.right = new FormAttachment(1000, 1000, -10);
+      comp2Data.bottom = new FormAttachment(1000, 1000, -10);
+      // compData.left = new FormAttachment(0, 1000, 12);
+      // compData.top = new FormAttachment(0, 1000, 70);
+      // compData.bottom = new FormAttachment(0, 1000, -10);
+      // compData.right = new FormAttachment(1000, 1000, -10);
+      // compData.width = 109;
+      // composite2.setSize(500, 500);
+      // composite.setBackground(new Color(getDisplay(), 128, 0, 0));
+      composite2.setLayoutData(comp2Data);
+      composite2.setLayout(new FillLayout());
+
+      resultViewer = new TableViewer(composite2, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+      resultViewer.setLabelProvider(new QueryResultLabelProvider());
+      resultViewer.setContentProvider(new QueryResultContentProvider());
+      resultViewer.addDoubleClickListener(new IDoubleClickListener() {
+        @Override
+        public void doubleClick(DoubleClickEvent event) {
+          Object obj = event.getSelection();
+          if (obj instanceof IStructuredSelection) {
+            StructuredSelection selection = (StructuredSelection) obj;
+            Iterator<?> iterator = selection.iterator();
+            while (iterator.hasNext()) {
+              Object element = iterator.next();
+              if (element instanceof QueryResult) {
+                QueryResult data = (QueryResult) element;
+                if (data.getFile() != null) {
+                  openInCEV(data.getFile());
+                }
+              }
+            }
+          }
+
+        }
+      });
+      composite2.layout();
+
+      this.layout();
+    } catch (Exception e) {
+      TextMarkerAddonsPlugin.error(e);
+    }
+
+    DropTarget dt = new DropTarget(inputDirectoryText, DND.DROP_DEFAULT | DND.DROP_MOVE);
+    dt.setTransfer(new Transfer[] { FileTransfer.getInstance() });
+    dt.addDropListener(new DropTargetAdapter() {
+      @Override
+      public void drop(DropTargetEvent event) {
+        String fileList[] = null;
+        FileTransfer ft = FileTransfer.getInstance();
+        if (ft.isSupportedType(event.currentDataType)) {
+          fileList = (String[]) event.data;
+        }
+        if (fileList.length > 0)
+          inputDirectoryText.setText(fileList[0]);
+      }
+    });
+
+    DropTarget dt2 = new DropTarget(typeSystemFileText, DND.DROP_DEFAULT | DND.DROP_MOVE);
+    dt2.setTransfer(new Transfer[] { FileTransfer.getInstance() });
+    dt2.addDropListener(new DropTargetAdapter() {
+      @Override
+      public void drop(DropTargetEvent event) {
+        String fileList[] = null;
+        FileTransfer ft = FileTransfer.getInstance();
+        if (ft.isSupportedType(event.currentDataType)) {
+          fileList = (String[]) event.data;
+        }
+        if (fileList.length > 0)
+          typeSystemFileText.setText(fileList[0]);
+      }
+    });
+
+  }
+
+  public void setResultInfo(int found, int files) {
+    resultLabel.setText("Result: found " + found + " matches in " + files + " documents");
+  }
+
+  public void saveState(IMemento memento) {
+
+    memento.createChild("inputDirectory", inputDirectoryText.getText());
+    memento.createChild("typeSystemLocation", typeSystemFileText.getText());
+    memento.createChild("query", viewer.getDocument().get());
+    memento.createChild("recursive", Boolean.toString(recursiveButton.getSelection()));
+  }
+
+  public void restoreState(IMemento memento) {
+    if (memento == null)
+      return;
+
+    IMemento tsName = memento.getChild("typeSystemLocation");
+    if (tsName != null) {
+      typeSystemFileText.setText(tsName.getID());
+    }
+
+    IMemento dir = memento.getChild("inputDirectory");
+    if (dir != null) {
+      inputDirectoryText.setText(dir.getID());
+    }
+
+    IMemento query = memento.getChild("query");
+    if (query != null) {
+      setInformation(query.getID());
+    }
+
+    IMemento recursive = memento.getChild("recursive");
+    if (recursive != null) {
+      boolean isRecursive = recursive.getID().equals("true");
+      recursiveButton.setSelection(isRecursive);
+    }
+  }
+
+  protected void openInCEV(File file) {
+    if (file == null) {
+      return;
+    }
+    String absolutePath = file.getAbsolutePath();
+    try {
+      IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+      IFile ifile = getIFile(absolutePath);
+      page.openEditor(new FileEditorInput(ifile), "org.apache.uima.cev.editor.CEVViewer");
+    } catch (PartInitException e) {
+      e.printStackTrace();
+    }
+  }
+
+  public static IFile getIFile(String location) {
+    IPath s = Path.fromOSString(location);
+    IWorkspace workspace = ResourcesPlugin.getWorkspace();
+    IFile ifile = workspace.getRoot().getFileForLocation(s);
+    return ifile;
+  }
+
+  public void setInformation(String content) {
+    if (content == null) {
+      viewer.setInput(null);
+      return;
+    }
+    IDocument doc = new Document(content);
+    IDLTKUILanguageToolkit uiToolkit = DLTKUILanguageManager
+            .getLanguageToolkit(TextMarkerLanguageToolkit.getDefault().getNatureId());
+    ScriptTextTools textTools = uiToolkit.getTextTools();
+    if (textTools != null) {
+      textTools.setupDocumentPartitioner(doc, uiToolkit.getPartitioningId());
+    }
+    viewer.setInput(doc);
+  }
+
+  private void initImages() {
+    images = new HashMap<String, Image>();
+    ImageDescriptor desc;
+    Image image;
+    String name;
+
+    desc = TextMarkerAddonsPlugin.getImageDescriptor("/icons/folder_edit.png");
+    image = desc.createImage();
+    name = "prepFolder";
+    images.put(name, image);
+
+    desc = TextMarkerAddonsPlugin.getImageDescriptor("/icons/folder.png");
+    image = desc.createImage();
+    name = "folder";
+    images.put(name, image);
+
+    desc = TextMarkerAddonsPlugin.getImageDescriptor("/icons/start.png");
+    image = desc.createImage();
+    name = "start";
+    images.put(name, image);
+
+    desc = TextMarkerAddonsPlugin.getImageDescriptor("/icons/stop.gif");
+    image = desc.createImage();
+    name = "stop";
+    images.put(name, image);
+
+  }
+
+  public Image getImage(String name) {
+    if (images == null) {
+      initImages();
+    }
+    return images.get(name);
+  }
+
+  @Override
+  public void dispose() {
+    super.dispose();
+    if (images != null) {
+      for (Image each : images.values()) {
+        each.dispose();
+      }
+    }
+  }
+
+  public String getDataDirectory() {
+    return inputDirectoryText.getText().trim();
+  }
+
+  public String getTypeSystem() {
+    return typeSystemFileText.getText().trim();
+  }
+
+  public String getScript() {
+    return viewer.getDocument().get();
+  }
+
+  public boolean isRecursive() {
+    return recursiveButton.getSelection();
+  }
+
+  public void setResult(Object object) {
+    resultViewer.setInput(object);
+    resultViewer.refresh();
+  }
+
+  public TableViewer getResultViewer() {
+    return resultViewer;
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryComposite.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryComposite.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryResult.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryResult.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryResult.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryResult.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.query.ui;
+
+import java.io.File;
+
+public class QueryResult {
+
+  private String text;
+
+  private File file;
+
+  public QueryResult(String text, File file) {
+    super();
+    this.setText(text);
+    this.setFile(file);
+  }
+
+  public void setFile(File file) {
+    this.file = file;
+  }
+
+  public File getFile() {
+    return file;
+  }
+
+  public void setText(String text) {
+    this.text = text;
+  }
+
+  public String getText() {
+    return text;
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryResult.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryResult.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryResultContentProvider.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryResultContentProvider.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryResultContentProvider.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryResultContentProvider.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.query.ui;
+
+import java.util.ArrayList;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+public class QueryResultContentProvider implements IStructuredContentProvider {
+
+  @Override
+  public void dispose() {
+
+  }
+
+  @Override
+  public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+
+  }
+
+  @Override
+  public Object[] getElements(Object inputElement) {
+    return ((ArrayList<?>) inputElement).toArray();
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryResultContentProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryResultContentProvider.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryResultLabelProvider.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryResultLabelProvider.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryResultLabelProvider.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryResultLabelProvider.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.query.ui;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.swt.graphics.Image;
+
+public class QueryResultLabelProvider implements ILabelProvider {
+  @Override
+  public Image getImage(Object element) {
+    return null;
+  }
+
+  @Override
+  public String getText(Object element) {
+    if (element instanceof QueryResult) {
+      QueryResult qr = (QueryResult) element;
+      String text = qr.getText();
+      // if (text.length() > 100) {
+      // text = text.substring(0, 100) + "...";
+      // }
+      text += " (in " + qr.getFile().getName() + ")";
+      return text;
+    }
+    return "error";
+  }
+
+  @Override
+  public void addListener(ILabelProviderListener listener) {
+
+  }
+
+  @Override
+  public void dispose() {
+  }
+
+  @Override
+  public boolean isLabelProperty(Object element, String property) {
+    return false;
+  }
+
+  @Override
+  public void removeListener(ILabelProviderListener listener) {
+
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryResultLabelProvider.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryResultLabelProvider.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryView.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryView.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryView.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryView.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.query.ui;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.part.ViewPart;
+
+public class QueryView extends ViewPart {
+
+  public static final String ID = "org.apache.uima.textmarker.query.ui.QueryView";
+
+  private QueryComposite viewContent;
+
+  private IMemento memento;
+
+  public QueryView() {
+    super();
+  }
+
+  @Override
+  public void createPartControl(Composite parent) {
+    viewContent = new QueryComposite(parent, SWT.NULL);
+    if (memento != null) {
+      viewContent.restoreState(memento);
+      memento = null;
+    }
+  }
+
+  public void setViewTitle(String title) {
+    setPartName(title);
+  }
+
+  @Override
+  public void setFocus() {
+    viewContent.setFocus();
+  }
+
+  @Override
+  public void saveState(IMemento memento) {
+    viewContent.saveState(memento);
+  }
+
+  @Override
+  public void init(IViewSite site, IMemento memento) throws PartInitException {
+    this.memento = memento;
+    super.init(site, memento);
+  }
+
+  public QueryComposite getComposite() {
+    return viewContent;
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryView.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/QueryView.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/ResultListDialog.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/ResultListDialog.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/ResultListDialog.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/ResultListDialog.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.query.ui;
+
+import org.eclipse.jface.window.ApplicationWindow;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+public class ResultListDialog extends ApplicationWindow {
+
+  Composite overlay;
+
+  String data;
+
+  public ResultListDialog(Shell parentShell, String data) {
+    super(parentShell);
+    this.data = data;
+  }
+
+  protected Control createContents(Composite parent) {
+    GridLayout layout = new GridLayout();
+    parent.setLayout(layout);
+    parent.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+    Text text = new Text(parent, SWT.READ_ONLY | SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
+    text.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
+    text.setText("No data aviable");
+    text.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+    if (text != null) {
+      text.setText(data);
+    }
+    return parent;
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/ResultListDialog.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/query/ui/ResultListDialog.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/DescriptorFolderSearchStrategy.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/DescriptorFolderSearchStrategy.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/DescriptorFolderSearchStrategy.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/DescriptorFolderSearchStrategy.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.searchStrategy;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.uima.cev.extension.ICEVSearchStrategy;
+import org.apache.uima.cev.searchStrategy.CEVCollectionContentProvider;
+import org.apache.uima.textmarker.ide.core.builder.TextMarkerProjectUtils;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.dialogs.ListDialog;
+
+public class DescriptorFolderSearchStrategy implements ICEVSearchStrategy {
+
+  private int priority;
+
+  public DescriptorFolderSearchStrategy(int priority) {
+    super();
+    this.priority = priority;
+  }
+
+  public int getPriority() {
+    return priority;
+  }
+
+  public IFile searchDescriptor(IFile file) {
+    IProject project = file.getProject();
+    IFolder folder = project.getFolder(TextMarkerProjectUtils.getDefaultDescriptorLocation());
+    try {
+      List<IFile> list = collectTypeSystems(folder);
+      ListDialog ld = new ListDialog(Display.getCurrent().getActiveShell());
+      ld.setContentProvider(new CEVCollectionContentProvider<LinkedList<IFile>>());
+      ld.setLabelProvider(new LabelProvider() {
+        @Override
+        public String getText(Object element) {
+          return ((IFile) element).getName();
+        }
+      });
+      if (list == null || list.isEmpty()) {
+        return null;
+      }
+
+      ld.setTitle("Select Type System Descriptor");
+      ld.setInput(list);
+      ld.open();
+
+      if (ld.getResult() != null) {
+        return (IFile) ld.getResult()[0];
+      } else {
+        return null;
+      }
+    } catch (Exception e) {
+      return null;
+    }
+
+  }
+
+  private List<IFile> collectTypeSystems(IFolder folder) throws CoreException {
+    List<IFile> result = new ArrayList<IFile>();
+    for (IResource each : folder.members()) {
+      if (each instanceof IFolder) {
+        result.addAll(collectTypeSystems((IFolder) each));
+      } else if (each instanceof IFile && each.getFileExtension() != null
+              && each.getFileExtension().equals("xml")) {
+        result.add((IFile) each);
+      }
+    }
+    return result;
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/DescriptorFolderSearchStrategy.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/DescriptorFolderSearchStrategy.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/DescriptorFolderSearchStrategyFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/DescriptorFolderSearchStrategyFactory.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/DescriptorFolderSearchStrategyFactory.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/DescriptorFolderSearchStrategyFactory.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.searchStrategy;
+
+import org.apache.uima.cev.extension.ICEVSearchStrategy;
+import org.apache.uima.cev.extension.ICEVSearchStrategyFactory;
+
+public class DescriptorFolderSearchStrategyFactory implements ICEVSearchStrategyFactory {
+
+  public DescriptorFolderSearchStrategyFactory() {
+  }
+
+  public ICEVSearchStrategy createSearchStrategy(int priority) {
+    return new DescriptorFolderSearchStrategy(priority);
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/DescriptorFolderSearchStrategyFactory.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/DescriptorFolderSearchStrategyFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/LastLaunchSearchStrategy.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/LastLaunchSearchStrategy.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/LastLaunchSearchStrategy.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/LastLaunchSearchStrategy.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.searchStrategy;
+
+import org.apache.uima.cev.extension.ICEVSearchStrategy;
+import org.apache.uima.textmarker.ide.core.builder.TextMarkerProjectUtils;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.dltk.internal.launching.LaunchConfigurationUtils;
+import org.eclipse.dltk.launching.ScriptLaunchConfigurationConstants;
+
+public class LastLaunchSearchStrategy implements ICEVSearchStrategy {
+
+  private int priority;
+
+  public LastLaunchSearchStrategy(int priority) {
+    super();
+    this.priority = priority;
+  }
+
+  public int getPriority() {
+    return priority;
+  }
+
+  public IFile searchDescriptor(IFile file) {
+    IProject project = file.getProject();
+    ILaunchConfiguration lastRun = DebugUITools
+            .getLastLaunch("org.eclipse.debug.ui.launchGroup.run");
+    String scriptName = LaunchConfigurationUtils.getString(lastRun,
+            ScriptLaunchConfigurationConstants.ATTR_MAIN_SCRIPT_NAME, "");
+    if (scriptName != null && scriptName.length() != 0 && new Path(scriptName).segmentCount() > 0
+            && Path.ROOT.isValidPath(scriptName)) {
+      final IFile scriptFile = project.getFile(scriptName);
+      if (scriptFile.exists()) {
+        IPath path = TextMarkerProjectUtils.getTypeSystemDescriptorPath(
+                scriptFile.getProjectRelativePath(), project);
+        IFile ts = project.getFile(path.makeRelativeTo(project.getLocation()));
+        if (ts.exists()) {
+          return ts;
+        }
+      }
+    }
+    return null;
+  }
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/LastLaunchSearchStrategy.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/LastLaunchSearchStrategy.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/LastLaunchSearchStrategyFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/LastLaunchSearchStrategyFactory.java?rev=1157050&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/LastLaunchSearchStrategyFactory.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/LastLaunchSearchStrategyFactory.java Fri Aug 12 11:14:14 2011
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.searchStrategy;
+
+import org.apache.uima.cev.extension.ICEVSearchStrategy;
+import org.apache.uima.cev.extension.ICEVSearchStrategyFactory;
+
+public class LastLaunchSearchStrategyFactory implements ICEVSearchStrategyFactory {
+
+  public ICEVSearchStrategy createSearchStrategy(int priority) {
+    return new LastLaunchSearchStrategy(priority);
+  }
+
+}

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/LastLaunchSearchStrategyFactory.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-addons/src/main/java/org/apache/uima/textmarker/searchStrategy/LastLaunchSearchStrategyFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain