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 2008/11/04 21:59:13 UTC

svn commit: r711402 [3/6] - in /incubator/uima/sandbox/trunk/CasEditorEclipsePlugin: ./ META-INF/ icons/ icons/svgicons/ main/ main/java/ main/java/src/ main/java/src/org/ main/java/src/org/apache/ main/java/src/org/apache/uima/ main/java/src/org/apach...

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/IDocument.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/IDocument.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/IDocument.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/IDocument.java Tue Nov  4 12:59:10 2008
@@ -0,0 +1,195 @@
+/*
+ * 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.caseditor.editor;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.caseditor.editor.util.Span;
+
+/**
+ * The {@link IDocument} represents texts with meta information.
+ *
+ * A {@link IDocument} allows manipulation of its meta information
+ * the text must not be changed.
+ *
+ * Meta information can be retrieved over the {@link CAS} object.
+ *
+ * Note: All changes to meta information should be done with
+ * calls to the manipulation methods of the document.
+ * If this is not possible, change the {@link CAS} and after
+ * the change call the {@link IDocument#changed()} method.
+ */
+public interface IDocument {
+
+  /**
+   * Adds a given change listener.
+   *
+   * @param listener
+   */
+  void addChangeListener(IDocumentListener listener);
+
+  /**
+   * Removes the given change listener.
+   *
+   * @param listener
+   */
+  void removeChangeListener(IDocumentListener listener);
+
+  /**
+   * Retrieves the CAS.
+   *
+   * @return the CAS
+   */
+  CAS getCAS();
+
+  /**
+   * Adds a {@link FeatureStructure} to the document.
+   *
+   * @param structure -
+   *          the {@link FeatureStructure} to add.
+   */
+  void addFeatureStructure(FeatureStructure structure);
+
+  /**
+   * Adds the {@link FeatureStructure}s.
+   *
+   * @param structures
+   */
+  void addFeatureStructures(Collection<FeatureStructure> structures);
+
+  /**
+   * Adds the {@link AnnotationFS}s.
+   *
+   * @param annotations
+   */
+  void addAnnotations(Collection<AnnotationFS> annotations);
+
+  /**
+   * Removes an {@link FeatureStructure} from the Document.
+   *
+   * @param structure -
+   *          the {@link FeatureStructure} to remove.
+   */
+  void removeFeatureStructure(FeatureStructure structure);
+
+  /**
+   * Removes the given {@link FeatureStructure}s.
+   *
+   * @param structuresToRemove
+   */
+  void removeFeatureStructures(Collection<FeatureStructure> structuresToRemove);
+
+  /**
+   * Removes the given {@link AnnotationFS}s.
+   *
+   * @param annotationsToRemove
+   */
+  void removeAnnotations(Collection<AnnotationFS> annotationsToRemove);
+
+  /**
+   * Remove all annotations.
+   *
+   * @deprecated
+   */
+  @Deprecated
+  void removeAnnotation();
+
+  /**
+   * Updates the given {@link FeatureStructure}.
+   *
+   * @param structure
+   */
+  void update(FeatureStructure structure);
+
+  /**
+   * Updates the given {@link FeatureStructure}s.
+   *
+   * @param structures
+   */
+  void updateFeatureStructure(Collection<FeatureStructure> structures);
+
+  /**
+   * Updates the given {@link AnnotationFS}s.
+   *
+   * @param annotations
+   */
+  void updateAnnotations(Collection<AnnotationFS> annotations);
+
+  /**
+   * The document was changed. Its unknown what changed.
+   */
+  void changed();
+
+  /**
+   * Returns all <code>Annotation</code>s of the given type.
+   *
+   * @param type -
+   *          type of the requested <code>Annotation</code>s.
+   * @return - return all <code>Annotation</code> of the given type or null if no
+   *         <code>Annotation</code> of this type exist.
+   */
+  Collection<AnnotationFS> getAnnotations(Type type);
+
+  /**
+   * Retrieves the view map.
+   *
+   * @param annotationType
+   * @return the view map
+   */
+  Map<Integer, AnnotationFS> getView(Type annotationType);
+
+  /**
+   * Retrieves the annotations of the given type inside the given span.
+   *
+   * @param type
+   * @param span
+   * @return the annotations
+   */
+  Collection<AnnotationFS> getAnnotation(Type type, Span span);
+
+  /**
+   * Retrieves the text.
+   *
+   * @return the text as string
+   */
+  String getText();
+
+  /**
+   * Retrieves the text between start and end offsets.
+   *
+   * @param start
+   * @param end
+   * @return the text
+   */
+  String getText(int start, int end);
+
+  /**
+   * Retrieves the requested type.
+   *
+   * @param type
+   * @return the type
+   */
+  Type getType(String type);
+}
\ No newline at end of file

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/IDocument.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/IDocumentListener.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/IDocumentListener.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/IDocumentListener.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/IDocumentListener.java Tue Nov  4 12:59:10 2008
@@ -0,0 +1,83 @@
+/*
+ * 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.caseditor.editor;
+
+import java.util.Collection;
+
+import org.apache.uima.cas.FeatureStructure;
+
+/**
+ * This interface is used to notifies clients about {@link FeatureStructure} changes.
+ */
+public interface IDocumentListener {
+  /**
+   * This method is called if an {@link FeatureStructure} is added.
+   *
+   * @param newFeatureStructure -
+   *          the added {@link FeatureStructure}.
+   */
+  void added(FeatureStructure newFeatureStructure);
+
+  /**
+   * This method is called if multiple <code>FeatureStructure</code>s are added.
+   *
+   * @param newFeatureStructure -
+   *          the added {@link FeatureStructure}s.
+   */
+  void added(Collection<FeatureStructure> newFeatureStructure);
+
+  /**
+   * This method is called if an {@link FeatureStructure} is removed.
+   *
+   * @param deletedFeatureStructure -
+   *          the removed {@link FeatureStructure}.
+   */
+  void removed(FeatureStructure deletedFeatureStructure);
+
+  /**
+   * This method is called if multiple {@link FeatureStructure}s are removed.
+   *
+   * @param deletedFeatureStructure -
+   *          the removed <code>Annotation</code>s.
+   */
+  void removed(Collection<FeatureStructure> deletedFeatureStructure);
+
+  /**
+   * This method is called if the {@link FeatureStructure} changed.
+   *
+   * @param featureStructure
+   */
+  void updated(FeatureStructure featureStructure);
+
+  /**
+   * This method is called if the {@link FeatureStructure}s changed.
+   *
+   * @param featureStructure
+   */
+  void updated(Collection<FeatureStructure> featureStructure);
+
+  /**
+   * This method is called if {@link FeatureStructure}s in the
+   * document are changed.
+   *
+   * Note: The text can not be changed
+   */
+  void changed();
+}
\ No newline at end of file

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/IDocumentListener.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/IEditorSelectionListener.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/IEditorSelectionListener.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/IEditorSelectionListener.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/IEditorSelectionListener.java Tue Nov  4 12:59:10 2008
@@ -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.caseditor.editor;
+
+public interface IEditorSelectionListener {
+  /**
+   * Called after focus changed.
+   *
+   * @param isFocused
+   *          the new focus state
+   */
+  void focus(boolean isFocused);
+}
\ No newline at end of file

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/IEditorSelectionListener.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/Images.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/Images.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/Images.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/Images.java Tue Nov  4 12:59:10 2008
@@ -0,0 +1,112 @@
+/*
+ * 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.caseditor.editor;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ * All images in the Cas Editor are referenced here.
+ *
+ * Call {@link CasEditorPlugin#getTaeImageDescriptor(Images)} to retrieve
+ * an actual {@link ImageDescriptor}.
+ */
+public enum Images {
+
+  MODEL_PROJECT_OPEN("svgicons/project-open.png"),
+
+  MODEL_PROJECT_CLOSED("svgicons/project-closed.png"),
+
+  /**
+   * The corpus image.
+   */
+  MODEL_CORPUS("svgicons/corpus.png"),
+
+  /**
+   * The document image.
+   */
+  MODEL_DOCUMENT("svgicons/document.png"),
+
+  /**
+   * The source folder image.
+   */
+  MODEL_PROCESSOR_FOLDER("svgicons/processor.png"),
+
+  /**
+   * Image for the type system element.
+   */
+  MODEL_TYPESYSTEM("typesystem.gif"),
+
+  /**
+   * The enabled refresh icon.
+   */
+  EXPLORER_E_REFRESH("svgicons/refresh.png"),
+
+  /**
+   * The disabled refresh icon.
+   */
+  EXPLORER_D_REFRESH("svgicons/refresh.png"),
+
+  /**
+   * The wide left side image.
+   */
+  WIDE_LEFT_SIDE("WideLeftSide.png"),
+
+  /**
+   * The lower left side image.
+   */
+  LOWER_LEFT_SIDE("LowerLeftSide.png"),
+
+  /**
+   * The wide right side image.
+   */
+  WIDE_RIGHT_SIDE("WideRightSide.png"),
+
+  /**
+   * The lower right side image.
+   */
+  LOWER_RIGHT_SIDE("LowerRightSide.png"),
+
+  /**
+   * The merge image.
+   */
+  MERGE("merge.png"),
+
+  /**
+   * The add image.
+   */
+  ADD("svgicons/add.png"),
+
+  PIN("svgicons/pin.png");
+
+  private String mPath;
+
+  private Images(String path) {
+    mPath = path;
+  }
+
+  /**
+   * Retrieves the Path. The path is a handle for the shared image.
+   *
+   * @return the id
+   */
+  String getPath() {
+    return mPath;
+  }
+}
\ No newline at end of file

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/Images.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/ModelFeatureStructure.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/ModelFeatureStructure.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/ModelFeatureStructure.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/ModelFeatureStructure.java Tue Nov  4 12:59:10 2008
@@ -0,0 +1,123 @@
+/*
+ * 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.caseditor.editor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+
+/**
+ * TODO:
+ * set feature value to null
+ * delete feature value structure
+ * create feature value structure
+ */
+public class ModelFeatureStructure implements IAdaptable {
+  private IDocument mDocument;
+
+  private FeatureStructure mFeatureStructre;
+
+  /**
+   * Initializes a new instance.
+   *
+   * @param document
+   * @param featureStructre
+   */
+  public ModelFeatureStructure(IDocument document, FeatureStructure featureStructre) {
+    mDocument = document;
+    mFeatureStructre = featureStructre;
+  }
+
+  public IDocument getDocument() {
+    return mDocument;
+  }
+
+  public FeatureStructure getStructre() {
+    return mFeatureStructre;
+  }
+
+  public void setFeatureNull(Feature feature) {
+    mFeatureStructre.setFeatureValue(feature, null);
+  }
+
+  public void deleteFeatureValue(Feature feature) {
+    // get value and call remove
+  }
+
+  public void createFeatureValue(Feature feature) {
+    // create, add and link
+  }
+
+  public void createFeatureValueArray(Feature feature, int size) {
+    // create add and link
+  }
+
+
+  public static List<ModelFeatureStructure> create(IDocument document,
+          List<AnnotationFS> annotations) {
+    List<ModelFeatureStructure> structres = new ArrayList<ModelFeatureStructure>(annotations.size());
+
+    for (AnnotationFS annotation : annotations) {
+      structres.add(new ModelFeatureStructure(document, annotation));
+    }
+
+    return structres;
+  }
+
+  @SuppressWarnings("unchecked")
+  public Object getAdapter(Class adapter) {
+    if (FeatureStructure.class.equals(adapter)) {
+      return getStructre();
+    } else if (AnnotationFS.class.equals(adapter) && getStructre() instanceof AnnotationFS) {
+      return getStructre();
+    } else {
+      return Platform.getAdapterManager().getAdapter(this, adapter);
+    }
+  }
+
+  public void update() {
+    mDocument.update(mFeatureStructre);
+  }
+
+  @Override
+  public boolean equals(Object obj) {
+
+    if (obj == this) {
+      return true;
+    }
+    else if (obj instanceof ModelFeatureStructure) {
+      ModelFeatureStructure foreignFS = (ModelFeatureStructure) obj;
+
+      return mFeatureStructre.equals(foreignFS.mFeatureStructre);
+    }
+
+    return false;
+  }
+
+  @Override
+  public int hashCode() {
+    return mFeatureStructre.hashCode();
+  }
+}
\ No newline at end of file

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/ModelFeatureStructure.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/QuickTypeSelectionDialog.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/QuickTypeSelectionDialog.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/QuickTypeSelectionDialog.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/QuickTypeSelectionDialog.java Tue Nov  4 12:59:10 2008
@@ -0,0 +1,358 @@
+/*
+ * 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.caseditor.editor;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.TypeSystem;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.eclipse.jface.dialogs.PopupDialog;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.IOpenListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.OpenEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+
+/**
+ * This is a lightweight popup dialog which creates an annotation of the
+ * chosen type.
+ */
+class QuickTypeSelectionDialog extends PopupDialog {
+
+  private final AnnotationEditor editor;
+
+  private Text filterText;
+
+  private Map<Character, Type> shortcutTypeMap = new HashMap<Character, Type>();
+
+  private Map<Type, Character> typeShortcutMap = new HashMap<Type, Character>();
+
+  /**
+   * Initializes the current instance.
+   *
+   * @param parent
+   * @param editor
+   */
+  QuickTypeSelectionDialog(Shell parent, AnnotationEditor editor) {
+    super(parent, PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE, true, true,
+    			false, true, null, null);
+
+    this.editor = editor;
+
+    // key shortcuts are assigned automatically to types, the shortcut
+    // mapping may change if the type system is modified
+
+    String shortcutsString = "qwertzuiopasdfghjklyxcvbnm1234567890";
+
+    Set<Character> shortcuts = new HashSet<Character>();
+
+    for (int i = 0; i < shortcutsString.length(); i++) {
+    	shortcuts.add(shortcutsString.charAt(i));
+    }
+
+    List<Type> types = new ArrayList<Type>();
+   	Collections.addAll(types, getTypes());
+   	Collections.sort(types, new Comparator<Type>() {
+		public int compare(Type o1, Type o2) {
+			return o1.getName().compareTo(o2.getName());
+		}
+   	});
+
+   	// Try to create mappings with first letter of the type name as shortcut
+   	for (Iterator<Type> it = types.iterator(); it.hasNext();) {
+
+   		Type type = it.next();
+
+   		String name = type.getShortName();
+
+   		Character candidateChar = Character.toLowerCase(name.charAt(0));
+
+   		if (shortcuts.contains(candidateChar)) {
+   			putShortcut(candidateChar, type);
+
+   			shortcuts.remove(candidateChar);
+   			it.remove();
+   		}
+   	}
+
+   	// Try to create mappings with second letter of the type name as shortcut
+   	for (Iterator<Type> it = types.iterator(); it.hasNext();) {
+
+   		Type type = it.next();
+
+   		String name = type.getShortName();
+
+   		if (name.length() > 2) {
+	   		Character candidateChar = Character.toLowerCase(name.charAt(1));
+	
+	   		if (shortcuts.contains(candidateChar)) {
+	   			putShortcut(candidateChar, type);
+	
+	   			shortcuts.remove(candidateChar);
+	   			it.remove();
+	   		}
+   		}
+   	}
+   	
+   	// Now assign letters to the remaining types
+   	for (Iterator<Type> it = types.iterator(); it.hasNext();) {
+
+   		if (shortcuts.size() > 0) {
+
+   			Character candidateChar = shortcuts.iterator().next();
+
+   			putShortcut(candidateChar, it.next());
+
+   			shortcuts.remove(candidateChar);
+   			it.remove();
+   		}
+   	}
+  }
+
+  private void putShortcut(Character shortcut, Type type) {
+	  shortcutTypeMap.put(shortcut, type);
+	  typeShortcutMap.put(type, shortcut);
+  }
+
+  @SuppressWarnings("unchecked")
+  private Type[] getTypes() {
+
+	  TypeSystem typeSystem = editor.getDocument().getCAS().getTypeSystem();
+
+      List<Type> types = typeSystem.getProperlySubsumedTypes(typeSystem
+              .getType(CAS.TYPE_NAME_ANNOTATION));
+
+      return types.toArray(new Type[types.size()]);
+  }
+
+  private void annotateAndClose(Type annotationType) {
+		if (annotationType != null) {
+			Point textSelection = editor.getSelection();
+
+			AnnotationFS annotation = editor.getDocument().getCAS()
+					.createAnnotation(annotationType, textSelection.x,
+							textSelection.y);
+
+			editor.getDocument().addFeatureStructure(annotation);
+
+			if (annotation.getType().equals(editor.getAnnotationMode())) {
+				editor.setAnnotationSelection(annotation);
+			}
+		}
+
+		QuickTypeSelectionDialog.this.close();
+	}
+
+  @Override
+  protected Control createDialogArea(Composite parent) {
+    Composite composite = (Composite) super.createDialogArea(parent);
+
+    // TODO: focus always goes to the text box, but should
+    // go to the Tree control, find out why, can SWT.NO_FOCUS be used
+    // to fix it ?
+
+    filterText = new Text(composite, SWT.NO_FOCUS);
+    filterText.setBackground(parent.getBackground());
+    filterText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+    Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.LINE_DOT);
+    separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+    final TreeViewer typeTree = new TreeViewer(composite, SWT.SINGLE | SWT.V_SCROLL);
+    typeTree.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL |
+            GridData.FILL_VERTICAL));
+
+    typeTree.getControl().setFocus();
+
+    filterText.addKeyListener(new KeyListener() {
+
+      public void keyPressed(KeyEvent e) {
+        if (e.keyCode == SWT.ARROW_DOWN || e.keyCode == SWT.ARROW_UP) {
+          typeTree.getControl().setFocus();
+
+          Tree tree = (Tree) typeTree.getControl();
+
+          if (tree.getItemCount() > 0) {
+
+        	  tree.setSelection(tree.getItem(0));
+          }
+        }
+      }
+
+      public void keyReleased(KeyEvent e) {
+        typeTree.refresh(false);
+      }
+    });
+
+    typeTree.setContentProvider(new ITreeContentProvider() {
+
+      public Object[] getChildren(Object parentElement) {
+        return null;
+      }
+
+      public Object getParent(Object element) {
+        return null;
+      }
+
+      public boolean hasChildren(Object element) {
+        return false;
+      }
+
+      public Object[] getElements(Object inputElement) {
+    	  return (Type[]) inputElement;
+      }
+
+      public void dispose() {
+      }
+
+      public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+      }
+    });
+
+    typeTree.setFilters(new ViewerFilter[] { new ViewerFilter() {
+      @Override
+      public boolean select(Viewer viewer, Object parentElement, Object element) {
+
+        // check if the string from the filterText is contained in the type name
+        Type type = (Type) element;
+
+        return type.getName().contains(filterText.getText());
+      }
+    } });
+
+
+    typeTree.setLabelProvider(new ILabelProvider(){
+
+		public Image getImage(Object element) {
+			return null;
+		}
+
+		public String getText(Object element) {
+
+			Type type = (Type) element;
+
+			Character key = typeShortcutMap.get(type);
+
+			if (typeShortcutMap != null) {
+				return "[" + key +"] " + type.getShortName();
+			}
+			else {
+				return type.getShortName();
+			}
+		}
+
+		public void addListener(ILabelProviderListener listener) {
+
+		}
+
+		public void dispose() {
+		}
+
+		public boolean isLabelProperty(Object element, String property) {
+			return false;
+		}
+
+		public void removeListener(ILabelProviderListener listener) {
+		}});
+
+    typeTree.getControl().addKeyListener(new KeyListener() {
+
+		public void keyPressed(KeyEvent e) {
+        	Type type = shortcutTypeMap.get(Character.toLowerCase(e.character));
+
+        	if (type != null) {
+        		annotateAndClose(type);
+        	}
+		}
+
+		public void keyReleased(KeyEvent e) {
+		}});
+
+
+    typeTree.getControl().addMouseMoveListener(new MouseMoveListener() {
+
+      public void mouseMove(MouseEvent e) {
+
+        Tree tree = (Tree) typeTree.getControl();
+
+        TreeItem item = tree.getItem(new Point(e.x, e.y));
+
+        if (item != null) {
+          tree.setSelection(item);
+        }
+      }
+    });
+
+    // TODO open listener needs a double click, single click should be enough
+    // because there is already a selection below the mouse
+    typeTree.addOpenListener(new IOpenListener() {
+
+      public void open(OpenEvent event) {
+        StructuredSelection selection = (StructuredSelection) event.getSelection();
+
+        annotateAndClose((Type) selection.getFirstElement());
+      }
+    });
+
+    typeTree.setInput(getTypes());
+
+    ISelection modeSelection = new StructuredSelection(new Object[] {
+    		editor.getAnnotationMode()});
+
+    typeTree.setSelection(modeSelection, true);
+
+    return composite;
+  }
+
+  @Override
+  protected Point getInitialSize() {
+    return new Point(250, 300);
+  }
+}
\ No newline at end of file

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/QuickTypeSelectionDialog.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/DeleteFeatureStructureAction.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/DeleteFeatureStructureAction.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/DeleteFeatureStructureAction.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/DeleteFeatureStructureAction.java Tue Nov  4 12:59:10 2008
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.caseditor.editor.action;
+
+
+import org.apache.uima.caseditor.editor.FeatureStructureSelection;
+import org.apache.uima.caseditor.editor.IDocument;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.actions.BaseSelectionListenerAction;
+
+/**
+ * Deletes all selected annotations.
+ */
+public class DeleteFeatureStructureAction extends BaseSelectionListenerAction {
+  private IDocument mDocument;
+
+  /**
+   * Initializes the current instance.
+   *
+   * @param document
+   */
+  public DeleteFeatureStructureAction(IDocument document) {
+    super("DeleteAction");
+
+    mDocument = document;
+
+    setEnabled(true);
+  }
+
+  @Override
+  protected boolean updateSelection(IStructuredSelection selection) {
+    FeatureStructureSelection featureStructures =
+      new FeatureStructureSelection(selection);
+
+    return featureStructures.size() > 0;
+  }
+
+  /**
+   * Executes the action.
+   */
+  @Override
+  public void run() {
+
+    FeatureStructureSelection featureStructures =
+      new FeatureStructureSelection(getStructuredSelection());
+
+    mDocument.removeFeatureStructures(featureStructures.toList());
+  }
+}
\ No newline at end of file

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/DeleteFeatureStructureAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/LowerLeftAnnotationSideAction.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/LowerLeftAnnotationSideAction.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/LowerLeftAnnotationSideAction.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/LowerLeftAnnotationSideAction.java Tue Nov  4 12:59:10 2008
@@ -0,0 +1,76 @@
+/*
+ * 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.caseditor.editor.action;
+
+
+import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.caseditor.editor.AnnotationSelection;
+import org.apache.uima.caseditor.editor.IDocument;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.actions.BaseSelectionListenerAction;
+
+/**
+ * Lowers the left side of the currently selected annotation by one.
+ */
+public final class LowerLeftAnnotationSideAction extends BaseSelectionListenerAction {
+  private IDocument mDocument;
+
+  /**
+   * Initializes a new instance.
+   *
+   * @param document
+   *
+   */
+  public LowerLeftAnnotationSideAction(IDocument document) {
+    super("LowerLeftAnnotationSide");
+
+    mDocument = document;
+
+    setEnabled(false);
+  }
+
+  @Override
+  protected boolean updateSelection(IStructuredSelection selection) {
+    AnnotationSelection annotation = new AnnotationSelection(selection);
+
+    return annotation.size() == 1;
+  }
+
+  /**
+   * Increases the begin index of an annotation by one.
+   */
+  @Override
+  public void run() {
+    AnnotationSelection annotations = new AnnotationSelection(getStructuredSelection());
+
+    AnnotationFS annotation = annotations.getFirst();
+
+    Type annotationType = annotation.getType();
+    Feature beginFeature = annotationType.getFeatureByBaseName("begin");
+
+    if (annotation.getBegin() < annotation.getEnd()) {
+      annotation.setIntValue(beginFeature, annotation.getBegin() + 1);
+    }
+
+    mDocument.update(annotation);
+  }
+}
\ No newline at end of file

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/LowerLeftAnnotationSideAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/LowerRightAnnotationSideAction.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/LowerRightAnnotationSideAction.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/LowerRightAnnotationSideAction.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/LowerRightAnnotationSideAction.java Tue Nov  4 12:59:10 2008
@@ -0,0 +1,75 @@
+/*
+ * 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.caseditor.editor.action;
+
+
+import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.caseditor.editor.AnnotationSelection;
+import org.apache.uima.caseditor.editor.IDocument;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.actions.BaseSelectionListenerAction;
+
+/**
+ * Lowers the right side of the currently selected annotation by one.
+ */
+public final class LowerRightAnnotationSideAction extends BaseSelectionListenerAction {
+  private IDocument mDocument;
+
+  /**
+   * Initializes the current instance.
+   *
+   * @param document
+   */
+  public LowerRightAnnotationSideAction(IDocument document) {
+    super("LowerRightAnnotationSide");
+
+    mDocument = document;
+
+    setEnabled(false);
+  }
+
+  @Override
+  protected boolean updateSelection(IStructuredSelection selection) {
+    AnnotationSelection annotation = new AnnotationSelection(selection);
+
+    return annotation.size() == 1;
+  }
+
+  /**
+   * Decreases the end index of an annotation by one.
+   */
+  @Override
+  public void run() {
+    AnnotationSelection annotations = new AnnotationSelection(getStructuredSelection());
+
+    AnnotationFS annotation = annotations.getFirst();
+
+    Type annotationType = annotation.getType();
+    Feature endFeature = annotationType.getFeatureByBaseName("end");
+
+    if (annotation.getBegin() < annotation.getEnd()) {
+      annotation.setIntValue(endFeature, annotation.getEnd() - 1);
+    }
+
+    mDocument.update(annotation);
+  }
+}
\ No newline at end of file

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/LowerRightAnnotationSideAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/MergeAnnotationAction.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/MergeAnnotationAction.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/MergeAnnotationAction.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/MergeAnnotationAction.java Tue Nov  4 12:59:10 2008
@@ -0,0 +1,74 @@
+/*
+ * 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.caseditor.editor.action;
+
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.caseditor.editor.AnnotationSelection;
+import org.apache.uima.caseditor.editor.IDocument;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.actions.BaseSelectionListenerAction;
+
+/**
+ * Merges two or more annotations.
+ *
+ * TODO: also merge features - if one is null or primitive has default value take the the other one -
+ * in conflict case do nothing
+ */
+public class MergeAnnotationAction extends BaseSelectionListenerAction {
+  private IDocument mDocument;
+
+  /**
+   * Initializes the current instance.
+   *
+   * @param document
+   */
+  public MergeAnnotationAction(IDocument document) {
+    super("MergeAnnotationAction");
+
+    mDocument = document;
+
+    setEnabled(false);
+  }
+
+  @Override
+  protected boolean updateSelection(IStructuredSelection selection) {
+    AnnotationSelection annotation = new AnnotationSelection(selection);
+
+    return annotation.size() > 1;
+  }
+
+  /**
+   * Executes the merge action
+   */
+  @Override
+  public void run() {
+    AnnotationSelection annotations = new AnnotationSelection(getStructuredSelection());
+
+    CAS documentCAS = mDocument.getCAS();
+
+    AnnotationFS mergedAnnotation = documentCAS.createAnnotation(annotations.getFirst().getType(),
+            annotations.getFirst().getBegin(), annotations.getLast().getEnd());
+
+    mDocument.removeAnnotations(annotations.toList());
+    mDocument.addFeatureStructure(mergedAnnotation);
+  }
+}
\ No newline at end of file

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/MergeAnnotationAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/WideLeftAnnotationSideAction.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/WideLeftAnnotationSideAction.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/WideLeftAnnotationSideAction.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/WideLeftAnnotationSideAction.java Tue Nov  4 12:59:10 2008
@@ -0,0 +1,75 @@
+/*
+ * 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.caseditor.editor.action;
+
+
+import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.caseditor.editor.AnnotationSelection;
+import org.apache.uima.caseditor.editor.IDocument;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.actions.BaseSelectionListenerAction;
+
+/**
+ * Widens the left side of the currently selected annotation by one.
+ */
+public final class WideLeftAnnotationSideAction extends BaseSelectionListenerAction {
+  private IDocument mDocument;
+
+  /**
+   * Initializes a new instance.
+   *
+   * @param document
+   */
+  public WideLeftAnnotationSideAction(IDocument document) {
+    super("WideLeftAnnotationSside");
+
+    mDocument = document;
+
+    setEnabled(false);
+  }
+
+  @Override
+  protected boolean updateSelection(IStructuredSelection selection) {
+    AnnotationSelection annotation = new AnnotationSelection(selection);
+
+    return annotation.size() == 1;
+  }
+
+  /**
+   * Decreases the begin index of an annotation by one.
+   */
+  @Override
+  public void run() {
+    AnnotationSelection annotations = new AnnotationSelection(getStructuredSelection());
+
+    AnnotationFS annotation = annotations.getFirst();
+
+    Type annotationType = annotation.getType();
+    Feature beginFeature = annotationType.getFeatureByBaseName("begin");
+
+    if (annotation.getBegin() > 0) {
+      annotation.setIntValue(beginFeature, annotation.getBegin() - 1);
+    }
+
+    mDocument.update(annotation);
+  }
+}
\ No newline at end of file

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/WideLeftAnnotationSideAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/WideRightAnnotationSideAction.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/WideRightAnnotationSideAction.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/WideRightAnnotationSideAction.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/WideRightAnnotationSideAction.java Tue Nov  4 12:59:10 2008
@@ -0,0 +1,75 @@
+/*
+ * 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.caseditor.editor.action;
+
+
+import org.apache.uima.cas.Feature;
+import org.apache.uima.cas.Type;
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.caseditor.editor.AnnotationSelection;
+import org.apache.uima.caseditor.editor.IDocument;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.actions.BaseSelectionListenerAction;
+
+/**
+ * Widens the right side of the currently selected annotation by one.
+ */
+public final class WideRightAnnotationSideAction extends BaseSelectionListenerAction {
+  private IDocument mDocument;
+
+  /**
+   * Initializes a new instance.
+   *
+   * @param document
+   */
+  public WideRightAnnotationSideAction(IDocument document) {
+    super("WideRightAnnotationSide");
+
+    mDocument = document;
+
+    setEnabled(false);
+  }
+
+  @Override
+  protected boolean updateSelection(IStructuredSelection selection) {
+    AnnotationSelection annotation = new AnnotationSelection(selection);
+
+    return annotation.size() == 1;
+  }
+
+  /**
+   * Increases the end index of an annotation by one.
+   */
+  @Override
+  public void run() {
+    AnnotationSelection annotations = new AnnotationSelection(getStructuredSelection());
+
+    AnnotationFS annotation = annotations.getFirst();
+
+    Type annotationType = annotation.getType();
+    Feature endFeature = annotationType.getFeatureByBaseName("end");
+
+    if (annotation.getEnd() < mDocument.getText().length()) {
+      annotation.setIntValue(endFeature, annotation.getEnd() + 1);
+    }
+
+    mDocument.update(annotation);
+  }
+}
\ No newline at end of file

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/action/WideRightAnnotationSideAction.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/BackgroundDrawingStrategy.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/BackgroundDrawingStrategy.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/BackgroundDrawingStrategy.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/BackgroundDrawingStrategy.java Tue Nov  4 12:59:10 2008
@@ -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.caseditor.editor.annotation;
+
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.AnnotationPainter.IDrawingStrategy;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Rectangle;
+
+/**
+ * Fills the background of an annotation.
+ */
+final class BackgroundDrawingStrategy implements IDrawingStrategy {
+  /**
+   * Fill the background of the given annotation in the specified color.
+   *
+   * @param annotation
+   * @param gc
+   * @param textWidget
+   * @param offset
+   * @param length
+   * @param color
+   */
+  public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length,
+          Color color) {
+    if (length != 0) {
+      if (gc != null) {
+        Rectangle bounds = textWidget.getTextBounds(offset, offset + length - 1);
+
+        gc.setBackground(color);
+        gc.fillRectangle(bounds);
+
+        int start = offset;
+        int end = offset + length;
+
+
+//        Point selection = textWidget.getSelection();
+//        boolean isPartOfAnnotationSelected = selection.x < end && start < selection.y &&
+//            selection.y - selection.x > 0;
+//        if (isPartOfAnnotationSelected) {
+//
+//          int startInAnnotation = selection.x < start ? start : selection.x;
+//          int endInAnnotation = selection.y < end ? selection.y : end;
+//
+//          Rectangle boundsInAnnotation = textWidget.getTextBounds(startInAnnotation, endInAnnotation);
+//
+//          gc.setBackground(new Color(gc.getDevice(), 100, 100, 100));
+//          gc.fillRectangle(boundsInAnnotation);
+//        }
+
+        gc.setForeground(new Color(gc.getDevice(), 0, 0, 0));
+
+        gc.drawText(textWidget.getText(start, end), bounds.x, bounds.y, true);
+      } else {
+        textWidget.redrawRange(offset, length, true);
+      }
+    }
+  }
+}
\ No newline at end of file

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/BackgroundDrawingStrategy.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/BoxDrawingStrategy.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/BoxDrawingStrategy.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/BoxDrawingStrategy.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/BoxDrawingStrategy.java Tue Nov  4 12:59:10 2008
@@ -0,0 +1,57 @@
+/*
+ * 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.caseditor.editor.annotation;
+
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.AnnotationPainter.IDrawingStrategy;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Rectangle;
+
+/**
+ * Draws a box around an annotation.
+ */
+final class BoxDrawingStrategy implements IDrawingStrategy {
+  /**
+   * Draws a box around the given annotation.
+   *
+   * @param annotation
+   * @param gc
+   * @param textWidget
+   * @param offset
+   * @param length
+   * @param color
+   */
+  public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length,
+          Color color) {
+    if (length != 0) {
+      if (gc != null) {
+        Rectangle bounds = textWidget.getTextBounds(offset, offset + length - 1);
+
+        gc.setForeground(color);
+
+        gc.drawRectangle(bounds.x, bounds.y, bounds.width, bounds.height);
+      } else {
+        textWidget.redrawRange(offset, length, true);
+      }
+    }
+  }
+}
\ No newline at end of file

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/BoxDrawingStrategy.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/BracketDrawingStrategy.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/BracketDrawingStrategy.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/BracketDrawingStrategy.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/BracketDrawingStrategy.java Tue Nov  4 12:59:10 2008
@@ -0,0 +1,84 @@
+/*
+ * 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.caseditor.editor.annotation;
+
+import org.apache.uima.cas.text.AnnotationFS;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.AnnotationPainter.IDrawingStrategy;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Rectangle;
+
+/**
+ * Draws brackets arround an annotation.
+ */
+public class BracketDrawingStrategy implements IDrawingStrategy {
+  private static final int BRACKET_WIDTH = 3;
+
+  /**
+   * Draws an opening bracket to the begin and a closing bracket to the end of the given annotation.
+   *
+   * @param annotation
+   * @param gc
+   * @param textWidget
+   * @param offset
+   * @param length
+   * @param color
+   */
+  public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length,
+          Color color) {
+    if (length > 0) {
+      if ((annotation instanceof EclipseAnnotationPeer)) {
+        AnnotationFS annotationFS = ((EclipseAnnotationPeer) annotation).getAnnotationFS();
+
+        if (gc != null) {
+          Rectangle bounds = textWidget.getTextBounds(offset, offset + length - 1);
+
+          gc.setForeground(color);
+
+          boolean isDrawOpenBracket = annotationFS.getBegin() == offset;
+          if (isDrawOpenBracket) {
+            gc.drawLine(bounds.x, bounds.y + bounds.height - 1, bounds.x + BRACKET_WIDTH, bounds.y
+                    + bounds.height - 1);
+
+            gc.drawLine(bounds.x, bounds.y, bounds.x, bounds.y + bounds.height - 1);
+
+            gc.drawLine(bounds.x, bounds.y, bounds.x + BRACKET_WIDTH, bounds.y);
+          }
+
+          boolean isDrawCloseBracket = annotationFS.getEnd() == offset + length;
+          if (isDrawCloseBracket) {
+            gc.drawLine(bounds.x + bounds.width, bounds.y + bounds.height - 1, bounds.x
+                    + bounds.width - BRACKET_WIDTH, bounds.y + bounds.height - 1);
+
+            gc.drawLine(bounds.x + bounds.width - 1, bounds.y, bounds.x + bounds.width - 1, bounds.y
+                    + bounds.height - 1);
+
+            gc.drawLine(bounds.x + bounds.width, bounds.y, bounds.x + bounds.width - BRACKET_WIDTH,
+                    bounds.y);
+          }
+        } else {
+          textWidget.redrawRange(offset, length, true);
+        }
+      }
+    }
+  }
+}
\ No newline at end of file

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/BracketDrawingStrategy.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/DrawingStyle.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/DrawingStyle.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/DrawingStyle.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/DrawingStyle.java Tue Nov  4 12:59:10 2008
@@ -0,0 +1,83 @@
+/*
+ * 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.caseditor.editor.annotation;
+
+import org.eclipse.jface.text.source.AnnotationPainter.IDrawingStrategy;
+
+/**
+ * An enumeration of all available {@link IDrawingStrategy}.
+ */
+public enum DrawingStyle {
+
+  /**
+   * The background color {@link IDrawingStrategy}.
+   */
+  BACKGROUND(new BackgroundDrawingStrategy()),
+
+  /**
+   * The text color {@link IDrawingStrategy}.
+   */
+  TEXT_COLOR(new TextColorDrawingStrategy()),
+
+  /**
+   * The token {@link IDrawingStrategy}.
+   */
+  TOKEN(new TokenDrawingStrategy()),
+
+  /**
+   * The squiggles {@link IDrawingStrategy}.
+   */
+  SQUIGGLES(new org.eclipse.jface.text.source.AnnotationPainter.SquigglesStrategy()),
+
+  /**
+   * The box {@link IDrawingStrategy}.
+   */
+  BOX(new BoxDrawingStrategy()),
+
+  /**
+   * The underline {@link IDrawingStrategy}.
+   */
+  UNDERLINE(new UnderlineDrawingStrategy()),
+
+  /**
+   * The bracket {@link IDrawingStrategy}.
+   */
+  BRACKET(new BracketDrawingStrategy());
+
+  private final IDrawingStrategy strategy;
+
+  /**
+   * Initializes the current instance.
+   *
+   * @param strategy
+   */
+  private DrawingStyle(IDrawingStrategy strategy) {
+    this.strategy = strategy;
+  }
+
+  /**
+   * Retrieves the {@link IDrawingStrategy}.
+   *
+   * @return the {@link IDrawingStrategy}.
+   */
+  public IDrawingStrategy getStrategy() {
+    return strategy;
+  }
+}
\ No newline at end of file

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/DrawingStyle.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/EclipseAnnotationPeer.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/EclipseAnnotationPeer.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/EclipseAnnotationPeer.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/EclipseAnnotationPeer.java Tue Nov  4 12:59:10 2008
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.caseditor.editor.annotation;
+
+import org.apache.uima.cas.text.AnnotationFS;
+
+/**
+ * This class is used to provide additional information about the {@link AnnotationFS}
+ * object to the custom drawing strategies.
+ */
+public class EclipseAnnotationPeer extends org.eclipse.jface.text.source.Annotation {
+
+  /**
+   * The uima annotation.
+   */
+  private AnnotationFS annotation;
+
+  /**
+   * Initializes a new instance.
+   *
+   * @param name
+   * @param isPersitent
+   * @param text
+   */
+  public EclipseAnnotationPeer(String name, boolean isPersitent, String text) {
+    super(name, isPersitent, text);
+  }
+
+  /**
+   * Sets the annotation.
+   *
+   * @param annotation
+   */
+  public void setAnnotation(AnnotationFS annotation) {
+    this.annotation = annotation;
+    setText(annotation.getCoveredText());
+  }
+
+  /**
+   * Retrieves the annotation.
+   *
+   * @return the annotation
+   */
+  public AnnotationFS getAnnotationFS() {
+    return annotation;
+  }
+}
\ No newline at end of file

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/EclipseAnnotationPeer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/TextColorDrawingStrategy.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/TextColorDrawingStrategy.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/TextColorDrawingStrategy.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/TextColorDrawingStrategy.java Tue Nov  4 12:59:10 2008
@@ -0,0 +1,56 @@
+/*
+ * 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.caseditor.editor.annotation;
+
+import org.apache.uima.cas.text.AnnotationFS;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.AnnotationPainter.IDrawingStrategy;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Rectangle;
+
+/**
+ */
+public class TextColorDrawingStrategy implements IDrawingStrategy {
+
+  public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length, Color color) {
+    if (length > 0) {
+      if ((annotation instanceof EclipseAnnotationPeer)) {
+        AnnotationFS annotationFS = ((EclipseAnnotationPeer) annotation).getAnnotationFS();
+
+        if (gc != null) {
+
+          int start = offset;
+          int end = offset + length - 1;
+
+          Rectangle bounds = textWidget.getTextBounds(start, end);
+
+          gc.setForeground(color);
+
+          gc.drawText(textWidget.getText(start, end), bounds.x, bounds.y, true);
+
+        } else {
+          textWidget.redrawRange(offset, length, true);
+        }
+      }
+    }
+  }
+}
\ No newline at end of file

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/TextColorDrawingStrategy.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/TokenDrawingStrategy.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/TokenDrawingStrategy.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/TokenDrawingStrategy.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/TokenDrawingStrategy.java Tue Nov  4 12:59:10 2008
@@ -0,0 +1,85 @@
+/*
+ * 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.caseditor.editor.annotation;
+
+import org.apache.uima.cas.text.AnnotationFS;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.AnnotationPainter.IDrawingStrategy;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Rectangle;
+
+public class TokenDrawingStrategy implements IDrawingStrategy {
+  private static final int BRACKET_WIDTH = 5;
+
+  private static boolean isWhitespace(StyledText textWidget, int offset) {
+
+    String characterString = textWidget.getText(offset, offset);
+
+    if (characterString.trim().length() == 0) {
+      return true;
+    }
+
+    return false;
+  }
+
+  public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length,
+          Color color) {
+    if (length > 0) {
+      if ((annotation instanceof EclipseAnnotationPeer)) {
+        AnnotationFS annotationFS = ((EclipseAnnotationPeer) annotation).getAnnotationFS();
+
+        if (gc != null) {
+          Rectangle bounds = textWidget.getTextBounds(offset, offset + length - 1);
+
+          gc.setForeground(color);
+
+          boolean isDrawOpenBracket = annotationFS.getBegin() == offset;
+          // and no space before offset
+          if (isDrawOpenBracket && offset > 1 && !isWhitespace(textWidget, offset - 1)) {
+            gc.drawLine(bounds.x, bounds.y + bounds.height - 1, bounds.x + BRACKET_WIDTH, bounds.y
+                    + bounds.height - 1);
+
+            gc.drawLine(bounds.x, bounds.y, bounds.x, bounds.y + bounds.height - 1);
+
+            gc.drawLine(bounds.x, bounds.y, bounds.x + BRACKET_WIDTH, bounds.y);
+          }
+
+          boolean isDrawCloseBracket = annotationFS.getEnd() == offset + length;
+          // and no space after offset
+          if (isDrawCloseBracket && offset + length < textWidget.getText().length()
+                  && !isWhitespace(textWidget, offset + length)) {
+            gc.drawLine(bounds.x + bounds.width, bounds.y + bounds.height - 1, bounds.x
+                    + bounds.width - BRACKET_WIDTH, bounds.y + bounds.height - 1);
+
+            gc.drawLine(bounds.x + bounds.width - 1, bounds.y, bounds.x + bounds.width - 1,
+                    bounds.y + bounds.height - 1);
+
+            gc.drawLine(bounds.x + bounds.width, bounds.y, bounds.x + bounds.width - BRACKET_WIDTH,
+                    bounds.y);
+          }
+        } else {
+          textWidget.redrawRange(offset, length, true);
+        }
+      }
+    }
+  }
+}
\ No newline at end of file

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/TokenDrawingStrategy.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/UnderlineDrawingStrategy.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/UnderlineDrawingStrategy.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/UnderlineDrawingStrategy.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/UnderlineDrawingStrategy.java Tue Nov  4 12:59:10 2008
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.caseditor.editor.annotation;
+
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.AnnotationPainter.IDrawingStrategy;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+
+/**
+ * Draws an line under an annotation.
+ */
+public class UnderlineDrawingStrategy implements IDrawingStrategy {
+
+  /**
+   * Draws a line under under a given annotation.
+   *
+   * @param annotation
+   * @param gc
+   * @param textWidget
+   * @param offset
+   * @param length
+   * @param color
+   */
+  public void draw(Annotation annotation, GC gc, StyledText textWidget, int offset, int length,
+          Color color) {
+    if (gc != null) {
+      Rectangle bounds;
+
+      if (length > 0) {
+        bounds = textWidget.getTextBounds(offset, offset + length - 1);
+      } else {
+        Point location = textWidget.getLocationAtOffset(offset);
+        bounds = new Rectangle(location.x, location.y, 1, textWidget.getLineHeight());
+      }
+
+      int y = bounds.y + bounds.height - 1;
+
+      gc.setForeground(color);
+
+      gc.drawLine(bounds.x, y, bounds.x + bounds.width, y);
+    } else {
+      textWidget.redrawRange(offset, length, true);
+    }
+  }
+}

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/annotation/UnderlineDrawingStrategy.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/context/AnnotationEditingControl.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/context/AnnotationEditingControl.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/context/AnnotationEditingControl.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/context/AnnotationEditingControl.java Tue Nov  4 12:59:10 2008
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.uima.caseditor.editor.context;
+
+import org.apache.uima.cas.FeatureStructure;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * TODO: add javadoch here
+ */
+public class AnnotationEditingControl extends Composite {
+
+  /**
+   * Initializes the current instance.
+   *
+   * @param parent
+   */
+  public AnnotationEditingControl(Composite parent) {
+    super(parent, SWT.NONE);
+
+    setLayout(new FillLayout());
+
+    Label text = new Label(this, SWT.NONE);
+    text.setText("annotation context editor");
+
+    pack();
+  }
+
+  /**
+   * Display this feature structure.
+   *
+   * @param structure
+   */
+  public void displayFeatureStructure(FeatureStructure structure) {
+
+
+
+  }
+}

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/context/AnnotationEditingControl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/context/AnnotationEditingControlCreator.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/context/AnnotationEditingControlCreator.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/context/AnnotationEditingControlCreator.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/context/AnnotationEditingControlCreator.java Tue Nov  4 12:59:10 2008
@@ -0,0 +1,65 @@
+/*
+ * 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.caseditor.editor.context;
+
+
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.caseditor.editor.CustomInformationControl;
+import org.apache.uima.caseditor.editor.ICustomInformationControlContentHandler;
+import org.eclipse.jface.text.IInformationControl;
+import org.eclipse.jface.text.IInformationControlCreator;
+import org.eclipse.swt.widgets.Shell;
+
+/**
+ * TODO: add javadoc here
+ */
+public class AnnotationEditingControlCreator implements IInformationControlCreator {
+
+  /**
+   * Creates the information control.
+   *
+   * @param parent
+   *
+   * @return the new control
+   */
+  public IInformationControl createInformationControl(Shell parent) {
+    final ICustomInformationControlContentHandler contentHandler = new ICustomInformationControlContentHandler() {
+
+      public void setInput(CustomInformationControl control, Object input) {
+        AnnotationEditingControl annotationEditControl = (AnnotationEditingControl) control
+                .getControl();
+
+        annotationEditControl.displayFeatureStructure((FeatureStructure) input);
+
+        control.getParent().setSize(annotationEditControl.getSize());
+      }
+
+    };
+
+    CustomInformationControl control = new CustomInformationControl(parent, contentHandler);
+
+    AnnotationEditingControl annotationEditingControl = new AnnotationEditingControl(control
+            .getParent());
+
+    control.setControl(annotationEditingControl);
+
+    return control;
+  }
+}
\ No newline at end of file

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/context/AnnotationEditingControlCreator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/contextmenu/IModeMenuListener.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/contextmenu/IModeMenuListener.java?rev=711402&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/contextmenu/IModeMenuListener.java (added)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/contextmenu/IModeMenuListener.java Tue Nov  4 12:59:10 2008
@@ -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.caseditor.editor.contextmenu;
+
+import org.apache.uima.cas.Type;
+
+public interface IModeMenuListener {
+	
+	/**
+	 * Mode was changed to a new mode. 
+	 * 
+	 * @param newMode
+	 */
+	void modeChanged(Type newMode);
+}
\ No newline at end of file

Propchange: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/main/java/src/org/apache/uima/caseditor/editor/contextmenu/IModeMenuListener.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain