You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by pk...@apache.org on 2011/10/17 19:10:26 UTC

svn commit: r1185288 - in /uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor: ./ META-INF/ icons/ src/main/java/org/apache/uima/textmarker/caseditor/ src/main/java/org/apache/uima/textmarker/caseditor/view/ src/main/java/org/apache/uima/textm...

Author: pkluegl
Date: Mon Oct 17 17:10:25 2011
New Revision: 1185288

URL: http://svn.apache.org/viewvc?rev=1185288&view=rev
Log:
UIMA-2252
Added first two views: selection and annotation browser.

Additionally, to the CEV variants, another textfield is added to filter the tree dependent on the covered text of the annotations. Messages are added explaining the usage of the textfields. The icons of the tree are now generated based on the style setting in the CAS Editor: background color indicating the color and two characters indicating the style type (only the first two characters are used). Only all annotations of a type can be shown. When selecting a single annotation in the view, it is selected/focused in the editor.

Both views do already work, but a few small problems remain: The type of the current mode can still be disabled in the tree. Not well tested with different CASs.

Added:
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/icons/
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/icons/views.png   (with props)
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/plugin.xml
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/TextMarkerCasEditorPlugin.java
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/browser/
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/browser/AnnotationBrowserPage.java
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/browser/AnnotationBrowserView.java
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/selection/
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/selection/SelectionView.java
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/selection/SelectionViewPage.java
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AbstractTreeNode.java
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeContentProvider.java
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeLableProvider.java
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeNode.java
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeViewDragListener.java
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeViewPage.java
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/FSTreeNode.java
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/FeatureTreeNode.java
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/IAnnotationNode.java
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/IRootTreeNode.java
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/ITreeNode.java
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/TextUtils.java
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/ToolTipListener.java
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/TreeComparator.java
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/TypeOrderedRootTreeNode.java
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/TypeTreeNode.java
Modified:
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/META-INF/MANIFEST.MF
    uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/build.properties

Modified: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/META-INF/MANIFEST.MF?rev=1185288&r1=1185287&r2=1185288&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/META-INF/MANIFEST.MF (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/META-INF/MANIFEST.MF Mon Oct 17 17:10:25 2011
@@ -1,6 +1,20 @@
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: uimaj-ep-textmarker-caseditor
-Bundle-SymbolicName: uimaj-ep-textmarker-caseditor
+Bundle-SymbolicName: uimaj-ep-textmarker-caseditor;singleton:=true
 Bundle-Version: 1.0.0.qualifier
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.apache.uima.caseditor;bundle-version="2.4.0",
+ org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.apache.uima.runtime;bundle-version="2.3.1",
+ org.apache.uima.textmarker.engine;bundle-version="1.0.0",
+ org.eclipse.core.resources,
+ org.apache.uima.textmarker.ide;bundle-version="1.0.0",
+ org.eclipse.ui.ide,
+ org.eclipse.dltk.core;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.jface.text,
+ org.eclipse.dltk.ui;bundle-version="1.0.2",
+ org.eclipse.ui.editors,
+ org.eclipse.dltk.launching;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.debug.ui;bundle-version="3.5.0"

Modified: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/build.properties
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/build.properties?rev=1185288&r1=1185287&r2=1185288&view=diff
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/build.properties (original)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/build.properties Mon Oct 17 17:10:25 2011
@@ -1,4 +1,5 @@
-source.. = src/
+source.. = src/main/java/
 output.. = bin/
 bin.includes = META-INF/,\
-               .
+               .,\
+               plugin.xml

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/icons/views.png
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/icons/views.png?rev=1185288&view=auto
==============================================================================
Binary file - no diff available.

Propchange: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/icons/views.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/plugin.xml
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/plugin.xml?rev=1185288&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/plugin.xml (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/plugin.xml Mon Oct 17 17:10:25 2011
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.eclipse.ui.views">
+      <view
+            category="org.apache.uima.caseditor.ui.views"
+            class="org.apache.uima.textmarker.caseditor.view.selection.SelectionView"
+            icon="icons/views.png"
+            id="org.apache.uima.caseditor.selection"
+            name="Selection View">
+      </view>
+      <view
+            category="org.apache.uima.caseditor.ui.views"
+            class="org.apache.uima.textmarker.caseditor.view.browser.AnnotationBrowserView"
+            icon="icons/views.png"
+            id="org.apache.uima.caseditor.browser"
+            name="Annotation Browser View">
+      </view>
+   </extension>
+
+</plugin>

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/TextMarkerCasEditorPlugin.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/TextMarkerCasEditorPlugin.java?rev=1185288&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/TextMarkerCasEditorPlugin.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/TextMarkerCasEditorPlugin.java Mon Oct 17 17:10:25 2011
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.caseditor;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class TextMarkerCasEditorPlugin extends AbstractUIPlugin {
+
+  // The plug-in ID
+  public static final String PLUGIN_ID = "org.apache.uima.textmarker.ide"; //$NON-NLS-1$
+
+  // The shared instance
+  private static TextMarkerCasEditorPlugin plugin;
+
+  /**
+   * The constructor
+   */
+  public TextMarkerCasEditorPlugin() {
+  }
+
+  /*
+   * (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 TextMarkerCasEditorPlugin getDefault() {
+    return plugin;
+  }
+
+  public static void error(String message, Throwable t) {
+    plugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, message, t));
+  }
+
+  public static void error(Throwable t) {
+    error(t.getMessage(), t);
+  }
+
+}

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/browser/AnnotationBrowserPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/browser/AnnotationBrowserPage.java?rev=1185288&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/browser/AnnotationBrowserPage.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/browser/AnnotationBrowserPage.java Mon Oct 17 17:10:25 2011
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.caseditor.view.browser;
+
+import org.apache.uima.caseditor.editor.AnnotationEditor;
+import org.apache.uima.textmarker.caseditor.view.tree.AnnotationTreeViewPage;
+
+public class AnnotationBrowserPage extends AnnotationTreeViewPage {
+  public AnnotationBrowserPage(AnnotationEditor editor) {
+    super(false, editor);
+  }
+
+}

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/browser/AnnotationBrowserView.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/browser/AnnotationBrowserView.java?rev=1185288&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/browser/AnnotationBrowserView.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/browser/AnnotationBrowserView.java Mon Oct 17 17:10:25 2011
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.caseditor.view.browser;
+
+import org.apache.uima.caseditor.editor.AnnotationEditor;
+import org.apache.uima.caseditor.editor.AnnotationEditorView;
+import org.apache.uima.caseditor.editor.ICasEditor;
+
+public class AnnotationBrowserView extends AnnotationEditorView {
+  public static final String ID = "org.apache.uima.caseditor.browser";
+
+  public AnnotationBrowserView() {
+    super("The instance view is currently not available.");
+  }
+
+  @Override
+  protected PageRec doCreatePage(ICasEditor editor) {
+    PageRec result = null;
+    if (editor.getDocument() != null && editor instanceof AnnotationEditor) {
+      AnnotationBrowserPage page = new AnnotationBrowserPage((AnnotationEditor) editor);
+      initPage(page);
+      page.createControl(getPageBook());
+      result = new PageRec(editor, page);
+    }
+    return result;
+  }
+
+}

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/selection/SelectionView.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/selection/SelectionView.java?rev=1185288&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/selection/SelectionView.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/selection/SelectionView.java Mon Oct 17 17:10:25 2011
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.caseditor.view.selection;
+
+import org.apache.uima.caseditor.editor.AnnotationEditor;
+import org.apache.uima.caseditor.editor.AnnotationEditorView;
+import org.apache.uima.caseditor.editor.ICasEditor;
+
+/**
+ */
+public final class SelectionView extends AnnotationEditorView {
+
+  public static final String ID = "org.apache.uima.caseditor.selection";
+
+  public SelectionView() {
+    super("The instance view is currently not available.");
+  }
+
+  @Override
+  protected PageRec doCreatePage(ICasEditor editor) {
+    PageRec result = null;
+    if (editor.getDocument() != null && editor instanceof AnnotationEditor) {
+      SelectionViewPage page = new SelectionViewPage((AnnotationEditor) editor);
+      initPage(page);
+      page.createControl(getPageBook());
+      result = new PageRec(editor, page);
+    }
+    return result;
+  }
+}
\ No newline at end of file

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/selection/SelectionViewPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/selection/SelectionViewPage.java?rev=1185288&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/selection/SelectionViewPage.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/selection/SelectionViewPage.java Mon Oct 17 17:10:25 2011
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.caseditor.view.selection;
+
+import org.apache.uima.caseditor.editor.AnnotationEditor;
+import org.apache.uima.textmarker.caseditor.view.tree.AnnotationTreeViewPage;
+
+public class SelectionViewPage extends AnnotationTreeViewPage {
+
+  public SelectionViewPage(AnnotationEditor editor) {
+    super(true, editor);
+  }
+
+}

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AbstractTreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AbstractTreeNode.java?rev=1185288&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AbstractTreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AbstractTreeNode.java Mon Oct 17 17:10:25 2011
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.caseditor.view.tree;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+public abstract class AbstractTreeNode implements ITreeNode {
+
+  private ITreeNode parent;
+
+  private ArrayList<ITreeNode> children;
+
+  public AbstractTreeNode() {
+    this(null);
+  }
+
+  public AbstractTreeNode(ITreeNode parent) {
+    this.parent = parent;
+    children = new ArrayList<ITreeNode>();
+  }
+
+  public void addChild(ITreeNode child) {
+    children.add(child);
+  }
+
+  public ITreeNode[] getChildren() {
+    return children.toArray(new ITreeNode[] {});
+  }
+
+  public Iterator<ITreeNode> getChildrenIterator() {
+    return children.iterator();
+  }
+
+  public ITreeNode getParent() {
+    return parent;
+  }
+
+  public boolean hasChildren() {
+    return children.size() > 0;
+  }
+
+  public void getNodes(LinkedList<ITreeNode> list) {
+    Iterator<ITreeNode> iter = getChildrenIterator();
+
+    while (iter.hasNext()) {
+      ITreeNode node = iter.next();
+
+      list.add(node);
+
+      node.getNodes(list);
+    }
+  }
+
+  public void sort(Comparator<ITreeNode> cp) {
+    Collections.sort(children, cp);
+  }
+}

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeContentProvider.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeContentProvider.java?rev=1185288&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeContentProvider.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeContentProvider.java Mon Oct 17 17:10:25 2011
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.caseditor.view.tree;
+
+import java.util.Collection;
+
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.caseditor.editor.AbstractAnnotationDocumentListener;
+import org.apache.uima.caseditor.editor.AnnotationEditor;
+import org.apache.uima.caseditor.editor.ICasDocument;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Display;
+
+public class AnnotationTreeContentProvider extends AbstractAnnotationDocumentListener implements
+        ITreeContentProvider {
+
+  private ICasDocument document;
+
+  private final AnnotationTreeViewPage page;
+
+  public AnnotationTreeContentProvider(AnnotationEditor editor, AnnotationTreeViewPage page) {
+    super();
+    this.document = editor.getDocument();
+    this.page = page;
+  }
+
+  @Override
+  public void dispose() {
+
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang. Object)
+   */
+  public Object[] getChildren(Object element) {
+    if (element instanceof ITreeNode)
+      return ((ITreeNode) element).getChildren();
+    return null;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object )
+   */
+  public Object getParent(Object element) {
+    if (element instanceof ITreeNode)
+      return ((ITreeNode) element).getParent();
+
+    return null;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang. Object)
+   */
+  public boolean hasChildren(Object element) {
+    return (element instanceof ITreeNode) && ((ITreeNode) element).hasChildren();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java .lang.Object)
+   */
+  public Object[] getElements(Object inputElement) {
+    if (inputElement instanceof IRootTreeNode)
+      return ((IRootTreeNode) inputElement).getChildren();
+
+    return null;
+  }
+
+  @Override
+  public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+    // changed();
+  }
+
+  @Override
+  public void changed() {
+    Display.getDefault().syncExec(new Runnable() {
+      public void run() {
+        page.reloadTree();
+      }
+    });
+  }
+
+  @Override
+  public void viewChanged(String oldViewName, String newViewName) {
+    changed();
+  }
+
+  @Override
+  protected void addedAnnotation(Collection<AnnotationFS> annotations) {
+    changed();
+  }
+
+  @Override
+  protected void removedAnnotation(Collection<AnnotationFS> annotations) {
+    changed();
+  }
+
+  @Override
+  protected void updatedAnnotation(Collection<AnnotationFS> annotations) {
+    changed();
+  }
+
+}

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeLableProvider.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeLableProvider.java?rev=1185288&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeLableProvider.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeLableProvider.java Mon Oct 17 17:10:25 2011
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.caseditor.view.tree;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+
+public class AnnotationTreeLableProvider extends LabelProvider implements ILabelProvider {
+
+  private AnnotationTreeViewPage page;
+
+  public AnnotationTreeLableProvider(AnnotationTreeViewPage page) {
+    this.page = page;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object)
+   */
+  @Override
+  public Image getImage(Object element) {
+    if (element instanceof TypeTreeNode) {
+      return page.getIcon(((TypeTreeNode) element).getType());
+    } else if (element instanceof FSTreeNode) {
+      return page.getIcon(((FSTreeNode) element).getType());
+    }
+    return null;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
+   */
+  @Override
+  public String getText(Object element) {
+
+    String text = "";
+
+    if (element instanceof ITreeNode) {
+
+      String name = ((ITreeNode) element).getName();
+
+      if (name != null) {
+        // TODO reactive html stuff
+        // name = ParserUtils.trimSpacesBeginEnd(
+        // ParserUtils.trimAllTags(Translate.decode(name), false), "");
+        name = name.replaceAll("[\\n]", "").replaceAll("[\\r]", "");
+      }
+      if (element instanceof TypeTreeNode) {
+        text += TextUtils.shrinkNamespace(name);
+      } else if (name != null) {
+        text += name;
+      }
+      if (element instanceof AnnotationTreeNode) {
+        ITreeNode parent = ((AnnotationTreeNode) element).getParent();
+        if (parent instanceof TypeTreeNode) {
+          text = name;
+        } else if (parent instanceof AnnotationTreeNode) {
+          text = ((AnnotationTreeNode) element).getType().getShortName() + ": " + name;
+        }
+      } else if (element instanceof TypeTreeNode) {
+        text += " [" + ((TypeTreeNode) element).getChildren().length + "]";
+      } else {
+      }
+    }
+
+    return text;
+  }
+}

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeNode.java?rev=1185288&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeNode.java Mon Oct 17 17:10:25 2011
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.caseditor.view.tree;
+
+import org.apache.uima.cas.text.AnnotationFS;
+
+public class AnnotationTreeNode extends FSTreeNode implements IAnnotationNode {
+
+  public AnnotationTreeNode(AnnotationFS annotation) {
+    super(annotation);
+  }
+
+  public AnnotationTreeNode(ITreeNode parent, AnnotationFS annotation) {
+    super(parent, annotation);
+  }
+
+  public AnnotationFS getAnnotation() {
+    return (AnnotationFS) fs;
+  }
+
+  @Override
+  public String getName() {
+    return getAnnotation().getCoveredText();
+  }
+
+  public Object getAdapter(Class adapter) {
+
+    if (FSTreeNode.class.equals(adapter)) {
+      return this;
+    } else if (AnnotationFS.class.equals(adapter)) {
+      return fs;
+
+    }
+
+    return null;
+  }
+}

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeViewDragListener.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeViewDragListener.java?rev=1185288&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeViewDragListener.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeViewDragListener.java Mon Oct 17 17:10:25 2011
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.caseditor.view.tree;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.swt.dnd.DragSourceAdapter;
+import org.eclipse.swt.dnd.DragSourceEvent;
+
+public class AnnotationTreeViewDragListener extends DragSourceAdapter {
+  private StructuredViewer viewer;
+
+  public AnnotationTreeViewDragListener(StructuredViewer viewer) {
+    this.viewer = viewer;
+  }
+
+  public void dragFinished(DragSourceEvent event) {
+    if (!event.doit)
+      return;
+
+  }
+
+  public void dragSetData(DragSourceEvent event) {
+    IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
+    Object[] list = selection.toList().toArray();
+    for (Object object : list) {
+      if (object instanceof FeatureTreeNode) {
+        event.data = ((FeatureTreeNode) object).getValue();
+      } else if (object instanceof AnnotationTreeNode) {
+        event.data = ((AnnotationTreeNode) object).getAnnotation().getCoveredText();
+      }
+    }
+  }
+
+  public void dragStart(DragSourceEvent event) {
+    event.doit = !viewer.getSelection().isEmpty();
+  }
+}

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeViewPage.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeViewPage.java?rev=1185288&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeViewPage.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/AnnotationTreeViewPage.java Mon Oct 17 17:10:25 2011
@@ -0,0 +1,539 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.caseditor.view.tree;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.cas.text.AnnotationIndex;
+import org.apache.uima.caseditor.editor.AnnotationEditor;
+import org.apache.uima.caseditor.editor.AnnotationStyle;
+import org.apache.uima.caseditor.editor.AnnotationStyleChangeListener;
+import org.apache.uima.caseditor.editor.IAnnotationEditorModifyListener;
+import org.apache.uima.caseditor.editor.ICasDocument;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ITreeSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.PaletteData;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.part.IPageSite;
+import org.eclipse.ui.part.Page;
+
+public abstract class AnnotationTreeViewPage extends Page implements MouseListener,
+        IDoubleClickListener, Listener, ISelectionListener, ICheckStateListener,
+        IAnnotationEditorModifyListener {
+
+  public class TreeViewAnnotationStyleChangeListener extends AnnotationStyleChangeListener {
+
+    @Override
+    public void annotationStylesChanged(Collection<AnnotationStyle> styles) {
+      for (AnnotationStyle annotationStyle : styles) {
+        String annotation = annotationStyle.getAnnotation();
+        updateIcon(annotation);
+      }
+      treeView.refresh();
+    }
+
+  }
+
+  private CheckboxTreeViewer treeView;
+
+  private AnnotationTreeLableProvider lableProvider;
+
+  protected Text filterTypeTextField;
+
+  private Map<Type, Image> icons = new HashMap<Type, Image>();
+
+  private Composite overlay;
+
+  protected AnnotationEditor editor;
+
+  protected ICasDocument document;
+
+  private boolean useSelection;
+
+  private Text filterCoveredTextTextField;
+
+  private int offset = -1;
+
+  public AnnotationTreeViewPage(boolean useSelection, AnnotationEditor editor) {
+    super();
+    this.useSelection = useSelection;
+    this.editor = editor;
+    this.document = editor.getDocument();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.ui.part.Page#init(org.eclipse.ui.part.IPageSite)
+   */
+  @Override
+  public void init(IPageSite pageSite) {
+    super.init(pageSite);
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.ui.part.Page#createControl(org.eclipse.swt.widgets.Composite)
+   */
+  @Override
+  public void createControl(Composite parent) {
+    this.overlay = new Composite(parent, SWT.NONE);
+    GridLayout layout = new GridLayout();
+    layout.horizontalSpacing = 0;
+    layout.verticalSpacing = 0;
+    layout.marginWidth = 0;
+    layout.marginHeight = 0;
+    overlay.setLayout(layout);
+
+    filterTypeTextField = new Text(overlay, SWT.SINGLE | SWT.BORDER);
+    GridData gd = new GridData();
+    gd.grabExcessHorizontalSpace = true;
+    gd.horizontalAlignment = GridData.FILL;
+    gd.horizontalSpan = 1;
+    filterTypeTextField.setLayoutData(gd);
+    filterTypeTextField.setToolTipText("Retain types that contain...");
+    filterTypeTextField.addListener(SWT.KeyUp, this);
+    filterTypeTextField.addListener(SWT.MouseUp, this);
+    filterTypeTextField.addListener(SWT.Modify, this);
+    filterTypeTextField.setMessage("Only types with...");
+
+    filterCoveredTextTextField = new Text(overlay, SWT.SINGLE | SWT.BORDER);
+    GridData gd2 = new GridData();
+    gd2.grabExcessHorizontalSpace = true;
+    gd2.horizontalAlignment = GridData.FILL;
+    gd2.horizontalSpan = 1;
+    filterCoveredTextTextField.setLayoutData(gd2);
+    filterCoveredTextTextField.setToolTipText("Only annotation with...");
+    filterCoveredTextTextField.addListener(SWT.KeyUp, this);
+    filterCoveredTextTextField.addListener(SWT.MouseUp, this);
+    filterCoveredTextTextField.addListener(SWT.Modify, this);
+    filterCoveredTextTextField.setMessage("Only annotations with...");
+
+    treeView = new CheckboxTreeViewer(overlay, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+    gd = new GridData(GridData.FILL_BOTH);
+    treeView.getTree().setLayoutData(gd);
+    AnnotationTreeContentProvider provider = new AnnotationTreeContentProvider(editor, this);
+    treeView.setContentProvider(provider);
+    document.addChangeListener(provider);
+
+    lableProvider = new AnnotationTreeLableProvider(this);
+    treeView.setLabelProvider(lableProvider);
+    treeView.addCheckStateListener(this);
+    treeView.addDoubleClickListener(this);
+    treeView.getTree().addMouseListener(this);
+
+    ToolTipListener tl = new ToolTipListener(treeView.getTree());
+
+    treeView.getTree().addListener(SWT.Dispose, tl);
+    treeView.getTree().addListener(SWT.KeyDown, tl);
+    treeView.getTree().addListener(SWT.MouseMove, tl);
+    treeView.getTree().addListener(SWT.MouseHover, tl);
+    int ops = DND.DROP_COPY | DND.DROP_MOVE;
+    Transfer[] transfers = new Transfer[] { TextTransfer.getInstance() };
+    treeView.addDragSupport(ops, transfers, new AnnotationTreeViewDragListener(treeView));
+
+    getTreeViewer().getControl().addKeyListener(new KeyAdapter() {
+
+      @Override
+      public void keyPressed(KeyEvent e) {
+        int keyCode = e.keyCode;
+        // backspace or delete
+        if (keyCode == SWT.BS || keyCode == SWT.DEL) {
+          deleteSelectedAnnotations();
+        }
+      }
+
+    });
+
+    TreeViewAnnotationStyleChangeListener styleListener = new TreeViewAnnotationStyleChangeListener();
+    editor.getCasDocumentProvider().getTypeSystemPreferenceStore(editor.getEditorInput())
+            .addPropertyChangeListener(styleListener);
+
+    getSite().getPage().addSelectionListener(this);
+    getSite().setSelectionProvider(treeView);
+
+    editor.addAnnotationListener(this);
+    if (!useSelection) {
+      reloadTree();
+    }
+
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.ui.part.Page#dispose()
+   */
+  @Override
+  public void dispose() {
+    super.dispose();
+    overlay.dispose();
+    Collection<Image> values = icons.values();
+    for (Image image : values) {
+      image.dispose();
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.ui.part.Page#getControl()
+   */
+  @Override
+  public Control getControl() {
+    return overlay;
+  }
+
+  public CheckboxTreeViewer getTreeViewer() {
+    return treeView;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.ui.part.Page#setFocus()
+   */
+  @Override
+  public void setFocus() {
+    overlay.setFocus();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.viewers.IDoubleClickListener#doubleClick(org.eclipse
+   * .jface.viewers.DoubleClickEvent)
+   */
+  public void doubleClick(DoubleClickEvent event) {
+    if (event.getSelection() != null && event.getSelection() instanceof ITreeSelection) {
+      Object treeNode = ((ITreeSelection) event.getSelection()).getFirstElement();
+      if (treeNode instanceof AnnotationTreeNode) {
+        // FeatureStructureSelectionProvider provider =
+        // ((FeatureStructureSelectionProvider)editor.getSelectionProvider();
+      }
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.swt.events.MouseListener#mouseDoubleClick(org.eclipse.swt .events.MouseEvent)
+   */
+  public void mouseDoubleClick(MouseEvent e) {
+    // TODO
+  }
+
+  public void deleteSelectedAnnotations() {
+    if (MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Confirm Delete",
+            "Are you sure you want to delete these items?")) {
+
+      TreeItem[] items = treeView.getTree().getSelection();
+      HashSet<AnnotationFS> annots = new HashSet<AnnotationFS>();
+
+      for (TreeItem it : items) {
+        if (it.getData() instanceof AnnotationTreeNode) {
+          AnnotationTreeNode annot = (AnnotationTreeNode) it.getData();
+          annots.add(annot.getAnnotation());
+        } else if (it.getData() instanceof TypeTreeNode) {
+          TypeTreeNode type = (TypeTreeNode) it.getData();
+
+          for (Object child : type.getChildren()) {
+            if (child instanceof AnnotationTreeNode) {
+              AnnotationTreeNode annot = (AnnotationTreeNode) child;
+              annots.add(annot.getAnnotation());
+            }
+          }
+        }
+      }
+      editor.getDocument().removeFeatureStructures(annots);
+    }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events .MouseEvent)
+   */
+  public void mouseDown(final MouseEvent mouseEvent) {
+    // TODO popup menu deactivated
+    // if (mouseEvent.button == 3) {
+    // Display display = Display.getCurrent();
+    // Menu menu = new Menu(display.getActiveShell(), SWT.POP_UP);
+    // MenuItem itemFgC = new MenuItem(menu, SWT.PUSH);
+    //
+    // itemFgC.setText("Change Font Color");
+    // itemFgC.addListener(SWT.Selection, new Listener() {
+    // public void handleEvent(Event e) {
+    // TreeItem item = treeView.getTree().getItem(new Point(mouseEvent.x, mouseEvent.y));
+    //
+    // if (item != null && item.getData() instanceof ITreeNode) {
+    // Type type = ((ITreeNode) item.getData()).getType();
+    // ColorDialog cd = new ColorDialog(Display.getCurrent().getActiveShell());
+    // cd.setRGB(casData.getForegroundColor(type).getRGB());
+    //
+    // RGB rgb = cd.open();
+    //
+    // if (rgb != null)
+    // casData.setForegroundColor(type, new Color(Display.getCurrent(), rgb));
+    // }
+    // }
+    // });
+    //
+    // MenuItem itemBgC = new MenuItem(menu, SWT.PUSH);
+    // itemBgC.setText("Change Background Color");
+    // itemBgC.addListener(SWT.Selection, new Listener() {
+    // public void handleEvent(Event e) {
+    // TreeItem item = treeView.getTree().getItem(new Point(mouseEvent.x, mouseEvent.y));
+    //
+    // if (item != null && item.getData() instanceof ITreeNode) {
+    // Type type = ((ITreeNode) item.getData()).getType();
+    //
+    // ColorDialog cd = new ColorDialog(Display.getCurrent().getActiveShell());
+    // cd.setRGB(casData.getBackgroundColor(type).getRGB());
+    //
+    // RGB rgb = cd.open();
+    //
+    // if (rgb != null)
+    // casData.setBackgroundColor(type, new Color(Display.getCurrent(), rgb));
+    // }
+    // }
+    // });
+    //
+    // TreeItem item = treeView.getTree().getItem(new Point(mouseEvent.x, mouseEvent.y));
+    // if (item != null && item.getData() instanceof FeatureTreeNode) {
+    // itemBgC.setEnabled(false);
+    // itemFgC.setEnabled(false);
+    // }
+    //
+    // new MenuItem(menu, SWT.SEPARATOR);
+    //
+    // MenuItem itemDelA = new MenuItem(menu, SWT.PUSH);
+    // itemDelA.setText("Delete selected Items");
+    // itemDelA.addListener(SWT.Selection, new Listener() {
+    // public void handleEvent(Event e) {
+    // deleteSelectedAnnotations();
+    // }
+    // });
+    //
+    // itemDelA.setEnabled(false);
+    // TreeItem[] items = treeView.getTree().getSelection();
+    // for (TreeItem ti : items)
+    // if (!(ti.getData() instanceof FeatureTreeNode)) {
+    // itemDelA.setEnabled(true);
+    // break;
+    // }
+    //
+    // menu.setVisible(true);
+    //
+    // while (!menu.isDisposed() && menu.isVisible()) {
+    // if (!display.readAndDispatch())
+    // display.sleep();
+    // }
+    // menu.dispose();
+    // }
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @seeorg.eclipse.swt.events.MouseListener#mouseUp(org.eclipse.swt.events. MouseEvent)
+   */
+  public void mouseUp(MouseEvent e) {
+  }
+
+  public Image getIcon(Type type) {
+    if (icons.containsKey(type)) {
+      return icons.get(type);
+    }
+    Image image = updateIcon(type);
+    return image;
+  }
+
+  private void updateIcon(String typeName) {
+    Set<Type> keySet = icons.keySet();
+    for (Type type : keySet) {
+      String name = type.getName();
+      if (name.equals(typeName)) {
+        updateIcon(type);
+        return;
+      }
+
+    }
+  }
+
+  private Image updateIcon(Type type) {
+    AnnotationStyle style = editor.getAnnotationStyle(type);
+    Color fg = new Color(Display.getCurrent(), 0, 0, 0);
+    Color bg = new Color(Display.getCurrent(), style.getColor().getRed(), style.getColor()
+            .getGreen(), style.getColor().getBlue());
+
+    PaletteData paletteData = new PaletteData(new RGB[] { bg.getRGB(), fg.getRGB() });
+    ImageData imageData = new ImageData(40, 40, 1, paletteData);
+
+    Image image = new Image(Display.getCurrent(), imageData);
+    GC gc = new GC(image);
+
+    String styleString = style.getStyle().name().substring(0, 2);
+    Point p = gc.stringExtent(styleString);
+
+    gc.dispose();
+    image.dispose();
+
+    imageData = new ImageData(p.x + 4, p.y, 1, paletteData);
+    image = new Image(Display.getCurrent(), imageData);
+    gc = new GC(image);
+
+    gc.setBackground(bg);
+    gc.setForeground(fg);
+
+    gc.setTextAntialias(SWT.ON);
+    gc.drawString(styleString, 2, 0);
+
+    gc.dispose();
+
+    Image oldImage = icons.get(type);
+    if (oldImage != null) {
+      oldImage.dispose();
+    }
+    icons.put(type, image);
+    return image;
+  }
+
+  public IRootTreeNode getTypeOrderedTree(int pos, String manualTypeFilter, String manualTextFilter) {
+    TypeOrderedRootTreeNode root = new TypeOrderedRootTreeNode();
+
+    AnnotationIndex<AnnotationFS> annotationIndex = document.getCAS().getAnnotationIndex();
+    for (AnnotationFS annotationFS : annotationIndex) {
+      boolean offsetConstraint = pos == -1
+              || (annotationFS.getBegin() <= pos && annotationFS.getEnd() >= pos);
+      boolean typeConstraint = manualTypeFilter == null || "".equals(manualTypeFilter)
+              || annotationFS.getType().getName().indexOf(manualTypeFilter) != -1;
+      boolean textConstraint = manualTextFilter == null || "".equals(manualTextFilter)
+              || annotationFS.getCoveredText().indexOf(manualTextFilter) != -1;
+      if (offsetConstraint && typeConstraint && textConstraint) {
+        root.insertFS(annotationFS);
+      }
+
+    }
+    root.sort();
+    return root;
+  }
+
+  @Override
+  public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+    if (!useSelection)
+      return;
+    if (selection instanceof StructuredSelection && part instanceof AnnotationEditor) {
+      offset = editor.getCaretOffset();
+      reloadTree();
+    }
+
+  }
+
+  public void handleEvent(Event event) {
+    if ((event.widget == filterTypeTextField || event.widget == filterCoveredTextTextField)
+            && event.type == SWT.Modify) {
+      reloadTree();
+    }
+  }
+
+  public void reloadTree() {
+    String typeText = filterTypeTextField.getText();
+    String coveredTextText = filterCoveredTextTextField.getText();
+    IRootTreeNode tree = getTypeOrderedTree(offset, typeText, coveredTextText);
+    getTreeViewer().setInput(tree);
+    Collection<Type> shownAnnotationTypes = editor.getShownAnnotationTypes();
+    List<TypeTreeNode> nodes = toNodes(shownAnnotationTypes);
+    getTreeViewer().setCheckedElements(nodes.toArray());
+    getTreeViewer().setGrayed(new TypeTreeNode(editor.getAnnotationMode()), true);
+  }
+
+  public void checkStateChanged(CheckStateChangedEvent event) {
+    Object element = event.getElement();
+    boolean checked = event.getChecked();
+    Type type = null;
+    if (element instanceof TypeTreeNode) {
+      type = ((TypeTreeNode) element).getType();
+    } else if (element instanceof AnnotationTreeNode) {
+      type = ((AnnotationTreeNode) element).getType();
+    }
+    if (type != null && !editor.getAnnotationMode().equals(type)) {
+      editor.setShownAnnotationType(type, checked);
+    }
+  }
+
+  public void annotationModeChanged(Type newMode) {
+    getTreeViewer().setGrayed(new TypeTreeNode(editor.getAnnotationMode()), true);
+  }
+
+  public void showAnnotationsChanged(Collection<Type> shownAnnotationTypes) {
+    List<TypeTreeNode> nodes = toNodes(shownAnnotationTypes);
+    getTreeViewer().setCheckedElements(nodes.toArray());
+  }
+
+  private List<TypeTreeNode> toNodes(Collection<Type> shownAnnotationTypes) {
+    List<TypeTreeNode> nodes = new ArrayList<TypeTreeNode>();
+    for (Type type : shownAnnotationTypes) {
+      nodes.add(new TypeTreeNode(type));
+    }
+    return nodes;
+  }
+
+}

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/FSTreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/FSTreeNode.java?rev=1185288&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/FSTreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/FSTreeNode.java Mon Oct 17 17:10:25 2011
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.caseditor.view.tree;
+
+import org.apache.uima.cas.ArrayFS;
+import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.eclipse.core.runtime.IAdaptable;
+
+public class FSTreeNode extends AbstractTreeNode implements IAdaptable {
+
+  protected FeatureStructure fs;
+
+  public FSTreeNode(FeatureStructure thisFS) {
+    super();
+    this.fs = thisFS;
+
+    for (Feature f : thisFS.getType().getFeatures()) {
+      if (f.getRange().isPrimitive()) {
+        addChild(new FeatureTreeNode(this, f, thisFS.getFeatureValueAsString(f)));
+      }
+    }
+
+  }
+
+  public FSTreeNode(ITreeNode parent, FeatureStructure annotation) {
+    super(parent);
+    this.fs = annotation;
+    for (Feature f : annotation.getType().getFeatures()) {
+      addFeatures(this, f, annotation);
+    }
+  }
+
+  public String getName() {
+    return fs.getType().getShortName();
+  }
+
+  public Type getType() {
+    return fs.getType();
+  }
+
+  public void addFeatures(ITreeNode parent, Feature f, FeatureStructure featureStructure) {
+    if (f.getRange().isArray()) {
+      FeatureStructure featureValue = featureStructure.getFeatureValue(f);
+      if (featureValue instanceof ArrayFS) {
+        ArrayFS array = (ArrayFS) featureValue;
+        if (array != null) {
+          String text = "Array" + "[" + array.size() + "]";
+          FeatureTreeNode arrayNode = new FeatureTreeNode(this, f, text);
+          parent.addChild(arrayNode);
+
+          int size = array.size();
+
+          for (int i = 0; i < size; i++) {
+            FeatureStructure fs = array.get(i);
+            if (fs instanceof FeatureStructure) {
+              Type fsType = fs.getType();
+              ITreeNode fsNode;
+              if (fs instanceof AnnotationFS) {
+                AnnotationFS faa = (AnnotationFS) fs;
+                fsNode = new AnnotationTreeNode(arrayNode, faa);
+              } else {
+                fsNode = new TypeTreeNode(arrayNode, fsType);
+              }
+              arrayNode.addChild(fsNode);
+
+              // List<Feature> features = fs.getType().getFeatures();
+              // for (Feature feature : features) {
+              // addFeatures(fsNode, feature, fs);
+              // }
+            }
+          }
+        }
+      }
+    } else if (f.getRange().isPrimitive()) {
+      if ("uima.cas.AnnotationBase:sofa".equals(f.getName())) {
+      } else {
+        parent.addChild(new FeatureTreeNode(this, f, featureStructure.getFeatureValueAsString(f)));
+      }
+    } else if (f.getRange() instanceof Type) {
+      FeatureStructure featureValue = featureStructure.getFeatureValue(f);
+      if (featureValue instanceof AnnotationFS) {
+        parent.addChild(new AnnotationTreeNode(this, ((AnnotationFS) featureValue)));
+      }
+    }
+  }
+
+  public Object getAdapter(Class adapter) {
+
+    if (FSTreeNode.class.equals(adapter)) {
+      return this;
+    } else if (FeatureStructure.class.equals(adapter)) {
+      return fs;
+
+    }
+
+    return null;
+  }
+
+}

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/FeatureTreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/FeatureTreeNode.java?rev=1185288&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/FeatureTreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/FeatureTreeNode.java Mon Oct 17 17:10:25 2011
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.caseditor.view.tree;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.Type;
+
+public class FeatureTreeNode implements ITreeNode {
+
+  private ITreeNode parent;
+
+  private Feature f;
+
+  private String value;
+
+  private ArrayList<ITreeNode> children;
+
+  public FeatureTreeNode(ITreeNode parent, Feature f, String value) {
+    this.parent = parent;
+    this.f = f;
+    this.value = value;
+    this.children = new ArrayList<ITreeNode>();
+  }
+
+  public void addChild(ITreeNode child) {
+    this.children.add(child);
+  }
+
+  public ITreeNode[] getChildren() {
+    return this.children.toArray(new ITreeNode[] {});
+  }
+
+  public Iterator<ITreeNode> getChildrenIterator() {
+    return this.children.iterator();
+  }
+
+  public String getName() {
+    return f.getShortName() + " : " + value;
+  }
+
+  public void getNodes(LinkedList<ITreeNode> list) {
+  }
+
+  public ITreeNode getParent() {
+    return parent;
+  }
+
+  public Type getType() {
+    return f.getRange();
+  }
+
+  public boolean hasChildren() {
+    if (children.size() > 0) {
+      return true;
+    }
+    return false;
+  }
+
+  public Feature getFeature() {
+    return this.f;
+  }
+
+  public String getValue() {
+    return value;
+  }
+
+  public void sort(Comparator<ITreeNode> cp) {
+    // nothing to do
+  }
+
+  public Object getAdapter(Class adapter) {
+
+    if (FeatureTreeNode.class.equals(adapter)) {
+      return this;
+    } else if (Feature.class.equals(adapter)) {
+      return f;
+
+    }
+
+    return null;
+  }
+
+}

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/IAnnotationNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/IAnnotationNode.java?rev=1185288&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/IAnnotationNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/IAnnotationNode.java Mon Oct 17 17:10:25 2011
@@ -0,0 +1,29 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.caseditor.view.tree;
+
+import org.apache.uima.cas.text.AnnotationFS;
+
+
+public interface IAnnotationNode {
+
+  AnnotationFS getAnnotation();
+
+}

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/IRootTreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/IRootTreeNode.java?rev=1185288&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/IRootTreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/IRootTreeNode.java Mon Oct 17 17:10:25 2011
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.caseditor.view.tree;
+
+import java.util.LinkedList;
+
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+
+public interface IRootTreeNode extends ITreeNode {
+
+  public void insertFS(FeatureStructure annotation);
+
+  public LinkedList<ITreeNode> getNodes();
+
+  public LinkedList<ITreeNode> getNodes(Type type);
+
+  public LinkedList<ITreeNode> getNodes(AnnotationFS annot);
+
+  public void sort();
+}

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/ITreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/ITreeNode.java?rev=1185288&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/ITreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/ITreeNode.java Mon Oct 17 17:10:25 2011
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.caseditor.view.tree;
+
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.apache.uima.cas.Type;
+import org.eclipse.core.runtime.IAdaptable;
+
+public interface ITreeNode extends IAdaptable {
+
+  public void addChild(ITreeNode child);
+
+  public ITreeNode[] getChildren();
+
+  public Iterator<ITreeNode> getChildrenIterator();
+
+  public String getName();
+
+  public ITreeNode getParent();
+
+  public boolean hasChildren();
+
+  public Type getType();
+
+  public void getNodes(LinkedList<ITreeNode> list);
+
+  public void sort(Comparator<ITreeNode> cp);
+}

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/TextUtils.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/TextUtils.java?rev=1185288&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/TextUtils.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/TextUtils.java Mon Oct 17 17:10:25 2011
@@ -0,0 +1,43 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.caseditor.view.tree;
+
+public class TextUtils {
+
+  public static String shrinkNamespace(String namespace) {
+    String result = "";
+    if (namespace != null) {
+      String[] split = namespace.split("[.]");
+      for (int i = 0; i < split.length - 1; i++) {
+        if (split[i].length() != 0) {
+          result += split[i].charAt(0);
+          result += ".";
+        }
+      }
+      if (split.length == 0) {
+        return namespace;
+      } else {
+        result += split[split.length - 1];
+      }
+    }
+    return result;
+  }
+
+}

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/ToolTipListener.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/ToolTipListener.java?rev=1185288&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/ToolTipListener.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/ToolTipListener.java Mon Oct 17 17:10:25 2011
@@ -0,0 +1,81 @@
+package org.apache.uima.textmarker.caseditor.view.tree;
+
+import org.apache.uima.cas.text.AnnotationFS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+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.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+
+public class ToolTipListener implements Listener {
+
+  private static final String TOOLTIP_TEXT_END = "\nEnd: ";
+
+  private static final String TOOLTIP_TEXT_BEGIN = "Begin: ";
+
+  private Shell tip = null;
+
+  private Label label = null;
+
+  private Tree tree;
+
+  public ToolTipListener(Tree tree) {
+    this.tree = tree;
+  }
+
+  /*
+   * (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:
+      case SWT.MouseMove: {
+        if (tip == null)
+          break;
+        tip.dispose();
+        tip = null;
+        label = null;
+        break;
+      }
+      case SWT.MouseHover: {
+        TreeItem item = tree.getItem(new Point(event.x, event.y));
+
+        if (item != null && item.getData() instanceof AnnotationTreeNode) {
+          if (tip != null && !tip.isDisposed())
+            tip.dispose();
+
+          tip = new Shell(Display.getCurrent().getActiveShell(), 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));
+
+          AnnotationFS annot = ((AnnotationTreeNode) item.getData()).getAnnotation();
+
+          label.setText(TOOLTIP_TEXT_BEGIN + annot.getBegin() + TOOLTIP_TEXT_END + annot.getEnd());
+
+          Point size = tip.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+          Rectangle rect = item.getBounds(0);
+          Point pt = tree.toDisplay(rect.x, rect.y);
+          tip.setBounds(pt.x, pt.y, size.x, size.y);
+          tip.setVisible(true);
+        }
+      }
+    }
+  }
+}

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/TreeComparator.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/TreeComparator.java?rev=1185288&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/TreeComparator.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/TreeComparator.java Mon Oct 17 17:10:25 2011
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+
+package org.apache.uima.textmarker.caseditor.view.tree;
+
+public class TreeComparator implements java.util.Comparator<ITreeNode> {
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
+   */
+  public int compare(ITreeNode o1, ITreeNode o2) {
+    return o1.getName().compareToIgnoreCase(o2.getName());
+  }
+}

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/TypeOrderedRootTreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/TypeOrderedRootTreeNode.java?rev=1185288&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/TypeOrderedRootTreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/TypeOrderedRootTreeNode.java Mon Oct 17 17:10:25 2011
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.caseditor.view.tree;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+
+public class TypeOrderedRootTreeNode extends AbstractTreeNode implements IRootTreeNode {
+
+  public TypeOrderedRootTreeNode() {
+    super();
+  }
+
+  public String getName() {
+    return null;
+  }
+
+  public Type getType() {
+    return null;
+  }
+
+  public void insertFS(FeatureStructure fs) {
+    // TODO hotfix for explanation types...
+    if (fs.getType().getShortName().equals("DebugBlockApply")
+            || fs.getType().getShortName().equals("DebugMatchedRuleMatch")
+            || fs.getType().getShortName().equals("DebugFailedRuleMatch")
+            || fs.getType().getShortName().equals("DebugScriptApply")
+            || fs.getType().getShortName().equals("DebugRuleElementMatches")
+            || fs.getType().getShortName().equals("DebugRuleElementMatch")) {
+      return;
+    }
+
+    Iterator<ITreeNode> iter = getChildrenIterator();
+
+    while (iter.hasNext()) {
+      TypeTreeNode typeNode = (TypeTreeNode) iter.next();
+
+      if (typeNode.getType().equals(fs.getType())) {
+        FSTreeNode node = createFSNode(typeNode, fs);
+        typeNode.addChild(node);
+        return;
+      }
+    }
+
+    TypeTreeNode typeNode = new TypeTreeNode(this, fs.getType());
+    addChild(typeNode);
+
+    FSTreeNode node = createFSNode(typeNode, fs);
+    typeNode.addChild(node);
+  }
+
+  private FSTreeNode createFSNode(ITreeNode parent, FeatureStructure fs) {
+    if (fs instanceof AnnotationFS) {
+      return new AnnotationTreeNode(parent, (AnnotationFS) fs);
+    }
+    return new FSTreeNode(parent, fs);
+  }
+
+  public LinkedList<ITreeNode> getNodes() {
+    LinkedList<ITreeNode> list = new LinkedList<ITreeNode>();
+    getNodes(list);
+    return list;
+  }
+
+  public LinkedList<ITreeNode> getNodes(Type type) {
+    Iterator<ITreeNode> iter = getChildrenIterator();
+
+    LinkedList<ITreeNode> list = new LinkedList<ITreeNode>();
+
+    while (iter.hasNext()) {
+      TypeTreeNode typeNode = (TypeTreeNode) iter.next();
+
+      if (typeNode.getType().equals(type)) {
+        Iterator<ITreeNode> children = typeNode.getChildrenIterator();
+
+        list.add(typeNode);
+
+        while (children.hasNext())
+          list.add(children.next());
+      }
+    }
+
+    return list;
+  }
+
+  public LinkedList<ITreeNode> getNodes(AnnotationFS annot) {
+    Iterator<ITreeNode> iter = getChildrenIterator();
+
+    LinkedList<ITreeNode> list = new LinkedList<ITreeNode>();
+
+    while (iter.hasNext()) {
+      TypeTreeNode typeNode = (TypeTreeNode) iter.next();
+
+      if (typeNode.getType().equals(annot.getType())) {
+        Iterator<ITreeNode> children = typeNode.getChildrenIterator();
+
+        while (children.hasNext()) {
+          AnnotationTreeNode node = (AnnotationTreeNode) children.next();
+
+          if (node.getAnnotation().equals(annot)) {
+            list.add(node);
+            return list;
+          }
+        }
+      }
+    }
+
+    return list;
+  }
+
+  public void sort() {
+    sort(new TreeComparator());
+  }
+
+  public Object getAdapter(Class adapter) {
+
+    if (TypeTreeNode.class.equals(adapter)) {
+      return this;
+    } else if (Type.class.equals(adapter)) {
+      return null;
+
+    }
+
+    return null;
+  }
+
+}

Added: uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/TypeTreeNode.java
URL: http://svn.apache.org/viewvc/uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/TypeTreeNode.java?rev=1185288&view=auto
==============================================================================
--- uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/TypeTreeNode.java (added)
+++ uima/sandbox/trunk/TextMarker/uimaj-ep-textmarker-caseditor/src/main/java/org/apache/uima/textmarker/caseditor/view/tree/TypeTreeNode.java Mon Oct 17 17:10:25 2011
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.textmarker.caseditor.view.tree;
+
+import org.apache.uima.cas.Type;
+
+public class TypeTreeNode extends AbstractTreeNode {
+
+  private Type type;
+
+  public TypeTreeNode(Type type) {
+    this(null, type);
+  }
+
+  public TypeTreeNode(ITreeNode parent, Type type) {
+    super(parent);
+    this.type = type;
+  }
+
+  public String getName() {
+    return type.getName();
+  }
+
+  public Type getType() {
+    return type;
+  }
+
+  @Override
+  public boolean equals(Object o) {
+    if (o == null)
+      return false;
+    if (o instanceof TypeTreeNode) {
+      return type.equals(((TypeTreeNode) o).getType());
+    }
+    return false;
+  }
+
+  @Override
+  public int hashCode() {
+    return type.hashCode();
+  }
+
+  public Object getAdapter(Class adapter) {
+
+    if (TypeTreeNode.class.equals(adapter)) {
+      return this;
+    } else if (Type.class.equals(adapter)) {
+      return type;
+
+    }
+
+    return null;
+  }
+
+}