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 15:54:22 UTC
svn commit: r1152774 [2/6] - in /uima/sandbox/trunk/TextMarker:
org.apache.uima.tm.cev.feature/ org.apache.uima.tm.cev.html.feature/
org.apache.uima.tm.cev.html/ org.apache.uima.tm.cev.html/META-INF/
org.apache.uima.tm.cev.html/bin/ org.apache.uima.tm....
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/META-INF/MANIFEST.MF?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/META-INF/MANIFEST.MF (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/META-INF/MANIFEST.MF Mon Aug 1 13:53:56 2011
@@ -0,0 +1,93 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: CEV Plugin
+Bundle-SymbolicName: org.apache.uima.tm.cev;singleton:=true
+Bundle-Version: 1.1.2.qualifier
+Bundle-Activator: org.apache.uima.tm.cev.CEVPlugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.jface.text,
+ org.eclipse.core.resources,
+ org.eclipse.ui.editors,
+ org.eclipse.ui.ide,
+ org.eclipse.ui.views,
+ org.eclipse.ui.browser,
+ org.apache.uima.runtime;bundle-version="2.3.0"
+Bundle-ActivationPolicy: lazy
+Bundle-ClassPath: .,
+ lib/htmlparser.jar
+Export-Package: org.apache.uima.tm.cev;uses:="org.eclipse.jface.resource,org.eclipse.ui.plugin,org.osgi.framework",
+ org.apache.uima.tm.cev.artifactViewer,
+ org.apache.uima.tm.cev.data;
+ uses:="de.uniwue.tm.cev.data.treerepresentation,
+ org.mozilla.interfaces,
+ org.apache.uima.tools.stylemap,
+ org.apache.uima.cas,
+ org.apache.uima.cas.text,
+ org.eclipse.swt.browser,
+ org.eclipse.core.resources,
+ org.eclipse.swt.graphics,
+ org.eclipse.jface.viewers",
+ org.apache.uima.tm.cev.data.tree;uses:="org.apache.uima.cas,org.apache.uima.cas.text",
+ org.apache.uima.tm.cev.dialog;uses:="org.eclipse.jface.viewers",
+ org.apache.uima.tm.cev.editor;
+ uses:="org.eclipse.ui.texteditor,
+ org.eclipse.core.runtime,
+ org.mozilla.interfaces,
+ org.eclipse.ui,
+ org.eclipse.swt.events,
+ org.apache.uima.cas,
+ org.apache.uima.cas.text,
+ org.eclipse.ui.part,
+ de.uniwue.tm.cev.data,
+ org.eclipse.jface.action,
+ org.eclipse.core.resources",
+ org.apache.uima.tm.cev.extension;uses:="de.uniwue.tm.cev.editor,de.uniwue.tm.cev.data",
+ org.apache.uima.tm.cev.preferences;
+ uses:="org.eclipse.jface.preference,
+ org.eclipse.ui,
+ org.eclipse.core.runtime.preferences,
+ org.eclipse.swt.widgets",
+ org.apache.uima.tm.cev.searchStrategy,
+ org.apache.uima.tm.cev.views,
+ org.apache.uima.tm.cev.views.annotationBrowser;
+ uses:="org.eclipse.core.runtime,
+ org.eclipse.ui,
+ de.uniwue.tm.cev.editor,
+ org.apache.uima.cas.text,
+ de.uniwue.tm.cev.views,
+ org.eclipse.ui.part,
+ org.eclipse.swt.widgets,
+ de.uniwue.tm.cev.data",
+ org.apache.uima.tm.cev.views.editor;
+ uses:="org.eclipse.core.runtime,
+ org.eclipse.ui,
+ de.uniwue.tm.cev.extension,
+ org.eclipse.swt.events,
+ de.uniwue.tm.cev.editor,
+ de.uniwue.tm.cev.views,
+ org.apache.uima.cas,
+ org.apache.uima.cas.text,
+ org.eclipse.ui.part,
+ org.eclipse.swt.widgets,
+ de.uniwue.tm.cev.data",
+ org.apache.uima.tm.cev.views.fsBrowser,
+ org.apache.uima.tm.cev.views.palette;
+ uses:="org.eclipse.ui,
+ de.uniwue.tm.cev.extension,
+ de.uniwue.tm.cev.editor,
+ de.uniwue.tm.cev.views,
+ org.apache.uima.cas.text,
+ org.apache.uima.cas,
+ org.eclipse.ui.part,
+ org.eclipse.swt.widgets,
+ de.uniwue.tm.cev.data",
+ org.apache.uima.tm.cev.views.selection;
+ uses:="org.eclipse.ui,
+ de.uniwue.tm.cev.editor,
+ org.apache.uima.cas.text,
+ de.uniwue.tm.cev.views,
+ org.eclipse.ui.part,
+ de.uniwue.tm.cev.data"
+Bundle-Vendor: University of Würzburg
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/META-INF/MANIFEST.MF
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/META-INF/MANIFEST.MF
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/build.properties
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/build.properties?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/build.properties (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/build.properties Mon Aug 1 13:53:56 2011
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/,\
+ lib/htmlparser.jar
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/build.properties
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/build.properties
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/icons/cevViewer.png
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/icons/cevViewer.png?rev=1152774&view=auto
==============================================================================
Binary file - no diff available.
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/icons/cevViewer.png
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/icons/cevViewer.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/icons/edit.png
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/icons/edit.png?rev=1152774&view=auto
==============================================================================
Binary file - no diff available.
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/icons/edit.png
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/icons/edit.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/icons/hierarchicalLayout.gif
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/icons/hierarchicalLayout.gif?rev=1152774&view=auto
==============================================================================
Binary file - no diff available.
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/icons/hierarchicalLayout.gif
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/icons/hierarchicalLayout.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/icons/views.png
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/icons/views.png?rev=1152774&view=auto
==============================================================================
Binary file - no diff available.
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/icons/views.png
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/icons/views.png
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/lib/htmlparser.jar
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/lib/htmlparser.jar?rev=1152774&view=auto
==============================================================================
Binary file - no diff available.
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/lib/htmlparser.jar
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/lib/htmlparser.jar
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/licence.txt
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/licence.txt?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/licence.txt (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/licence.txt Mon Aug 1 13:53:56 2011
@@ -0,0 +1,165 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+
+ This version of the GNU Lesser General Public License incorporates
+the terms and conditions of version 3 of the GNU General Public
+License, supplemented by the additional permissions listed below.
+
+ 0. Additional Definitions.
+
+ As used herein, "this License" refers to version 3 of the GNU Lesser
+General Public License, and the "GNU GPL" refers to version 3 of the GNU
+General Public License.
+
+ "The Library" refers to a covered work governed by this License,
+other than an Application or a Combined Work as defined below.
+
+ An "Application" is any work that makes use of an interface provided
+by the Library, but which is not otherwise based on the Library.
+Defining a subclass of a class defined by the Library is deemed a mode
+of using an interface provided by the Library.
+
+ A "Combined Work" is a work produced by combining or linking an
+Application with the Library. The particular version of the Library
+with which the Combined Work was made is also called the "Linked
+Version".
+
+ The "Minimal Corresponding Source" for a Combined Work means the
+Corresponding Source for the Combined Work, excluding any source code
+for portions of the Combined Work that, considered in isolation, are
+based on the Application, and not on the Linked Version.
+
+ The "Corresponding Application Code" for a Combined Work means the
+object code and/or source code for the Application, including any data
+and utility programs needed for reproducing the Combined Work from the
+Application, but excluding the System Libraries of the Combined Work.
+
+ 1. Exception to Section 3 of the GNU GPL.
+
+ You may convey a covered work under sections 3 and 4 of this License
+without being bound by section 3 of the GNU GPL.
+
+ 2. Conveying Modified Versions.
+
+ If you modify a copy of the Library, and, in your modifications, a
+facility refers to a function or data to be supplied by an Application
+that uses the facility (other than as an argument passed when the
+facility is invoked), then you may convey a copy of the modified
+version:
+
+ a) under this License, provided that you make a good faith effort to
+ ensure that, in the event an Application does not supply the
+ function or data, the facility still operates, and performs
+ whatever part of its purpose remains meaningful, or
+
+ b) under the GNU GPL, with none of the additional permissions of
+ this License applicable to that copy.
+
+ 3. Object Code Incorporating Material from Library Header Files.
+
+ The object code form of an Application may incorporate material from
+a header file that is part of the Library. You may convey such object
+code under terms of your choice, provided that, if the incorporated
+material is not limited to numerical parameters, data structure
+layouts and accessors, or small macros, inline functions and templates
+(ten or fewer lines in length), you do both of the following:
+
+ a) Give prominent notice with each copy of the object code that the
+ Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the object code with a copy of the GNU GPL and this license
+ document.
+
+ 4. Combined Works.
+
+ You may convey a Combined Work under terms of your choice that,
+taken together, effectively do not restrict modification of the
+portions of the Library contained in the Combined Work and reverse
+engineering for debugging such modifications, if you also do each of
+the following:
+
+ a) Give prominent notice with each copy of the Combined Work that
+ the Library is used in it and that the Library and its use are
+ covered by this License.
+
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
+ document.
+
+ c) For a Combined Work that displays copyright notices during
+ execution, include the copyright notice for the Library among
+ these notices, as well as a reference directing the user to the
+ copies of the GNU GPL and this license document.
+
+ d) Do one of the following:
+
+ 0) Convey the Minimal Corresponding Source under the terms of this
+ License, and the Corresponding Application Code in a form
+ suitable for, and under terms that permit, the user to
+ recombine or relink the Application with a modified version of
+ the Linked Version to produce a modified Combined Work, in the
+ manner specified by section 6 of the GNU GPL for conveying
+ Corresponding Source.
+
+ 1) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (a) uses at run time
+ a copy of the Library already present on the user's computer
+ system, and (b) will operate properly with a modified version
+ of the Library that is interface-compatible with the Linked
+ Version.
+
+ e) Provide Installation Information, but only if you would otherwise
+ be required to provide such information under section 6 of the
+ GNU GPL, and only to the extent that such information is
+ necessary to install and execute a modified version of the
+ Combined Work produced by recombining or relinking the
+ Application with a modified version of the Linked Version. (If
+ you use option 4d0, the Installation Information must accompany
+ the Minimal Corresponding Source and Corresponding Application
+ Code. If you use option 4d1, you must provide the Installation
+ Information in the manner specified by section 6 of the GNU GPL
+ for conveying Corresponding Source.)
+
+ 5. Combined Libraries.
+
+ You may place library facilities that are a work based on the
+Library side by side in a single library together with other library
+facilities that are not Applications and are not covered by this
+License, and convey such a combined library under terms of your
+choice, if you do both of the following:
+
+ a) Accompany the combined library with a copy of the same work based
+ on the Library, uncombined with any other library facilities,
+ conveyed under the terms of this License.
+
+ b) Give prominent notice with the combined library that part of it
+ is a work based on the Library, and explaining where to find the
+ accompanying uncombined form of the same work.
+
+ 6. Revised Versions of the GNU Lesser General Public License.
+
+ The Free Software Foundation may publish revised and/or new versions
+of the GNU Lesser General Public License from time to time. Such new
+versions will be similar in spirit to the present version, but may
+differ in detail to address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Library as you received it specifies that a certain numbered version
+of the GNU Lesser General Public License "or any later version"
+applies to it, you have the option of following the terms and
+conditions either of that published version or of any later version
+published by the Free Software Foundation. If the Library as you
+received it does not specify a version number of the GNU Lesser
+General Public License, you may choose any version of the GNU Lesser
+General Public License ever published by the Free Software Foundation.
+
+ If the Library as you received it specifies that a proxy can decide
+whether future versions of the GNU Lesser General Public License shall
+apply, that proxy's public statement of acceptance of any version is
+permanent authorization for you to choose that version for the
+Library.
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/licence.txt
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/licence.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/plugin.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/plugin.xml?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/plugin.xml (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/plugin.xml Mon Aug 1 13:53:56 2011
@@ -0,0 +1,145 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="cevEditors" name="CEV Annotation Editors" schema="schema/cevEditors.exsd"/>
+ <extension-point id="cevViews" name="CEV Annotation Views" schema="schema/cevViews.exsd"/>
+ <extension-point id="cevSearchStrategies" name="Descriptor Search Strategies" schema="schema/cevSearchStrategies.exsd"/>
+ <extension-point id="cevArtifactViewers" name="Viewers of the artifact" schema="schema/cevArtifactViewers.exsd"/>
+
+ <extension
+ point="org.eclipse.ui.editors">
+ <editor
+ name="CEV"
+ extensions="xmi"
+ icon="icons/cevViewer.png"
+ contributorClass="org.apache.uima.tm.cev.editor.CEVViewerContributor"
+ class="org.apache.uima.tm.cev.editor.CEVViewer"
+ id="de.uniwue.tm.cev.editor.CEVViewer">
+ </editor>
+ </extension>
+ <extension
+ point="org.eclipse.ui.views">
+ <category
+ id="de.uniwue.tm.cev.views"
+ name="CEV">
+ </category>
+ <view
+ category="de.uniwue.tm.cev.views"
+ class="org.apache.uima.tm.cev.views.selection.CEVSelectionView"
+ icon="icons/views.png"
+ id="de.uniwue.tm.cev.views.selection"
+ name="Selection">
+ </view>
+ <view
+ category="de.uniwue.tm.cev.views"
+ class="org.apache.uima.tm.cev.views.annotationBrowser.CEVAnnotationBrowserView"
+ icon="icons/views.png"
+ id="de.uniwue.tm.cev.views.annotationBrowser"
+ name="Annotation Browser">
+ </view>
+ <view
+ category="de.uniwue.tm.cev.views"
+ class="org.apache.uima.tm.cev.views.editor.CEVAnnotationEditorView"
+ icon="icons/edit.png"
+ id="de.uniwue.tm.cev.views.editor"
+ name="Annotation Editor">
+ </view>
+ <view
+ category="de.uniwue.tm.cev.views"
+ class="org.apache.uima.tm.cev.views.palette.CEVAnnotationMarkerPaletteView"
+ icon="icons/edit.png"
+ id="de.uniwue.tm.cev.views.palette"
+ name="Marker Palette">
+ </view>
+ <view
+ category="de.uniwue.tm.cev.views"
+ class="org.apache.uima.tm.cev.views.fsBrowser.CEVFSBrowserView"
+ icon="icons/views.png"
+ id="de.uniwue.tm.cev.views.fsBrowser"
+ name="FS only Browser">
+ </view>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.apache.uima.tm.cev.preferences.CEVPreferenceInitializer">
+ </initializer>
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ class="org.apache.uima.tm.cev.preferences.CEVViewerTreeViewPreferencePage"
+ id="de.uniwue.tm.cev.preferences.CEVViewerTreeViewPreferencePage"
+ name="CEV">
+ </page>
+ <page
+ category="de.uniwue.tm.cev.preferences.CEVViewerTreeViewPreferencePage"
+ class="org.apache.uima.tm.cev.preferences.CEVViewerAnnotationFilterPreferencePage"
+ id="de.uniwue.tm.cev.preferences.CEVViewerAnnotationFilterPreferencePage"
+ name="Annotation Filter">
+ </page>
+ </extension>
+ <extension
+ point="de.uniwue.tm.cev.cevEditors">
+ <editor
+ factory="de.uniwue.tm.cev.views.editor.CEVAnnotationEditorFactory"
+ id="de.uniwue.tm.textmarker.cev.extension.editor"
+ priority="0"
+ viewId="de.uniwue.tm.cev.views.editor">
+ </editor>
+ <editor
+ factory="de.uniwue.tm.cev.views.palette.CEVAnnotationMarkerPaletteFactory"
+ id="de.uniwue.tm.textmarker.cev.extension.palette"
+ priority="0"
+ viewId="de.uniwue.tm.cev.views.palette">
+ </editor>
+ </extension>
+ <extension
+ point="de.uniwue.tm.cev.cevViews">
+ <view
+ factory="de.uniwue.tm.cev.views.annotationBrowser.CEVAnnotationBrowserViewFactory"
+ id="de.uniwue.tm.textmarker.cev.extension.annotationBrowser"
+ priority="0"
+ viewId="de.uniwue.tm.cev.views.annotationBrowser">
+ </view>
+ <view
+ factory="de.uniwue.tm.cev.views.selection.CEVSelectionViewFactory"
+ id="de.uniwue.tm.textmarker.cev.extension.selection"
+ priority="0"
+ viewId="de.uniwue.tm.cev.views.selection">
+ </view>
+ <view
+ factory="de.uniwue.tm.cev.views.fsBrowser.CEVFSBrowserViewFactory"
+ id="de.uniwue.tm.textmarker.cev.extension.fsBrowser"
+ priority="0"
+ viewId="de.uniwue.tm.cev.views.fsBrowser">
+ </view>
+ </extension>
+ <extension
+ point="de.uniwue.tm.cev.cevSearchStrategies">
+ <strategy
+ factory="de.uniwue.tm.cev.searchStrategy.SingleInFolderStrategyFactory"
+ id="de.uniwue.tm.cev.searchStrategy.SingleInFolder"
+ priority="10">
+ </strategy>
+ <strategy
+ factory="de.uniwue.tm.cev.searchStrategy.SelectInFolderStrategyFactory"
+ id="de.uniwue.tm.cev.searchStrategy.SelectInFolder"
+ priority="50">
+ </strategy>
+ <strategy
+ factory="de.uniwue.tm.cev.searchStrategy.AllXmlInProjectStrategyFactory"
+ id="de.uniwue.tm.cev.searchStrategy.AllXmlInProject"
+ priority="5000">
+ </strategy>
+ </extension>
+ <extension
+ point="de.uniwue.tm.cev.cevArtifactViewers">
+ <artifactViewer
+ factory="de.uniwue.tm.cev.artifactViewer.TextArtifactViewerFactory"
+ id="de.uniwue.tm.cev.artifactViewer.text"
+ priority="5">
+ </artifactViewer>
+ </extension>
+
+</plugin>
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/plugin.xml
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/plugin.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevArtifactViewers.exsd
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevArtifactViewers.exsd?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevArtifactViewers.exsd (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevArtifactViewers.exsd Mon Aug 1 13:53:56 2011
@@ -0,0 +1,116 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.apache.uima.tm.cev" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.apache.uima.tm.cev" id="cevArtifactViewers" name="cevArtifactViewers"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="artifactViewer"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="artifactViewer">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="factory" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":CEVArtifactViewerFactory"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="priority" type="string" use="default" value="100">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevArtifactViewers.exsd
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevArtifactViewers.exsd
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevEditors.exsd
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevEditors.exsd?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevEditors.exsd (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevEditors.exsd Mon Aug 1 13:53:56 2011
@@ -0,0 +1,126 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.apache.uima.tm.cev" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.apache.uima.tm.cev" id="cevEditor" name="CEV Annotation Editor"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="editor"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="editor">
+ <complexType>
+ <attribute name="viewId" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.ui.views/view/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="priority" type="string" use="default" value="0">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="factory" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.apache.uima.tm.cev.extension.ICEVEditorFactory"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevEditors.exsd
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevEditors.exsd
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevSearchStrategies.exsd
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevSearchStrategies.exsd?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevSearchStrategies.exsd (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevSearchStrategies.exsd Mon Aug 1 13:53:56 2011
@@ -0,0 +1,116 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.apache.uima.tm.cev" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.apache.uima.tm.cev" id="descriptorSearchStrategy" name="Descriptor Search Strategy"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="strategy"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="strategy">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="factory" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn=":org.apache.uima.tm.cev.extension.ICEVSearchStrategyFactory"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="priority" type="string" use="default" value="0">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevSearchStrategies.exsd
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevSearchStrategies.exsd
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevViews.exsd
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevViews.exsd?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevViews.exsd (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevViews.exsd Mon Aug 1 13:53:56 2011
@@ -0,0 +1,126 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.apache.uima.tm.cev" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.apache.uima.tm.cev" id="cevView" name="CEV Annotation View"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="1" maxOccurs="unbounded">
+ <element ref="view"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="view">
+ <complexType>
+ <attribute name="viewId" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.ui.views/view/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="priority" type="string" use="default" value="0">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="factory" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.apache.uima.tm.cev.extension.ICEVViewFactory"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevViews.exsd
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/schema/cevViews.exsd
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/CEVPlugin.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/CEVPlugin.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/CEVPlugin.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/CEVPlugin.java Mon Aug 1 13:53:56 2011
@@ -0,0 +1,246 @@
+package org.apache.uima.tm.cev;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.uima.tm.cev.artifactViewer.ArtifactViewerComparator;
+import org.apache.uima.tm.cev.extension.ICEVArtifactViewerFactory;
+import org.apache.uima.tm.cev.extension.ICEVEditorFactory;
+import org.apache.uima.tm.cev.extension.ICEVSearchStrategy;
+import org.apache.uima.tm.cev.extension.ICEVSearchStrategyFactory;
+import org.apache.uima.tm.cev.extension.ICEVViewFactory;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbenchSite;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
+import org.osgi.framework.BundleContext;
+
+
+/**
+ * Aktivatorklasse fuer den Plug-in life cycle
+ *
+ * @author Marco Nehmeier
+ */
+public class CEVPlugin extends AbstractUIPlugin {
+
+ // Plug-in ID
+ public static final String PLUGIN_ID = "org.apache.uima.tm.cev";
+
+ private static final String ATT_PRIORITY = "priority";
+
+ public static final String ATT_ADAPTER = "adapter";
+
+ public static final String ATT_FACTORY = "factory";
+
+ // Shared instance
+ private static CEVPlugin plugin;
+
+ /**
+ * Konstruktor
+ */
+ public CEVPlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ 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)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Gibt die Shared instance zurueck
+ *
+ * @return Shared instance
+ */
+ public static CEVPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Gibt einen Image Descriptor fuer ein Image im Plug-in bezeuglichen Pfad zurueck
+ *
+ * @param path
+ * Pfad
+ * @return Image Descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+ public static Map<Class<?>, ICEVEditorFactory> getEditorAdapters() {
+ Map<Class<?>, ICEVEditorFactory> result = new HashMap<Class<?>, ICEVEditorFactory>();
+ IExtension[] editorExtensions = Platform.getExtensionRegistry().getExtensionPoint(
+ CEVPlugin.PLUGIN_ID, "cevEditors").getExtensions();
+ for (IExtension extension : editorExtensions) {
+ IConfigurationElement[] configurationElements = extension.getConfigurationElements();
+ for (IConfigurationElement configurationElement : configurationElements) {
+ Object factoryObject = null;
+ try {
+ factoryObject = configurationElement.createExecutableExtension(ATT_FACTORY);
+ } catch (CoreException e) {
+ CEVPlugin.error(e);
+ }
+ if (factoryObject instanceof ICEVEditorFactory) {
+ ICEVEditorFactory editorFactory = (ICEVEditorFactory) factoryObject;
+ result.put(editorFactory.getAdapterInterface(), editorFactory);
+ }
+ }
+ }
+ return result;
+ }
+
+ public static Map<Class<?>, ICEVViewFactory> getViewAdapters() {
+ Map<Class<?>, ICEVViewFactory> result = new HashMap<Class<?>, ICEVViewFactory>();
+ IExtension[] viewExtensions = Platform.getExtensionRegistry().getExtensionPoint(
+ CEVPlugin.PLUGIN_ID, "cevViews").getExtensions();
+ for (IExtension extension : viewExtensions) {
+ IConfigurationElement[] configurationElements = extension.getConfigurationElements();
+ for (IConfigurationElement configurationElement : configurationElements) {
+ Object factoryObject = null;
+ try {
+ factoryObject = configurationElement.createExecutableExtension(ATT_FACTORY);
+ } catch (CoreException e) {
+ CEVPlugin.error(e);
+ }
+ if (factoryObject instanceof ICEVViewFactory) {
+ ICEVViewFactory viewFactory = (ICEVViewFactory) factoryObject;
+ result.put(viewFactory.getAdapterInterface(), viewFactory);
+ }
+ }
+ }
+ return result;
+ }
+
+ public static List<ICEVArtifactViewerFactory> getArtifactViewerFactories() {
+ List<ICEVArtifactViewerFactory> result = new ArrayList<ICEVArtifactViewerFactory>();
+ IExtension[] viewerExtensions = Platform.getExtensionRegistry().getExtensionPoint(
+ CEVPlugin.PLUGIN_ID, "cevArtifactViewers").getExtensions();
+ for (IExtension extension : viewerExtensions) {
+ IConfigurationElement[] configurationElements = extension.getConfigurationElements();
+ for (IConfigurationElement configurationElement : configurationElements) {
+ Object factoryObject = null;
+ String priorityString = null;
+ try {
+ factoryObject = configurationElement.createExecutableExtension(ATT_FACTORY);
+ priorityString = configurationElement.getAttribute(ATT_PRIORITY);
+ } catch (CoreException e) {
+ CEVPlugin.error(e);
+ }
+ if (factoryObject instanceof ICEVArtifactViewerFactory) {
+ ICEVArtifactViewerFactory viewerFactory = (ICEVArtifactViewerFactory) factoryObject;
+ int priority = 100;
+ try {
+ priority = Integer.parseInt(priorityString);
+ } catch (NumberFormatException e) {
+ // bad string
+ }
+ viewerFactory.setPriority(priority);
+ result.add(viewerFactory);
+ }
+ }
+ }
+ Collections.sort(result, new ArtifactViewerComparator());
+ return result;
+ }
+
+ public static List<ICEVSearchStrategy> getSearchStrategies() {
+ List<ICEVSearchStrategy> result = new ArrayList<ICEVSearchStrategy>();
+ IExtension[] searchExtensions = Platform.getExtensionRegistry().getExtensionPoint(
+ CEVPlugin.PLUGIN_ID, "cevSearchStrategies").getExtensions();
+ for (IExtension extension : searchExtensions) {
+ IConfigurationElement[] configurationElements = extension.getConfigurationElements();
+ for (IConfigurationElement configurationElement : configurationElements) {
+ Object factoryObject = null;
+ String priorityString = null;
+ try {
+ factoryObject = configurationElement.createExecutableExtension(ATT_FACTORY);
+ priorityString = configurationElement.getAttribute(ATT_PRIORITY);
+ } catch (CoreException e) {
+ CEVPlugin.error(e);
+ }
+ if (factoryObject instanceof ICEVSearchStrategyFactory) {
+ ICEVSearchStrategyFactory searchFactory = (ICEVSearchStrategyFactory) factoryObject;
+ int priority = 100;
+ try {
+ priority = Integer.parseInt(priorityString);
+ } catch (NumberFormatException e) {
+ // bad string
+ }
+ ICEVSearchStrategy strategy = searchFactory.createSearchStrategy(priority);
+ result.add(strategy);
+ }
+ }
+ }
+ Collections.sort(result, new Comparator<ICEVSearchStrategy>() {
+
+ public int compare(ICEVSearchStrategy o1, ICEVSearchStrategy o2) {
+ if (o1.getPriority() < o2.getPriority()) {
+ return -1;
+ } else if (o1.getPriority() > o2.getPriority()) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ });
+ return result;
+ }
+
+ public static void error(Throwable t) {
+ plugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, t.getMessage(), t));
+ }
+
+ public static void schedule(Job job, IWorkbenchSite site) {
+ if (site != null) {
+ IWorkbenchSiteProgressService siteProgress = (IWorkbenchSiteProgressService) site
+ .getAdapter(IWorkbenchSiteProgressService.class);
+ if (siteProgress != null) {
+ siteProgress.schedule(job, 0, true /* use half-busy cursor */);
+ return;
+ }
+ }
+ job.schedule();
+ }
+
+ public static void runInUIThread(final Runnable runnable) {
+ if (Display.getCurrent() != null) {
+ BusyIndicator.showWhile(Display.getCurrent(), runnable);
+ } else {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ BusyIndicator.showWhile(Display.getCurrent(), runnable);
+ }
+ });
+ }
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/CEVPlugin.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/CEVPlugin.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/ArtifactModifier.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/ArtifactModifier.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/ArtifactModifier.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/ArtifactModifier.java Mon Aug 1 13:53:56 2011
@@ -0,0 +1,11 @@
+package org.apache.uima.tm.cev.artifactViewer;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.tm.cev.data.CEVDocument;
+
+
+public interface ArtifactModifier {
+
+ CAS modifyCas(CEVDocument casDoc, CAS newCas, int index);
+
+}
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/ArtifactModifier.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/ArtifactModifier.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/ArtifactViewerComparator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/ArtifactViewerComparator.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/ArtifactViewerComparator.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/ArtifactViewerComparator.java Mon Aug 1 13:53:56 2011
@@ -0,0 +1,20 @@
+package org.apache.uima.tm.cev.artifactViewer;
+
+import java.util.Comparator;
+
+import org.apache.uima.tm.cev.extension.ICEVArtifactViewerFactory;
+
+
+public class ArtifactViewerComparator implements Comparator<ICEVArtifactViewerFactory> {
+
+ public int compare(ICEVArtifactViewerFactory o1, ICEVArtifactViewerFactory o2) {
+ if (o1.getPriority() < o2.getPriority()) {
+ return -1;
+ } else if (o1.getPriority() > o2.getPriority()) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/ArtifactViewerComparator.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/ArtifactViewerComparator.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/TextArtifactViewer.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/TextArtifactViewer.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/TextArtifactViewer.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/TextArtifactViewer.java Mon Aug 1 13:53:56 2011
@@ -0,0 +1,274 @@
+package org.apache.uima.tm.cev.artifactViewer;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.TypeSystem;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.tm.cev.data.CEVData;
+import org.apache.uima.tm.cev.data.CEVAnnotationRanges.StyleRangeContainer;
+import org.apache.uima.tm.cev.editor.CEVViewer;
+import org.apache.uima.tm.cev.extension.ICEVArtifactViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TreeItem;
+
+
+public class TextArtifactViewer extends StyledText implements ICEVArtifactViewer {
+
+ private class ToolTipListener implements Listener {
+
+ private Shell tip = null;
+
+ private Label label = null;
+
+ // private Browser browser = null;
+
+ private StyledText text;
+
+ private StyledText tipText;
+
+ /**
+ * Konstruktor
+ *
+ * @param tree
+ * zugrundeliegender Tree
+ */
+ private ToolTipListener(StyledText text) {
+ this.text = text;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets .Event)
+ */
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.Dispose:
+ case SWT.KeyDown:
+ // beim Verlassen Tip wieder freigeben
+ case SWT.MouseMove: {
+ if (tip == null)
+ break;
+ tip.dispose();
+ tip = null;
+ label = null;
+ // if (browser != null)
+ // browser.dispose();
+ // browser = null;
+ break;
+ }
+ // ToolTip anzeigen
+ case SWT.MouseHover: {
+ // TreeItem bestimmen
+ TreeItem item = null;
+ // text.getItem(new Point(event.x, event.y));
+
+ Point point = new Point(event.x, event.y);
+ int offsetAtLocation = -1;
+ try {
+ offsetAtLocation = text.getOffsetAtLocation(point);
+ } catch (Exception e) {
+ break;
+ }
+
+ List<AnnotationFS> annotationsToShow = new ArrayList<AnnotationFS>();
+ List<AnnotationFS> annotationsAt = casData.getAnnotationsAt(offsetAtLocation);
+ HashMap<Type, HashMap<AnnotationFS, Boolean>> annotationState = casData
+ .getAnnotationState();
+ for (AnnotationFS annotationFS : annotationsAt) {
+ Type type = annotationFS.getType();
+ HashMap<AnnotationFS, Boolean> hashMap = annotationState.get(type);
+ Boolean visible = hashMap.get(annotationFS);
+ if (visible) {
+ annotationsToShow.add(annotationFS);
+ }
+ }
+ TypeSystem typeSystem = casData.getCAS().getTypeSystem();
+ Type stringType = typeSystem.getType("uima.cas.String");
+ StringBuilder infoText = new StringBuilder();
+
+ List<StyleRange> styles = new ArrayList<StyleRange>();
+
+ int start = 0;
+ int end = 0;
+ for (AnnotationFS each : annotationsToShow) {
+ Type type = each.getType();
+ String coveredText = each.getCoveredText();
+ coveredText = shrink(coveredText);
+ start = infoText.length();
+ infoText.append(type.getShortName() + ": ");
+ end = infoText.length();
+ StyleRange style1 = new StyleRange();
+ style1.start = start;
+ style1.length = end - start;
+ style1.fontStyle = SWT.BOLD;
+ styles.add(style1);
+ infoText.append(coveredText + "\n");
+ List<Feature> features = type.getFeatures();
+ for (Feature feature : features) {
+ if (typeSystem.subsumes(stringType, feature.getRange())) {
+ String shortName = feature.getShortName();
+ String stringValue = each.getStringValue(feature);
+ start = infoText.length();
+ infoText.append("- " + shortName + ": ");
+ end = infoText.length();
+ StyleRange style2 = new StyleRange();
+ style2.start = start;
+ style2.length = end - start;
+ style2.fontStyle = SWT.BOLD;
+ styles.add(style2);
+ infoText.append(shrink(stringValue) + "\n");
+ }
+ }
+ infoText.append("\n");
+ }
+
+ if (tip != null && !tip.isDisposed())
+ tip.dispose();
+
+ if (!infoText.toString().equals("")) {
+ tip = new Shell(Display.getCurrent().getActiveShell(), SWT.BALLOON
+ | SWT.ICON_INFORMATION | SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
+ tip.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+ FillLayout layout = new FillLayout();
+ layout.marginWidth = 2;
+ tip.setLayout(layout);
+
+ // label = new Label(tip, SWT.NONE);
+ // label.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
+ // label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+ // label.setText(infoText.toString());
+
+ tipText = new StyledText(tip, SWT.NONE);
+ tipText.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
+ tipText.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+ tipText.setText(infoText.toString());
+
+ tipText.setStyleRanges(styles.toArray(new StyleRange[0]));
+ tipText.layout(true);
+ // try {
+ // browser = new Browser(tip, SWT.NONE);
+ // browser.setText(infoText.toString());
+ // // browser.setLayoutData(new GridData(200, 150));
+ //
+ // } catch (SWTError e) {
+ // System.out.println("Could not instantiate Browser: " + e.getMessage());
+ // }
+ // browser.setText(infoText.toString());
+
+ Point size = tip.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ Point pt = text.toDisplay(new Point(point.x + 20, point.y + 10));
+ tip.setBounds(pt.x, pt.y, size.x, size.y);
+ tip.setVisible(true);
+ }
+ // if (item != null && item.getData() instanceof CEVAnnotationTreeNode) {
+ // // Alten Tip freigeben
+ // if (tip != null && !tip.isDisposed())
+ // tip.dispose();
+ //
+ // // Tip erzeugen
+ // tip = new Shell(Display.getCurrent().getActiveShell(), SWT.ON_TOP | SWT.NO_FOCUS
+ // | SWT.TOOL);
+ //
+ // // Farben setzen
+ // tip.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+ // FillLayout layout = new FillLayout();
+ // layout.marginWidth = 2;
+ // tip.setLayout(layout);
+ //
+ // // Lable
+ // label = new Label(tip, SWT.NONE);
+ // label.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
+ // label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+ //
+ // AnnotationFS annot = ((CEVAnnotationTreeNode) item.getData()).getAnnotation();
+ //
+ // // Text setzten
+ // label.setText("Test");
+ //
+ // // Zeichnen
+ // Point size = tip.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+ // Rectangle rect = item.getBounds(0);
+ // Point pt = text.toDisplay(rect.x, rect.y);
+ // tip.setBounds(pt.x, pt.y, size.x, size.y);
+ // tip.setVisible(true);
+ // }
+ }
+ }
+ }
+
+ private String shrink(String coveredText) {
+ if (coveredText != null && coveredText.length() > 100) {
+ coveredText = coveredText.substring(0, 40) + "...";
+ }
+ return coveredText;
+ }
+ }
+
+ private CEVData casData;
+
+ private CEVViewer viewer;
+
+ public TextArtifactViewer(Composite composite, int style, CEVViewer viewer) {
+ super(composite, style);
+ this.viewer = viewer;
+ ToolTipListener tl = new ToolTipListener(this);
+ addListener(SWT.Dispose, tl);
+ addListener(SWT.KeyDown, tl);
+ addListener(SWT.MouseMove, tl);
+ addListener(SWT.MouseHover, tl);
+ }
+
+ public void annotationStateChanged(Type type) {
+ StyleRangeContainer sc = casData.getAllStyleRanges();
+ setStyleRanges(sc.getStart(), sc.getLength(), sc.getIndices(), sc.getRanges());
+ }
+
+ public void annotationStateChanged() {
+ StyleRangeContainer sc = casData.getAllStyleRanges();
+ int start = sc.getStart();
+ int length = sc.getLength();
+ int[] indices = sc.getIndices();
+ StyleRange[] ranges = sc.getRanges();
+ setStyleRanges(start, length, indices, ranges);
+ }
+
+ public Point getViewerSelectionRange() {
+ return getSelectionRange();
+ }
+
+ public void viewerWidgetSelected() {
+ StyleRangeContainer sc = casData.getAllStyleRanges();
+ setStyleRanges(sc.getStart(), sc.getLength(), sc.getIndices(), sc.getRanges());
+ }
+
+ public void moveToAnnotation(AnnotationFS annot) {
+ if (!annot.getCoveredText().equals("\n") && !annot.getCoveredText().equals("\r")) {
+ setSelection(annot.getBegin());
+ }
+ }
+
+ public void viewChanged(CEVData casData) {
+ this.casData = casData;
+ List<Type> initialVisibleTypes = viewer.getInitialVisibleTypes();
+ for (Type type : initialVisibleTypes) {
+ annotationStateChanged(type);
+ }
+
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/TextArtifactViewer.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/TextArtifactViewer.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/TextArtifactViewerFactory.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/TextArtifactViewerFactory.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/TextArtifactViewerFactory.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/TextArtifactViewerFactory.java Mon Aug 1 13:53:56 2011
@@ -0,0 +1,38 @@
+package org.apache.uima.tm.cev.artifactViewer;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.tm.cev.data.CEVData;
+import org.apache.uima.tm.cev.editor.CEVViewer;
+import org.apache.uima.tm.cev.extension.AbstractArtifactViewerFactory;
+import org.apache.uima.tm.cev.extension.ICEVArtifactViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+
+
+public class TextArtifactViewerFactory extends AbstractArtifactViewerFactory {
+
+ public ICEVArtifactViewer createArtifactViewer(CEVViewer viewer, CTabItem tabItem, CEVData casData) {
+ Composite composite = new Composite(tabItem.getParent(), SWT.NONE);
+ FillLayout layout = new FillLayout();
+ composite.setLayout(layout);
+ TextArtifactViewer text = new TextArtifactViewer(composite, SWT.READ_ONLY | SWT.WRAP
+ | SWT.H_SCROLL | SWT.V_SCROLL, viewer);
+ text.addMouseListener(viewer);
+
+ tabItem.setControl(composite);
+ tabItem.setText("Plain Text");
+
+ if (casData.getDocumentText() != null) {
+ text.setText(casData.getDocumentText());
+ }
+
+ return text;
+ }
+
+ public boolean isAble(CAS cas) {
+ return cas.getDocumentText() != null && !"".equals(cas.getDocumentText());
+ }
+
+}
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/TextArtifactViewerFactory.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/artifactViewer/TextArtifactViewerFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/CEVAnnotationRanges.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/CEVAnnotationRanges.java?rev=1152774&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/CEVAnnotationRanges.java (added)
+++ uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/CEVAnnotationRanges.java Mon Aug 1 13:53:56 2011
@@ -0,0 +1,654 @@
+package org.apache.uima.tm.cev.data;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.eclipse.swt.custom.StyleRange;
+
+/**
+ * Annotationsbereiche im Dokument
+ *
+ * @author Marco Nehmeier
+ *
+ */
+public class CEVAnnotationRanges {
+
+ /**
+ * Bereichsinfo
+ */
+ private class RangeInfo {
+ // Start
+ private int start;
+
+ // Ende
+ private int end;
+
+ // View
+ private CEVData casData;
+
+ // Annotation
+ private LinkedList<AnnotationFS> annotations;
+
+ // verwendete HTML-IDS
+ private LinkedList<String> htmlIDs;
+
+ /**
+ * Konstruktor
+ *
+ * @param start
+ * Start
+ * @param end
+ * Ende
+ * @param casData
+ * View
+ */
+ public RangeInfo(int start, int end, CEVData casData) {
+ this.start = start;
+ this.end = end;
+
+ this.casData = casData;
+
+ htmlIDs = new LinkedList<String>();
+
+ annotations = new LinkedList<AnnotationFS>();
+ }
+
+ /**
+ * Start
+ *
+ * @return Start
+ */
+ public int getStart() {
+ return start;
+ }
+
+ /**
+ * Ende
+ *
+ * @return Ende
+ */
+ public int getEnd() {
+ return end;
+ }
+
+ /**
+ * Fuegt eine ID ein
+ *
+ * @param id
+ * ID
+ */
+ public void addHtmlID(String id) {
+ htmlIDs.add(id);
+ }
+
+ /**
+ * Gibt die IDs zurueck
+ *
+ * @return Liste mit IDs
+ */
+ public LinkedList<String> getHtmlID() {
+ return htmlIDs;
+ }
+
+ /**
+ * Fuegt eine Annotation ein
+ *
+ * @param annot
+ * Annotation
+ */
+ public void addAnnotation(AnnotationFS annot) {
+ annotations.addFirst(annot);
+ }
+
+ public void removeAnnotation(AnnotationFS annot) {
+ annotations.remove(annot);
+ }
+
+ /**
+ * Gibt die Annotationen zurueck
+ *
+ * @return Annotationen
+ */
+ public AnnotationFS[] getAnnotations() {
+ return annotations.toArray(new AnnotationFS[annotations.size()]);
+ }
+
+ /**
+ * Gibt akive Annotationen zurueck
+ *
+ * @return Annotationen
+ */
+ public AnnotationFS getActiveAnnotation() {
+ for (AnnotationFS a : annotations)
+ if (casData.isChecked(a))
+ return a;
+
+ return null;
+ }
+ }
+
+ /**
+ * Container fuer StyleRanges
+ */
+ public class StyleRangeContainer {
+ // Start
+ private int start;
+
+ // Ende
+ private int end;
+
+ // Indices
+ private LinkedList<Integer> indices;
+
+ // Ranges
+ private LinkedList<StyleRange> ranges;
+
+ // Map fuer Typ auf Stylerange
+ private HashMap<Type, StyleRange> typeStyleRangeMap;
+
+ /**
+ * Konstruktor
+ */
+ protected StyleRangeContainer() {
+ start = Integer.MAX_VALUE;
+ end = Integer.MIN_VALUE;
+
+ indices = new LinkedList<Integer>();
+ ranges = new LinkedList<StyleRange>();
+
+ typeStyleRangeMap = new HashMap<Type, StyleRange>();
+ }
+
+ /**
+ * Fuegt fuer eine Annotation einen Bereich ein
+ *
+ * @param start
+ * Start
+ * @param end
+ * Ende
+ * @param annot
+ * Annotation
+ */
+ protected void addRange(int start, int end, AnnotationFS annot) {
+ StyleRange styleRange = null;
+
+ if (typeStyleRangeMap.containsKey(annot.getType()))
+ styleRange = typeStyleRangeMap.get(annot.getType());
+ else {
+ styleRange = new StyleRange();
+ styleRange.foreground = casData.getForegroundColor(annot.getType());
+ styleRange.background = casData.getBackgroundColor(annot.getType());
+ typeStyleRangeMap.put(annot.getType(), styleRange);
+ }
+
+ indices.add(start);
+ indices.add(end - start);
+
+ ranges.add(styleRange);
+ }
+
+ /**
+ * Start setzen
+ *
+ * @param start
+ * Start
+ */
+ protected void setStart(int start) {
+ this.start = start;
+ }
+
+ /**
+ * Ende setzen
+ *
+ * @param end
+ * Ende
+ */
+ protected void setEnd(int end) {
+ this.end = end;
+ }
+
+ /**
+ * Gibt die Indices zurueck
+ *
+ * @return Indieces
+ */
+ public int[] getIndices() {
+ int[] i = new int[indices.size()];
+ int c = 0;
+
+ Iterator<Integer> iter = indices.listIterator();
+
+ while (iter.hasNext())
+ i[c++] = iter.next();
+
+ return i;
+ }
+
+ /**
+ * Gibt die Ranges zurueck
+ *
+ * @return Ranges
+ */
+ public StyleRange[] getRanges() {
+ StyleRange[] r = new StyleRange[ranges.size()];
+ int c = 0;
+
+ Iterator<StyleRange> iter = ranges.listIterator();
+
+ while (iter.hasNext())
+ r[c++] = iter.next();
+
+ return r;
+ }
+
+ /**
+ * Gibt Start zurueck
+ *
+ * @return Start
+ */
+ public int getStart() {
+ return start;
+ }
+
+ /**
+ * Gibt Ende zurueck
+ *
+ * @return Ende
+ */
+ public int getEnd() {
+ return end;
+ }
+
+ /**
+ * Laenge (Ende - Start)
+ *
+ * @return Laenge
+ */
+ public int getLength() {
+ return end - start;
+ }
+ }
+
+ /**
+ * HTML ID Info
+ */
+ public class HtmlIdInfo {
+ // Start
+ private int start;
+
+ // Ende
+ private int end;
+
+ // HTML ID
+ private String id;
+
+ /**
+ * Konstuktor
+ *
+ * @param start
+ * Start
+ * @param end
+ * Ende
+ * @param id
+ * HTML ID
+ */
+ public HtmlIdInfo(int start, int end, String id) {
+ this.start = start;
+ this.end = end;
+ this.id = id;
+ }
+
+ /**
+ * Start
+ *
+ * @return Start
+ */
+ public int getStart() {
+ return start;
+ }
+
+ /**
+ * End
+ *
+ * @return End
+ */
+ public int getEnd() {
+ return end;
+ }
+
+ /**
+ * HTML ID
+ *
+ * @return HTML ID
+ */
+ public String getId() {
+ return id;
+ }
+ }
+
+ // View
+ private CEVData casData;
+
+ // RangeInfos
+ private ArrayList<RangeInfo> ranges;
+
+ // Map Annotation => RangeInfo
+ private HashMap<AnnotationFS, LinkedList<RangeInfo>> annotationRangeMap;
+
+ /**
+ * Konstuktor
+ *
+ * @param casData
+ * View
+ */
+ public CEVAnnotationRanges(CEVData casData) {
+ this.casData = casData;
+ ranges = new ArrayList<RangeInfo>();
+ annotationRangeMap = new HashMap<AnnotationFS, LinkedList<RangeInfo>>();
+
+ // Ranges Erzeugen
+ createAnnotationRanges();
+ }
+
+ /**
+ * Ranges erzeugen
+ */
+ private void createAnnotationRanges() {
+ // TODO refactor this method: it's too slow
+
+ Iterator<AnnotationFS> iter = casData.getAnnotationIterator();
+ LinkedList<AnnotationFS> annotations = new LinkedList<AnnotationFS>();
+
+ int[] pos = new int[casData.getAnnotationsCount() * 2];
+
+ int i = 0;
+
+ // Annotionen und Positionen ermitteln
+ while (iter.hasNext()) {
+ AnnotationFS annot = iter.next();
+ annotations.add(annot);
+
+ pos[i++] = annot.getBegin();
+ pos[i++] = annot.getEnd();
+ }
+
+ Arrays.sort(pos);
+
+ int s = 0;
+ int e = 1;
+
+ // Annotationen abarbeiten
+ while (e < pos.length) {
+ if (pos[s] == pos[e]) {
+ e++;
+ continue;
+ }
+
+ // neuer RangeInfo
+ RangeInfo ri = new RangeInfo(pos[s], pos[e], casData);
+ int count = 0;
+
+ ListIterator<AnnotationFS> listIter = annotations.listIterator();
+
+ // Ende suchen
+ while (listIter.hasNext()) {
+ AnnotationFS annot = listIter.next();
+
+ if (annot.getBegin() <= pos[s] && annot.getEnd() >= pos[e]) {
+ ri.addAnnotation(annot);
+ count++;
+
+ if (!annotationRangeMap.containsKey(annot))
+ annotationRangeMap.put(annot, new LinkedList<RangeInfo>());
+
+ annotationRangeMap.get(annot).add(ri);
+ }
+
+ if (annot.getEnd() <= pos[e])
+ listIter.remove();
+ }
+
+ s = e;
+ e += 1;
+
+ // RangeInfo hinzufuegen
+ if (count > 0)
+ ranges.add(ri);
+ }
+ }
+
+ public void addAnnotation(AnnotationFS annot) {
+ List<RangeInfo> ris = getAnnotationRanges(annot, true);
+ for (RangeInfo each : ris) {
+ each.addAnnotation(annot);
+ }
+ }
+
+ private List<RangeInfo> getAnnotationRanges(AnnotationFS annot, boolean add) {
+ List<RangeInfo> result = new ArrayList<RangeInfo>();
+ boolean beginFound = false;
+ boolean endFound = false;
+ for (RangeInfo each : ranges) {
+
+ if (each.getStart() == annot.getBegin()) {
+ beginFound = true;
+ }
+ if (each.getEnd() == annot.getEnd()) {
+ endFound = true;
+ }
+ if (each.getStart() > annot.getEnd()) {
+ break;
+ }
+ }
+
+ if (!beginFound) {
+ for (RangeInfo each : new ArrayList<RangeInfo>(ranges)) {
+ if (each.getStart() < annot.getBegin() && each.getEnd() > annot.getBegin()) {
+ RangeInfo newLeft = new RangeInfo(each.getStart(), annot.getBegin(), casData);
+ RangeInfo newRight = new RangeInfo(annot.getBegin(), each.getEnd(), casData);
+ int indexOf = ranges.indexOf(each);
+ ranges.remove(indexOf);
+ ranges.add(indexOf, newRight);
+ ranges.add(indexOf, newLeft);
+ }
+ }
+ }
+
+ if (!endFound) {
+ for (RangeInfo each : new ArrayList<RangeInfo>(ranges)) {
+ if (each.getStart() < annot.getEnd() && each.getEnd() > annot.getEnd()) {
+ RangeInfo newLeft = new RangeInfo(each.getStart(), annot.getEnd(), casData);
+ RangeInfo newRight = new RangeInfo(annot.getEnd(), each.getEnd(), casData);
+ int indexOf = ranges.indexOf(each);
+ ranges.remove(indexOf);
+ ranges.add(indexOf, newRight);
+ ranges.add(indexOf, newLeft);
+ }
+ }
+ }
+
+ for (RangeInfo each : ranges) {
+ if (each.getStart() >= annot.getBegin() && each.getEnd() <= annot.getEnd()) {
+ result.add(each);
+ }
+ if (each.getStart() > annot.getEnd()) {
+ break;
+ }
+ }
+
+ return result;
+ }
+
+ public void removeAnnotation(AnnotationFS annot) {
+ List<RangeInfo> ris = getAnnotationRanges(annot, false);
+ for (RangeInfo each : ris) {
+ each.removeAnnotation(annot);
+ }
+ }
+
+ /**
+ * Gibt alle StyleRanges zurueck
+ *
+ * @return StyleRangeContainer
+ */
+ public StyleRangeContainer getAllStyleRanges() {
+ StyleRangeContainer sc = new StyleRangeContainer();
+
+ int start = Integer.MAX_VALUE;
+ int end = Integer.MIN_VALUE;
+
+ boolean ok = false;
+
+ // Ranges interieren
+ for (RangeInfo r : ranges) {
+ AnnotationFS annot = r.getActiveAnnotation();
+
+ if (annot != null)
+ sc.addRange(r.getStart(), r.getEnd(), annot);
+
+ if (r.getStart() < start)
+ start = r.getStart();
+
+ if (r.getEnd() > end)
+ end = r.getEnd();
+
+ ok = true;
+ }
+
+ if (!ok) {
+ start = 0;
+ end = 0;
+ }
+
+ sc.setStart(start);
+ sc.setEnd(end);
+ return sc;
+ }
+
+ /**
+ * Gibt alle StyleRanges fuer eine Annotation zurueck
+ *
+ * @param annot
+ * Annotation
+ * @return StyleRangeContainer
+ */
+ public StyleRangeContainer getStyleRangesForAAnnotation(AnnotationFS annot) {
+ StyleRangeContainer sc = new StyleRangeContainer();
+ int start = Integer.MAX_VALUE;
+ int end = Integer.MIN_VALUE;
+
+ boolean ok = false;
+
+ // ueber die Annotation iterieren
+ if (annotationRangeMap.containsKey(annot))
+ for (RangeInfo r : annotationRangeMap.get(annot)) {
+ AnnotationFS a = r.getActiveAnnotation();
+
+ if (a != null)
+ sc.addRange(r.getStart(), r.getEnd(), a);
+
+ if (r.getStart() < start)
+ start = r.getStart();
+
+ if (r.getEnd() > end)
+ end = r.getEnd();
+
+ ok = true;
+ }
+
+ if (!ok) {
+ start = 0;
+ end = 0;
+ }
+
+ sc.setStart(start);
+ sc.setEnd(end);
+ return sc;
+ }
+
+ /**
+ * Alle HTMLIds fuer aktive Typen
+ *
+ * @return
+ */
+ public Map<String, Type> getAllHtmlIdsAndActiveTypes() {
+ TreeMap<String, Type> map = new TreeMap<String, Type>();
+
+ for (RangeInfo r : ranges) {
+ if (r.getHtmlID().size() > 0) {
+ AnnotationFS a = r.getActiveAnnotation();
+ Type t = null;
+ if (a != null)
+ t = a.getType();
+
+ for (String id : r.getHtmlID())
+ map.put(id, t);
+ }
+ }
+
+ return map;
+ }
+
+ /**
+ * Alle HTMLIds und und Typen fuer eine Annotation
+ *
+ * @param annot
+ * @return
+ */
+ public Map<String, Type> getHtmlIdsAndActiveTypesForAAnnotation(AnnotationFS annot) {
+ TreeMap<String, Type> map = new TreeMap<String, Type>();
+
+ if (annotationRangeMap.containsKey(annot))
+ for (RangeInfo r : annotationRangeMap.get(annot)) {
+ if (r.getHtmlID().size() > 0) {
+ AnnotationFS a = r.getActiveAnnotation();
+ Type t = null;
+ if (a != null)
+ t = a.getType();
+
+ for (String id : r.getHtmlID())
+ map.put(id, t);
+ }
+ }
+
+ return map;
+ }
+
+ /**
+ * Erzeugt HTML IDd
+ *
+ * @param start
+ * Start
+ * @param end
+ * End
+ * @return Liste mit allen Ids
+ */
+ public LinkedList<HtmlIdInfo> createHtmlIDs(int start, int end) {
+ LinkedList<HtmlIdInfo> list = new LinkedList<HtmlIdInfo>();
+
+ for (RangeInfo ri : ranges) {
+ if ((ri.getStart() >= start && ri.getEnd() <= end)
+ || (ri.getStart() < start && ri.getEnd() > start)
+ || (ri.getStart() < end && ri.getEnd() > end)) {
+ String id = casData.getNextHtmlID();
+ ri.addHtmlID(id);
+
+ int s = start < ri.getStart() ? ri.getStart() : start;
+ int e = end > ri.getEnd() ? ri.getEnd() : end;
+
+ list.add(new HtmlIdInfo(s, e, id));
+ }
+ }
+
+ return list;
+ }
+}
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/CEVAnnotationRanges.java
------------------------------------------------------------------------------
svn:executable = *
Propchange: uima/sandbox/trunk/TextMarker/org.apache.uima.tm.cev/src/main/java/org/apache/uima/tm/cev/data/CEVAnnotationRanges.java
------------------------------------------------------------------------------
svn:mime-type = text/plain