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/01 17:30:41 UTC
svn commit: r1152829 [1/2] - in
/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query: ./
META-INF/ bin/ icons/ src/ src/main/ src/main/java/ src/main/java/org/
src/main/java/org/apache/ src/main/java/org/apache/uima/
src/main/java/org/apa...
Author: joern
Date: Mon Aug 1 15:30:34 2011
New Revision: 1152829
URL: http://svn.apache.org/viewvc?rev=1152829&view=rev
Log:
UIMA-2172 Initial commit of the TextMarker contribution.
Added:
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/.classpath (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/.project (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/META-INF/
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/META-INF/MANIFEST.MF (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/bin/
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/build.properties (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/10892.resource_persp.gif (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/13555.actionengine_play.gif (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/basket_edit.png (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/folder.png (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/folder_edit.png (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/start.png (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/stop.gif (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/plugin.xml (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/QueryPlugin.java (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/QuerySearchStrategy.java (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/QuerySearchStrategyFactory.java (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/BasicEngine.xml (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/BasicTypeSystem.xml (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/ExportActionHandler.java (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/InternalTypeSystem.xml (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/QueryActionHandler.java (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/QueryComposite.java (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/QueryResult.java (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/QueryResultContentProvider.java (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/QueryResultLabelProvider.java (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/QueryView.java (with props)
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/ResultListDialog.java (with props)
Modified:
uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/ (props changed)
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Aug 1 15:30:34 2011
@@ -0,0 +1 @@
+.settings
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/.classpath
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/.classpath?rev=1152829&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/.classpath (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/.classpath Mon Aug 1 15:30:34 2011
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/.classpath
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/.classpath
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/.project
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/.project?rev=1152829&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/.project (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/.project Mon Aug 1 15:30:34 2011
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.apache.uima.tm.textmarker.query</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/.project
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/.project
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/META-INF/MANIFEST.MF?rev=1152829&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/META-INF/MANIFEST.MF (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/META-INF/MANIFEST.MF Mon Aug 1 15:30:34 2011
@@ -0,0 +1,26 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: TextMarker Query Plugin
+Bundle-SymbolicName: org.apache.uima.tm.textmarker.query;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.apache.uima.tm.textmarker.query.QueryPlugin
+Bundle-Vendor: University of Würzburg
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.apache.uima.tm.textmarker.engine,
+ org.apache.uima.runtime;bundle-version="2.3.0",
+ org.eclipse.jface.text,
+ org.eclipse.dltk.ui;bundle-version="[1.0.0,2.0.0)",
+ org.apache.uima.tm.dltk.core,
+ org.eclipse.ui.workbench.texteditor,
+ org.eclipse.ui.editors,
+ org.eclipse.dltk.core;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.ui,
+ org.eclipse.core.resources,
+ org.eclipse.core.runtime,
+ org.apache.uima.tm.dltk.antlr,
+ org.eclipse.ui.ide,
+ org.apache.uima.tm.cev,
+ org.apache.uima.tm.dltk.ui;bundle-version="1.0.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/META-INF/MANIFEST.MF
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/META-INF/MANIFEST.MF
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/build.properties
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/build.properties?rev=1152829&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/build.properties (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/build.properties Mon Aug 1 15:30:34 2011
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ icons/
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/build.properties
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/build.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/10892.resource_persp.gif
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/10892.resource_persp.gif?rev=1152829&view=auto
==============================================================================
Binary file - no diff available.
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/10892.resource_persp.gif
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/10892.resource_persp.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/13555.actionengine_play.gif
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/13555.actionengine_play.gif?rev=1152829&view=auto
==============================================================================
Binary file - no diff available.
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/13555.actionengine_play.gif
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/13555.actionengine_play.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/basket_edit.png
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/basket_edit.png?rev=1152829&view=auto
==============================================================================
Binary file - no diff available.
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/basket_edit.png
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/basket_edit.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/folder.png
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/folder.png?rev=1152829&view=auto
==============================================================================
Binary file - no diff available.
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/folder.png
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/folder.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/folder_edit.png
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/folder_edit.png?rev=1152829&view=auto
==============================================================================
Binary file - no diff available.
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/folder_edit.png
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/folder_edit.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/start.png
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/start.png?rev=1152829&view=auto
==============================================================================
Binary file - no diff available.
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/start.png
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/start.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/stop.gif
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/stop.gif?rev=1152829&view=auto
==============================================================================
Binary file - no diff available.
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/stop.gif
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/icons/stop.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/plugin.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/plugin.xml?rev=1152829&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/plugin.xml (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/plugin.xml Mon Aug 1 15:30:34 2011
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ allowMultiple="false"
+ category="org.apache.uima.tm.dltk.ui"
+ class="org.apache.uima.tm.textmarker.query.ui.QueryView"
+ icon="icons/basket_edit.png"
+ id="org.apache.uima.tm.textmarker.query.ui.ScriptQueryView"
+ name="TextMarker Query"
+ restorable="true">
+ </view>
+ </extension>
+ <extension
+ point="org.apache.uima.tm.cev.cevSearchStrategies">
+ <strategy
+ factory="org.apache.uima.tm.textmarker.query.QuerySearchStrategyFactory"
+ id="org.apache.uima.tm.textmarker.query.searchStrategy"
+ priority="0">
+ </strategy>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ defaultHandler="org.apache.uima.tm.textmarker.query.ui.QueryActionHandler"
+ id="org.apache.uima.tm.textmarker.query.command"
+ name="Query Command">
+ </command>
+ <command
+ defaultHandler="org.apache.uima.tm.textmarker.query.ui.ExportActionHandler"
+ id="org.apache.uima.tm.textmarker.query.export"
+ name="Export List">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="toolbar:org.apache.uima.tm.textmarker.query.ui.ScriptQueryView?after=additions">
+ <command
+ commandId="org.apache.uima.tm.textmarker.query.command"
+ icon="icons/13555.actionengine_play.gif"
+ label="Query"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.apache.uima.tm.textmarker.query.export"
+ icon="icons/10892.resource_persp.gif"
+ label="Export List"
+ style="push">
+ <visibleWhen
+ checkEnabled="true">
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ <menuContribution
+ locationURI="toolbar:org.eclipse.ui.main.toolbar">
+ <toolbar
+ id="org.apache.uima.tm.textmarker.ui.query.queryToolbar">
+ </toolbar>
+ </menuContribution>
+ </extension>
+
+</plugin>
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/plugin.xml
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/plugin.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/QueryPlugin.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/QueryPlugin.java?rev=1152829&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/QueryPlugin.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/QueryPlugin.java Mon Aug 1 15:30:34 2011
@@ -0,0 +1,56 @@
+package org.apache.uima.tm.textmarker.query;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class QueryPlugin extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.apache.uima.tm.textmarker.query";
+
+ // The shared instance
+ private static QueryPlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public QueryPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static QueryPlugin getDefault() {
+ return plugin;
+ }
+
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/QueryPlugin.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/QueryPlugin.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/QuerySearchStrategy.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/QuerySearchStrategy.java?rev=1152829&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/QuerySearchStrategy.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/QuerySearchStrategy.java Mon Aug 1 15:30:34 2011
@@ -0,0 +1,27 @@
+package org.apache.uima.tm.textmarker.query;
+
+import org.apache.uima.tm.cev.extension.ICEVSearchStrategy;
+import org.eclipse.core.resources.IFile;
+
+
+public class QuerySearchStrategy implements ICEVSearchStrategy {
+
+ private int priority;
+
+ public QuerySearchStrategy(int priority) {
+
+ this.priority = priority;
+ }
+
+ @Override
+ public int getPriority() {
+ return priority;
+ }
+
+ @Override
+ public IFile searchDescriptor(IFile file) {
+ // TODO: add strategy
+ return null;
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/QuerySearchStrategy.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/QuerySearchStrategy.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/QuerySearchStrategyFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/QuerySearchStrategyFactory.java?rev=1152829&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/QuerySearchStrategyFactory.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/QuerySearchStrategyFactory.java Mon Aug 1 15:30:34 2011
@@ -0,0 +1,17 @@
+package org.apache.uima.tm.textmarker.query;
+
+import org.apache.uima.tm.cev.extension.ICEVSearchStrategy;
+import org.apache.uima.tm.cev.extension.ICEVSearchStrategyFactory;
+
+public class QuerySearchStrategyFactory implements ICEVSearchStrategyFactory {
+
+ public QuerySearchStrategyFactory() {
+ super();
+ }
+
+ @Override
+ public ICEVSearchStrategy createSearchStrategy(int priority) {
+ return new QuerySearchStrategy(priority);
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/QuerySearchStrategyFactory.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/QuerySearchStrategyFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/BasicEngine.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/BasicEngine.xml?rev=1152829&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/BasicEngine.xml (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/BasicEngine.xml Mon Aug 1 15:30:34 2011
@@ -0,0 +1,211 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<analysisEngineDescription xmlns="http://uima.apache.org/resourceSpecifier">
+ <frameworkImplementation>org.apache.uima.java</frameworkImplementation>
+ <primitive>true</primitive>
+ <annotatorImplementationName>org.apache.uima.tm.textmarker.engine.TextMarkerEngine</annotatorImplementationName>
+ <analysisEngineMetaData>
+ <name>BasicEngine</name>
+ <description/>
+ <version>1.0</version>
+ <vendor/>
+ <configurationParameters searchStrategy="language_fallback">
+ <configurationParameter>
+ <name>seeders</name>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>debug</name>
+ <type>Boolean</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>style</name>
+ <type>Boolean</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>styleMap</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>additionalScripts</name>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>profile</name>
+ <type>Boolean</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>debugWithMatches</name>
+ <type>Boolean</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>statistics</name>
+ <type>Boolean</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>additionalEngines</name>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>additionalExtensions</name>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>debugOnlyFor</name>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>scriptEncoding</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>additionalEngineLoaders</name>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>resourcePaths</name>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>defaultFilteredTypes</name>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>defaultFilteredMarkups</name>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>mainScript</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>scriptPaths</name>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>descriptorPaths</name>
+ <type>String</type>
+ <multiValued>true</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>useBasics</name>
+ <type>String</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ <configurationParameter>
+ <name>removeBasics</name>
+ <type>Boolean</type>
+ <multiValued>false</multiValued>
+ <mandatory>false</mandatory>
+ </configurationParameter>
+ </configurationParameters>
+ <configurationParameterSettings>
+ <nameValuePair>
+ <name>debug</name>
+ <value>
+ <boolean>false</boolean>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>profile</name>
+ <value>
+ <boolean>false</boolean>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>debugWithMatches</name>
+ <value>
+ <boolean>true</boolean>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>defaultFilteredTypes</name>
+ <value>
+ <array>
+ <string>org.apache.uima.tm.type.SPACE</string>
+ <string>org.apache.uima.tm.type.NBSP</string>
+ <string>org.apache.uima.tm.type.BREAK</string>
+ <string>org.apache.uima.tm.type.MARKUP</string>
+ </array>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>removeBasics</name>
+ <value>
+ <boolean>false</boolean>
+ </value>
+ </nameValuePair>
+ <nameValuePair>
+ <name>seeders</name>
+ <value>
+ <array>
+ <string>org.apache.uima.tm.textmarker.seed.DefaultSeeder</string>
+ </array>
+ </value>
+ </nameValuePair>
+ </configurationParameterSettings>
+ <typeSystemDescription>
+ <imports>
+ <import location="BasicTypeSystem.xml"/>
+ </imports>
+ </typeSystemDescription>
+ <typePriorities>
+ <priorityList>
+ <type>org.apache.uima.tm.textmarker.kernel.type.TextMarkerFrame</type>
+ <type>uima.tcas.Annotation</type>
+ <type>org.apache.uima.tm.textmarker.kernel.type.TextMarkerBasic</type>
+ </priorityList>
+ </typePriorities>
+ <fsIndexCollection/>
+ <capabilities>
+ <capability>
+ <inputs/>
+ <outputs/>
+ <languagesSupported/>
+ </capability>
+ </capabilities>
+ <operationalProperties>
+ <modifiesCas>true</modifiesCas>
+ <multipleDeploymentAllowed>true</multipleDeploymentAllowed>
+ <outputsNewCASes>true</outputsNewCASes>
+ </operationalProperties>
+ </analysisEngineMetaData>
+ <resourceManagerConfiguration/>
+</analysisEngineDescription>
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/BasicEngine.xml
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/BasicEngine.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/BasicTypeSystem.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/BasicTypeSystem.xml?rev=1152829&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/BasicTypeSystem.xml (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/BasicTypeSystem.xml Mon Aug 1 15:30:34 2011
@@ -0,0 +1,132 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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.tm.type.ALL</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.type.BasicAnnotation</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.ANY</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.type.ALL</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.MARKUP</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.type.ALL</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.CW</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.type.W</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.W</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.type.ANY</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.SW</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.type.W</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.PM</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.type.ANY</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.CAP</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.type.W</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.COLON</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.type.PM</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.PERIOD</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.type.SENTENCEEND</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.SENTENCEEND</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.type.PM</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.QUESTION</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.type.SENTENCEEND</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.COMMA</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.type.PM</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.EXCLAMATION</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.type.SENTENCEEND</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.SEMICOLON</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.type.PM</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.WS</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.type.ANY</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.NUM</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.type.ANY</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.SPECIAL</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.type.ANY</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.NBSP</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.type.ANY</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.AMP</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.type.ANY</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.SPACE</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.type.WS</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.BREAK</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.type.WS</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.Document</name>
+ <description/>
+ <supertypeName>uima.tcas.DocumentAnnotation</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.type.BasicAnnotation</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.textmarker.kernel.type.TextMarkerBasic</supertypeName>
+ </typeDescription>
+ </types>
+</typeSystemDescription>
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/BasicTypeSystem.xml
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/BasicTypeSystem.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/ExportActionHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/ExportActionHandler.java?rev=1152829&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/ExportActionHandler.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/ExportActionHandler.java Mon Aug 1 15:30:34 2011
@@ -0,0 +1,40 @@
+package org.apache.uima.tm.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/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/ExportActionHandler.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/ExportActionHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/InternalTypeSystem.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/InternalTypeSystem.xml?rev=1152829&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/InternalTypeSystem.xml (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/InternalTypeSystem.xml Mon Aug 1 15:30:34 2011
@@ -0,0 +1,277 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<typeSystemDescription xmlns="http://uima.apache.org/resourceSpecifier">
+ <name>InternalTypeSystem</name>
+ <description/>
+ <version>1.0</version>
+ <vendor/>
+ <types>
+ <typeDescription>
+ <name>org.apache.uima.tm.textmarker.kernel.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.tm.textmarker.kernel.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.tm.textmarker.kernel.type.DebugRuleApply</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.textmarker.kernel.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.tm.textmarker.kernel.type.DebugRuleMatch</elementType>
+ </featureDescription>
+ </features>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.textmarker.kernel.type.DebugRuleMatch</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.textmarker.kernel.type.ProfiledAnnotation</supertypeName>
+ <features>
+ <featureDescription>
+ <name>elements</name>
+ <description/>
+ <rangeTypeName>uima.cas.FSArray</rangeTypeName>
+ <elementType>org.apache.uima.tm.textmarker.kernel.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.tm.textmarker.kernel.type.DebugScriptApply</elementType>
+ </featureDescription>
+ </features>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.textmarker.kernel.type.DebugScriptApply</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.textmarker.kernel.type.ProfiledAnnotation</supertypeName>
+ <features>
+ <featureDescription>
+ <name>element</name>
+ <description/>
+ <rangeTypeName>uima.cas.String</rangeTypeName>
+ </featureDescription>
+ </features>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.textmarker.kernel.type.DebugBlockApply</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.textmarker.kernel.type.DebugRuleApply</supertypeName>
+ <features>
+ <featureDescription>
+ <name>innerApply</name>
+ <description/>
+ <rangeTypeName>uima.cas.FSArray</rangeTypeName>
+ <elementType>org.apache.uima.tm.textmarker.kernel.type.DebugScriptApply</elementType>
+ </featureDescription>
+ </features>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.textmarker.kernel.type.DebugRuleElementMatch</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.textmarker.kernel.type.ProfiledAnnotation</supertypeName>
+ <features>
+ <featureDescription>
+ <name>baseCondition</name>
+ <description/>
+ <rangeTypeName>org.apache.uima.tm.textmarker.kernel.type.DebugEvaluatedCondition</rangeTypeName>
+ </featureDescription>
+ <featureDescription>
+ <name>conditions</name>
+ <description/>
+ <rangeTypeName>uima.cas.FSArray</rangeTypeName>
+ <elementType>org.apache.uima.tm.textmarker.kernel.type.DebugEvaluatedCondition</elementType>
+ </featureDescription>
+ </features>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.textmarker.kernel.type.DebugRuleElementMatches</name>
+ <description/>
+ <supertypeName>uima.cas.TOP</supertypeName>
+ <features>
+ <featureDescription>
+ <name>matches</name>
+ <description/>
+ <rangeTypeName>uima.cas.FSArray</rangeTypeName>
+ <elementType>org.apache.uima.tm.textmarker.kernel.type.DebugRuleElementMatch</elementType>
+ </featureDescription>
+ <featureDescription>
+ <name>element</name>
+ <description/>
+ <rangeTypeName>uima.cas.String</rangeTypeName>
+ </featureDescription>
+ </features>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.textmarker.kernel.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.tm.textmarker.kernel.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.tm.textmarker.kernel.type.DebugEvaluatedCondition</elementType>
+ </featureDescription>
+ </features>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.textmarker.kernel.type.DebugMatchedRuleMatch</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.textmarker.kernel.type.DebugRuleMatch</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.textmarker.kernel.type.DebugFailedRuleMatch</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.textmarker.kernel.type.DebugRuleMatch</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.textmarker.kernel.type.FalsePositive</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.textmarker.kernel.type.EvalAnnotation</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.textmarker.kernel.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.tm.textmarker.kernel.type.FalseNegative</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.textmarker.kernel.type.EvalAnnotation</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.textmarker.kernel.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.tm.textmarker.kernel.type.TextMarkerFrame</name>
+ <description/>
+ <supertypeName>uima.tcas.Annotation</supertypeName>
+ </typeDescription>
+ <typeDescription>
+ <name>org.apache.uima.tm.textmarker.kernel.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.tm.textmarker.kernel.type.TruePositive</name>
+ <description/>
+ <supertypeName>org.apache.uima.tm.textmarker.kernel.type.EvalAnnotation</supertypeName>
+ </typeDescription>
+ </types>
+</typeSystemDescription>
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/InternalTypeSystem.xml
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/InternalTypeSystem.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/QueryActionHandler.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/QueryActionHandler.java?rev=1152829&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/QueryActionHandler.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/QueryActionHandler.java Mon Aug 1 15:30:34 2011
@@ -0,0 +1,341 @@
+package org.apache.uima.tm.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.tm.dltk.internal.core.builder.TextMarkerProjectUtils;
+import org.apache.uima.tm.textmarker.engine.TextMarkerEngine;
+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.tm.textmarker.kernel.type.DebugMatchedRuleMatch");
+ Type ruleApplyType = cas.getTypeSystem().getType(
+ "org.apache.uima.tm.textmarker.kernel.type.DebugRuleApply");
+ Type blockApplyType = cas.getTypeSystem().getType(
+ "org.apache.uima.tm.textmarker.kernel.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/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/QueryActionHandler.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/QueryActionHandler.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/QueryComposite.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/QueryComposite.java?rev=1152829&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/QueryComposite.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/QueryComposite.java Mon Aug 1 15:30:34 2011
@@ -0,0 +1,473 @@
+package org.apache.uima.tm.textmarker.query.ui;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.apache.uima.tm.dltk.core.TextMarkerLanguageToolkit;
+import org.apache.uima.tm.textmarker.query.QueryPlugin;
+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) {
+ e.printStackTrace();
+ }
+
+ 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.tm.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 = QueryPlugin.getImageDescriptor("/icons/folder_edit.png");
+ image = desc.createImage();
+ name = "prepFolder";
+ images.put(name, image);
+
+ desc = QueryPlugin.getImageDescriptor("/icons/folder.png");
+ image = desc.createImage();
+ name = "folder";
+ images.put(name, image);
+
+ desc = QueryPlugin.getImageDescriptor("/icons/start.png");
+ image = desc.createImage();
+ name = "start";
+ images.put(name, image);
+
+ desc = QueryPlugin.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/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/QueryComposite.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.textmarker.query/src/main/java/org/apache/uima/tm/textmarker/query/ui/QueryComposite.java
------------------------------------------------------------------------------
svn:mime-type = text/plain