You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by al...@apache.org on 2007/03/30 20:08:22 UTC

svn commit: r524212 [2/4] - in /incubator/uima/sandbox/trunk/CasEditor: ./ META-INF/ src/main/java/org/apache/uima/caseditor/ src/main/java/org/apache/uima/caseditor/core/ src/main/java/org/apache/uima/caseditor/core/model/ src/main/java/org/apache/uim...

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpusSerializer.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpusSerializer.java?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpusSerializer.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/model/dotcorpus/DotCorpusSerializer.java Fri Mar 30 11:08:15 2007
@@ -44,7 +44,7 @@
  * This class is responsible to read and write {@link DotCorpus} objects from or to a byte stream.
  */
 public class DotCorpusSerializer {
-  private static final String COPORA_ELEMENT = "copora";
+  private static final String CONFIG_ELEMENT = "config";
 
   private static final String CORPUS_ELEMENT = "corpus";
 
@@ -62,9 +62,9 @@
 
   private static final String TYPESYTEM_FILE_ATTRIBUTE = "file";
 
-  private static final String TAGGER_ELEMENT = "config";
+  private static final String CAS_PROCESSOR_ELEMENT = "processor";
 
-  private static final String TAGGER_FOLDER_ATTRIBUTE = "folder";
+  private static final String CAS_PROCESSOR_FOLDER_ATTRIBUTE = "folder";
 
   private static final String EDITOR_ELEMENT = "editor";
 
@@ -113,14 +113,14 @@
     DotCorpus dotCorpus = new DotCorpus();
 
     // get corpora root element
-    Element corporaElement = dotCorpusDOM.getDocumentElement();
+    Element configElement = dotCorpusDOM.getDocumentElement();
 
-    if (COPORA_ELEMENT.equals(corporaElement.getNodeName())) {
+    if (CONFIG_ELEMENT.equals(configElement.getNodeName())) {
       // TODO:
       // throw exception
     }
 
-    NodeList corporaChildNodes = corporaElement.getChildNodes();
+    NodeList corporaChildNodes = configElement.getChildNodes();
 
     for (int i = 0; i < corporaChildNodes.getLength(); i++) {
       Node corporaChildNode = corporaChildNodes.item(i);
@@ -146,13 +146,14 @@
 
         int colorInteger = Integer.parseInt(colorString);
 
+        Color color = new Color(colorInteger);
         AnnotationStyle style = new AnnotationStyle(type, AnnotationStyle.Style
-                .valueOf(styleString), new Color(colorInteger));
+                .valueOf(styleString), new org.eclipse.swt.graphics.Color(null, color.getRed(), 
+                color.getGreen(), color.getBlue()));
 
         dotCorpus.setStyle(style);
-      } else if (TAGGER_ELEMENT.equals(corporaChildElement.getNodeName())) {
-        dotCorpus
-                .setUimaConfigFolderName(corporaChildElement.getAttribute(TAGGER_FOLDER_ATTRIBUTE));
+      } else if (CAS_PROCESSOR_ELEMENT.equals(corporaChildElement.getNodeName())) {
+        dotCorpus.addCasProcessorFolder(corporaChildElement.getAttribute(CAS_PROCESSOR_FOLDER_ATTRIBUTE));
       } else if (EDITOR_ELEMENT.equals(corporaChildElement.getNodeName())) {
         String lineLengthHintString = corporaChildElement
                 .getAttribute(EDITOR_LINE_LENGTH_ATTRIBUTE);
@@ -188,7 +189,7 @@
     
     try {
       xmlSerHandler.startDocument();
-      xmlSerHandler.startElement("", COPORA_ELEMENT, COPORA_ELEMENT, null);
+      xmlSerHandler.startElement("", CONFIG_ELEMENT, CONFIG_ELEMENT, null);
 
       for (String corpusFolder : dotCorpus.getCorpusFolderNameList()) {
         AttributesImpl corpusFolderAttributes = new AttributesImpl();
@@ -205,12 +206,12 @@
         corpusFolderAttributes.addAttribute("", "", STYLE_STYLE_ATTRIBUTE, "", style.getStyle()
                 .name());
 
-        Integer color = style.getColor().getRGB();
-        corpusFolderAttributes.addAttribute("", "", STYLE_COLOR_ATTRIBUTE, "", color.toString());
+        org.eclipse.swt.graphics.Color color = style.getColor();
+        Integer colorInt = new Color(color.getRed(), color.getGreen(), color.getBlue()).getRGB();
+        corpusFolderAttributes.addAttribute("", "", STYLE_COLOR_ATTRIBUTE, "", colorInt.toString());
 
         xmlSerHandler.startElement("", STYLE_ELEMENT, STYLE_ELEMENT, corpusFolderAttributes);
         xmlSerHandler.endElement("", STYLE_ELEMENT, STYLE_ELEMENT);
-
       }
 
       if (dotCorpus.getTypeSystemFileName() != null) {
@@ -222,13 +223,12 @@
         xmlSerHandler.endElement("", TYPESYSTEM_ELEMENT, TYPESYSTEM_ELEMENT);
       }
 
-      if (dotCorpus.getUimaConfigFolder() != null) {
+      for (String folder : dotCorpus.getCasProcessorFolderNames()) {
         AttributesImpl taggerConfigAttributes = new AttributesImpl();
-        taggerConfigAttributes.addAttribute("", "", TAGGER_FOLDER_ATTRIBUTE, "", dotCorpus
-                .getUimaConfigFolder());
-
-        xmlSerHandler.startElement("", TAGGER_ELEMENT, TAGGER_ELEMENT, taggerConfigAttributes);
-        xmlSerHandler.endElement("", TAGGER_ELEMENT, TAGGER_ELEMENT);
+        taggerConfigAttributes.addAttribute("", "", CAS_PROCESSOR_FOLDER_ATTRIBUTE, "", folder);
+        
+        xmlSerHandler.startElement("", CAS_PROCESSOR_ELEMENT, CAS_PROCESSOR_ELEMENT, taggerConfigAttributes);
+        xmlSerHandler.endElement("", CAS_PROCESSOR_ELEMENT, CAS_PROCESSOR_ELEMENT);
       }
 
       if (dotCorpus.getEditorLineLengthHint() != DotCorpus.EDITOR_LINE_LENGTH_HINT_DEFAULT) {
@@ -240,7 +240,7 @@
         xmlSerHandler.endElement("", EDITOR_ELEMENT, EDITOR_ELEMENT);
       }
 
-      xmlSerHandler.endElement("", COPORA_ELEMENT, COPORA_ELEMENT);
+      xmlSerHandler.endElement("", CONFIG_ELEMENT, CONFIG_ELEMENT);
       xmlSerHandler.endDocument();
     } catch (SAXException e) {
       String message = (e.getMessage() != null ? e.getMessage() : "");

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/uima/DocumentUimaImpl.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/uima/DocumentUimaImpl.java?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/uima/DocumentUimaImpl.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/core/uima/DocumentUimaImpl.java Fri Mar 30 11:08:15 2007
@@ -59,16 +59,31 @@
  * TODO: add javdoc here
  */
 public class DocumentUimaImpl extends AbstractDocument {
+ 
+  private DocumentElement mDocumentElement;
+  private TypeSystem mTypeSystem;
   private CAS mCAS;
-private DocumentElement mDocumentElement;
 
   /**
    * Initializes a new instance.
    * 
    * @param project
    */
-  public DocumentUimaImpl(NlpProject project) {
-    mCAS = project.getTypesystem().getCAS();
+  public DocumentUimaImpl(NlpProject project, DocumentElement element, InputStream in) 
+  	throws CoreException{
+    
+	  mTypeSystem = project.getTypesystemElement().getTypeSystem();
+    
+	if (mTypeSystem == null) {
+		throw new CoreException(new Status(IStatus.INFO, CasEditorPlugin.ID, 
+				IStatus.ERROR, "Invalid typesystem!", null));
+	}
+	
+	mCAS = project.getTypesystemElement().getCAS();
+	
+	mDocumentElement = element;
+
+	setContent(in);
   }
 
   /**
@@ -125,11 +140,14 @@
    * Removes the given annotations from the {@link CAS}.
    */
   public void removeFeatureStructures(Collection<FeatureStructure> annotationsToRemove) {
-    for (FeatureStructure annotationToRemove : annotationsToRemove) {
+    
+	for (FeatureStructure annotationToRemove : annotationsToRemove) {
       removeAnnotationInternal(annotationToRemove);
     }
 
-    fireRemovedAnnotations(annotationsToRemove);
+	if (annotationsToRemove.size() > 0) {
+		fireRemovedAnnotations(annotationsToRemove);
+	}
   }
 
   /**
@@ -226,8 +244,9 @@
   /**
    * Sets the content. The XCAS {@link InputStream} gets parsed.
    */
-  public void setContent(InputStream content) throws CoreException {
-    XCASDeserializer dezerializer = new XCASDeserializer(mCAS.getTypeSystem());
+  private void setContent(InputStream content) throws CoreException {
+	  
+    XCASDeserializer dezerializer = new XCASDeserializer(mTypeSystem);
 
     SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
     saxParserFactory.setValidating(false);
@@ -292,8 +311,4 @@
 
 	    mDocumentElement.getResource().setContents(stream, true, false, null);
   }
-  
-	public void setDocumentElement(DocumentElement element) {
-		mDocumentElement = element;
-	}
 }

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/AnnotationDocument.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/AnnotationDocument.java?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/AnnotationDocument.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/AnnotationDocument.java Fri Mar 30 11:08:15 2007
@@ -19,7 +19,6 @@
 
 package org.apache.uima.caseditor.editor;
 
-import java.io.InputStream;
 import java.util.Collection;
 import java.util.Map;
 
@@ -326,15 +325,5 @@
    */
   public Type getType(String type) {
     return mDocument.getType(type);
-  }
-
-  /**
-   * Call is forwared to the set document.
-   * 
-   * @param contentStream
-   * @throws CoreException
-   */
-  public void setContent(InputStream contentStream) throws CoreException {
-    mDocument.setContent(contentStream);
   }
 }

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java Fri Mar 30 11:08:15 2007
@@ -22,7 +22,6 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedList;
@@ -35,12 +34,12 @@
 import org.apache.uima.cas.TypeSystem;
 import org.apache.uima.cas.text.AnnotationFS;
 import org.apache.uima.caseditor.core.AbstractAnnotationDocumentListener;
+import org.apache.uima.caseditor.core.model.dotcorpus.AnnotationStyle;
 import org.apache.uima.caseditor.core.model.dotcorpus.EditorAnnotationStatus;
 import org.apache.uima.caseditor.core.uima.AnnotationComparator;
 import org.apache.uima.caseditor.core.util.Span;
 import org.apache.uima.caseditor.editor.action.DeleteFeatureStructureAction;
-import org.apache.uima.caseditor.editor.annotation.AnnotationViewerDecorationSupport;
-import org.apache.uima.caseditor.editor.annotation.EclipseAnnotationPeer;
+import org.apache.uima.caseditor.editor.annotation.DrawingStyle;
 import org.apache.uima.caseditor.editor.context.AnnotationEditingControlCreator;
 import org.apache.uima.caseditor.editor.outline.AnnotationOutline;
 import org.apache.uima.caseditor.ui.FeatureStructureTransfer;
@@ -50,10 +49,12 @@
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.action.IMenuManager;
 import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.text.Position;
 import org.eclipse.jface.text.information.InformationPresenter;
-import org.eclipse.jface.text.source.IAnnotationModelExtension;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.AnnotationPainter;
+import org.eclipse.jface.text.source.IAnnotationAccess;
 import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewer;
 import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.StructuredSelection;
 import org.eclipse.swt.SWT;
@@ -80,12 +81,10 @@
 import org.eclipse.ui.ISelectionListener;
 import org.eclipse.ui.IWorkbenchActionConstants;
 import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.editors.text.TextEditor;
 import org.eclipse.ui.texteditor.IStatusField;
 import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
-import org.eclipse.ui.texteditor.ITextEditorExtension2;
 import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds;
-import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;
+import org.eclipse.ui.texteditor.StatusTextEditor;
 import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
 
 /**
@@ -97,12 +96,9 @@
  * add an action to decrease left side on an annotation 
  * add an action to decrease right side on an annotation
  */
-public final class AnnotationEditor extends TextEditor implements ISelectionListener,
-        ITextEditorExtension2 {
+public final class AnnotationEditor extends StatusTextEditor implements ISelectionListener {
   /**
    * This action annotates the selected text with a defined tag.
-   * 
-   * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
    */
   private class AnnotateAction extends Action {
     private StyledText mTextWidget;
@@ -152,8 +148,6 @@
 
   /**
    * Shows the annotation editing context for the active annoation.
-   * 
-   * @author <a href="mailto:jkottmann@calcucare.com">Joern Kottmann </a>
    */
   private class ShowAnnotationContextEditAction extends Action {
     private InformationPresenter mPresenter;
@@ -206,8 +200,6 @@
   /**
    * This <code>IDocumentChangeListener</code> is responsible to synchronize annotation in the
    * document with the annotations in eclipse.
-   * 
-   * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
    */
   private class DocumentListener extends AbstractAnnotationDocumentListener {
     /**
@@ -215,28 +207,8 @@
      * 
      * @param annotations
      */
-    public void addedAnnotation(Collection<AnnotationFS> annotations) {
-      IAnnotationModelExtension annotationModel = (IAnnotationModelExtension) getDocumentProvider()
-              .getAnnotationModel(getEditorInput());
-
-      Map<org.eclipse.jface.text.source.Annotation, Position> annotationMap = 
-              new HashMap<org.eclipse.jface.text.source.Annotation, Position>();
-
-      for (AnnotationFS annotation : annotations) {
-        int start = annotation.getBegin();
-        int length = annotation.getEnd() - start;
-
-        EclipseAnnotationPeer eclipseAnnotation = new EclipseAnnotationPeer(
-                ECLIPSE_ANNOTATION_TYPE, false, "test");
-
-        eclipseAnnotation.setAnnotation(annotation);
-
-        annotationMap.put(eclipseAnnotation, new Position(start, length));
-
-        mAnnotationToEclipseAnnotationMap.put(annotation, eclipseAnnotation);
-      }
-
-      annotationModel.replaceAnnotations(null, annotationMap);
+    public void addedAnnotation(Collection<AnnotationFS> annotations) {    	
+    	mPainter.paint(AnnotationPainter.CONFIGURATION);
     }
 
     /**
@@ -245,19 +217,7 @@
      * @param deletedAnnotations
      */
     public void removedAnnotation(Collection<AnnotationFS> deletedAnnotations) {
-      IAnnotationModelExtension annotationModel = (IAnnotationModelExtension) getDocumentProvider()
-              .getAnnotationModel(getEditorInput());
-
-      org.eclipse.jface.text.source.Annotation[] annotations =
-              new org.eclipse.jface.text.source.Annotation[deletedAnnotations.size()];
-
-      int i = 0;
-      for (AnnotationFS deletedAnnotation : deletedAnnotations) {
-        annotations[i++] = mAnnotationToEclipseAnnotationMap.get(deletedAnnotation);
-      }
-
-      annotationModel.replaceAnnotations(annotations, null);
-
+    	
       if (getSite().getPage().getActivePart() == AnnotationEditor.this) {
         mFeatureStructureSelectionProvider.clearSelection();
       } else {
@@ -265,6 +225,8 @@
       }
 
       highlight(0, 0); // TODO: only if removed annotation was selected
+      
+      mPainter.paint(AnnotationPainter.CONFIGURATION);
     }
 
     /**
@@ -287,9 +249,6 @@
   }
 
   /**
-   * .
-   * 
-   * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
    */
   private static abstract class TypeMenu extends ContributionItem {
     private Type mParentType;
@@ -353,8 +312,6 @@
 
   /**
    * Creates the mode context submenu.
-   * 
-   * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
    */
   private class ModeMenu extends TypeMenu {
     /**
@@ -363,8 +320,8 @@
      * @param type
      * @param typeSystem
      */
-    ModeMenu(Type type, TypeSystem typeSystem) {
-      super(type, typeSystem);
+    ModeMenu(TypeSystem typeSystem) {
+      super(typeSystem.getType(CAS.TYPE_NAME_ANNOTATION), typeSystem);
     }
 
     @Override
@@ -386,18 +343,21 @@
 
   /**
    * Creates the show annotations context submenu.
-   * 
-   * @author <a href="mailto:kottmann@gmail.com">Joern Kottmann</a>
    */
   private class ShowAnnotationsMenu extends TypeMenu {
+	 
+	 private Collection<Type> mTypesToDisplay = new HashSet<Type>();
+	  
     /**
      * Initializes a new instance.
      * 
      * @param type
      * @param typeSystem
      */
-    ShowAnnotationsMenu(Type type, TypeSystem typeSystem) {
-      super(type, typeSystem);
+    ShowAnnotationsMenu(EditorAnnotationStatus status, TypeSystem typeSystem) {
+      super(typeSystem.getType(CAS.TYPE_NAME_ANNOTATION), typeSystem);
+      
+      mTypesToDisplay.addAll(status.getDisplayAnnotations());
     }
 
     @Override
@@ -426,8 +386,75 @@
         }
       });
     }
+    
+    Collection<Type> getSelectedTypes() {
+    	return Collections.unmodifiableCollection(mTypesToDisplay);
+    }
   }
 
+  /**
+   * Sometimes the wrong annoation is selected ... ????
+   */
+  private class FeatureStructureDragListener implements DragSourceListener {
+    private boolean mIsActive;
+
+    private AnnotationFS mCandidate;
+
+    FeatureStructureDragListener(final StyledText textWidget) {
+      textWidget.addKeyListener(new KeyListener() {
+        public void keyPressed(KeyEvent e) {
+          if (e.keyCode == SWT.ALT) {
+            mIsActive = true;
+
+            textWidget.setCursor(Display.getCurrent().getSystemCursor(SWT.CURSOR_HAND));
+          }
+        }
+
+        public void keyReleased(KeyEvent e) {
+          if (e.stateMask == SWT.ALT) {
+            mIsActive = false;
+            textWidget.setCursor(null);
+          }
+        }
+      });
+
+      textWidget.addMouseMoveListener(new MouseMoveListener() {
+
+        public void mouseMove(MouseEvent e) {
+          if (mIsActive) {
+            // try to get the position inside the text
+            int offset = textWidget.getOffsetAtLocation(new Point(e.x, e.y));
+
+            Map<Integer, AnnotationFS> view = getDocument().getView(mCurrentAnnotationType);
+
+            mCandidate = view.get(offset);
+
+            if (mCandidate != null) {
+              textWidget.setSelectionRange(mCandidate.getBegin(), mCandidate.getEnd()
+                      - mCandidate.getBegin());
+            }
+          }
+        }
+
+      });
+    }
+
+    public void dragStart(DragSourceEvent event) {
+      if (mIsActive) {
+        event.doit = mCandidate != null;
+      } else {
+        event.doit = false;
+      }
+    }
+
+    public void dragSetData(DragSourceEvent event) {
+      event.data = mCandidate;
+    }
+
+    public void dragFinished(DragSourceEvent event) {
+    }
+  }
+  
   private Type mCurrentAnnotationType;
 
   /**
@@ -435,10 +462,6 @@
    */
   private IContentOutlinePage mOutlinePage;
 
-  private HashMap<AnnotationFS, org.eclipse.jface.text.source.Annotation> 
-        mAnnotationToEclipseAnnotationMap = new HashMap<AnnotationFS, 
-        org.eclipse.jface.text.source.Annotation>();
-
   private IAnnotationEditorModifyListener mEditorListener;
 
   /**
@@ -448,24 +471,23 @@
 
   private AnnotationDocument mDocument;
 
-  /**
-   * The type of the annotation for eclipse-annotations
-   */
-  public static final String ECLIPSE_ANNOTATION_TYPE = "org.apache.uima.caseditor.Annotation";
-
-  private Collection<Type> mTypesToDisplay = new HashSet<Type>();
-
   boolean mIsSomethingHighlighted = false;
 
   private StyleRange mCurrentStyleRange;
 
   private FeatureStructureSelectionProvider mFeatureStructureSelectionProvider;
 
+  private AnnotationPainter mPainter;
+
+//  private IAnnotationModel mAnnotationModel;
+
+  private ShowAnnotationsMenu mShowAnnotationsMenu;
+  
   /**
    * Creates an new AnnotationEditor object.
    */
   public AnnotationEditor() {
-    setDocumentProvider(new AnnotationDocumentProvider());
+    setDocumentProvider(new CasDocumentProvider());
   }
 
   /**
@@ -489,27 +511,32 @@
     }
   }
 
-  
-  @Override
-  protected SourceViewerDecorationSupport getSourceViewerDecorationSupport(ISourceViewer viewer) {
-    // lazy intialize fSourceViewerDecorationSupport
-    if (fSourceViewerDecorationSupport == null) {
-      fSourceViewerDecorationSupport = new AnnotationViewerDecorationSupport(viewer,
-              getOverviewRuler(), getAnnotationAccess(), getSharedColors(), this);
-
-      configureSourceViewerDecorationSupport(fSourceViewerDecorationSupport);
-    }
-
-    return fSourceViewerDecorationSupport;
-  }
-
   @Override
   protected ISourceViewer createSourceViewer(Composite parent,
           org.eclipse.jface.text.source.IVerticalRuler ruler, int styles) {
-    ISourceViewer sourceViewer = super.createSourceViewer(parent, ruler, styles);
-
+	  SourceViewer sourceViewer = new SourceViewer(parent, ruler, styles);
+    
     sourceViewer.setEditable(false);
+    
+	mPainter = new AnnotationPainter(sourceViewer, new IAnnotationAccess() {
 
+		public Object getType(Annotation annotation) {
+			return null;
+		}
+
+		public boolean isMultiLine(Annotation annotation) {
+			return false;
+		}
+
+		public boolean isTemporary(Annotation annotation) {
+			return false;
+		}
+		
+	});
+	sourceViewer.addPainter(mPainter);
+    
+	// mPainter.modelChanged(mAnnotationModel); // realy nessesary ?
+	
     return sourceViewer;
   }
 
@@ -521,15 +548,13 @@
   @Override
   public void createPartControl(Composite parent) {
     super.createPartControl(parent);
-
+    
     /*
      * this is a workaround for the quickdiff assertion if nothing was changed, how to do this
      * better ? is this the right way ?
      */
     showChangeInformation(false);
 
-    getDocument().addChangeListener(new DocumentListener());
-
     getSourceViewer().getTextWidget().addKeyListener(new KeyListener() {
       public void keyPressed(KeyEvent e) {
         int newCaretOffset = getSourceViewer().getTextWidget().getCaretOffset();
@@ -580,72 +605,17 @@
     getSourceViewer().setEditable(false);
 
     getSite().setSelectionProvider(mFeatureStructureSelectionProvider);
-  }
-
-  /**
-   * Sometimes the wrong annoation is selected ... ????
-   * 
-   * @author joern
-   * 
-   */
-  private class FeatureStructureDragListener implements DragSourceListener {
-    private boolean mIsActive;
-
-    private AnnotationFS mCandidate;
-
-    FeatureStructureDragListener(final StyledText textWidget) {
-      textWidget.addKeyListener(new KeyListener() {
-        public void keyPressed(KeyEvent e) {
-          if (e.keyCode == SWT.ALT) {
-            mIsActive = true;
-
-            textWidget.setCursor(Display.getCurrent().getSystemCursor(SWT.CURSOR_HAND));
-          }
-        }
-
-        public void keyReleased(KeyEvent e) {
-          if (e.stateMask == SWT.ALT) {
-            mIsActive = false;
-            textWidget.setCursor(null);
-          }
-        }
-      });
-
-      textWidget.addMouseMoveListener(new MouseMoveListener() {
-
-        public void mouseMove(MouseEvent e) {
-          if (mIsActive) {
-            // try to get the position inside the text
-            int offset = textWidget.getOffsetAtLocation(new Point(e.x, e.y));
-
-            Map<Integer, AnnotationFS> view = getDocument().getView(mCurrentAnnotationType);
-
-            mCandidate = view.get(offset);
-
-            if (mCandidate != null) {
-              textWidget.setSelectionRange(mCandidate.getBegin(), mCandidate.getEnd()
-                      - mCandidate.getBegin());
-            }
-          }
-        }
-
-      });
-    }
-
-    public void dragStart(DragSourceEvent event) {
-      if (mIsActive) {
-        event.doit = mCandidate != null;
-      } else {
-        event.doit = false;
-      }
-    }
-
-    public void dragSetData(DragSourceEvent event) {
-      event.data = mCandidate;
+    
+    if (mDocument != null) {
+	    mShowAnnotationsMenu = new ShowAnnotationsMenu(
+	    		mDocument.getProject().getEditorAnnotationStatus(), 
+	    		getDocument().getCAS().getTypeSystem());
+	    
+		EditorAnnotationStatus status = mDocument.getProject().getEditorAnnotationStatus();
+		setAnnotationType(status.getMode());
     }
+    
 
-    public void dragFinished(DragSourceEvent event) {
-    }
   }
 
   // TODO: still not called always, e.g. on mouse selection
@@ -669,15 +639,11 @@
 
     mDocument = (AnnotationDocument) getDocumentProvider().getDocument(input);
 
-    EditorAnnotationStatus status = mDocument.getProject().getEditorAnnotationStatus();
-
-    setAnnotationType(status.getMode());
-    mTypesToDisplay.clear();
-    mTypesToDisplay.addAll(status.getDisplayAnnotations());
-
-    syncAnnotations();
-
-    mFeatureStructureSelectionProvider = new FeatureStructureSelectionProvider(mDocument);
+    if (mDocument != null) {
+    	// mAnnotationModel = getDocumentProvider().getAnnotationModel(input);
+    	
+    	getDocument().addChangeListener(new DocumentListener());
+    }
   }
 
   @Override
@@ -686,17 +652,15 @@
 
     TypeSystem typeSytem = getDocument().getCAS().getTypeSystem();
 
-    Type annotation = typeSytem.getType(CAS.TYPE_NAME_ANNOTATION);
-
     // mode menu
     MenuManager modeMenu = new MenuManager("Mode");
     menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, modeMenu);
-    modeMenu.add(new ModeMenu(annotation, typeSytem));
+    modeMenu.add(new ModeMenu(typeSytem));
 
     // annotation menu
     MenuManager showAnnotationMenu = new MenuManager("Show Annotations");
     menu.appendToGroup(IWorkbenchActionConstants.MB_ADDITIONS, showAnnotationMenu);
-    showAnnotationMenu.add(new ShowAnnotationsMenu(annotation, typeSytem));
+    showAnnotationMenu.add(mShowAnnotationsMenu);
   }
 
   /**
@@ -760,56 +724,31 @@
     mEditorListener.annotationModeChanged(type);
   }
 
+  private void showAnnotationType(Type type) {
+		AnnotationStyle style = mDocument.getProject().getDotCorpus().getAnnotation(type);
+		mPainter.addDrawingStrategy(type.getName(), 
+				DrawingStyle.valueOf(style.getStyle().name()).getStrategy());
+		mPainter.addAnnotationType(type.getName(), type.getName());
+		mPainter.setAnnotationTypeColor(type.getName(), style.getColor());
+  }
+  
   /**
    * 
    */
   private void syncAnnotations() {
-    Collection<org.eclipse.jface.text.source.Annotation> annotationsToRemoveCollection = 
-            mAnnotationToEclipseAnnotationMap.values();
-
-    org.eclipse.jface.text.source.Annotation[] annotationsToRemove = 
-            new org.eclipse.jface.text.source.Annotation[annotationsToRemoveCollection.size()];
-
-    annotationsToRemoveCollection.toArray(annotationsToRemove);
-
-    mAnnotationToEclipseAnnotationMap.clear();
-
-    // add new
-    HashMap<org.eclipse.jface.text.source.Annotation, Position> annotationsToAdd = 
-            new HashMap<org.eclipse.jface.text.source.Annotation, Position>();
-
-    // create a set of annoation types to display
-    // get enabled annoations
-    // get current annotation
 
-    Collection<AnnotationFS> annotations = new LinkedList<AnnotationFS>();
-
-    for (Type type : mTypesToDisplay) {
-      annotations.addAll(getDocument().getAnnotations(type));
-    }
+	mPainter.removeAllAnnotationTypes();
+	
+	for (Type displayType : mShowAnnotationsMenu.getSelectedTypes()) {
+		showAnnotationType(displayType);
+	}
 
     // if not contained in types add current mode annotations
-    if (!mTypesToDisplay.contains(mCurrentAnnotationType)) {
-      annotations.addAll(getDocument().getAnnotations(mCurrentAnnotationType));
+    if (!mShowAnnotationsMenu.getSelectedTypes().contains(mCurrentAnnotationType)) {
+    	showAnnotationType(mCurrentAnnotationType);
     }
 
-    for (AnnotationFS annotation : annotations) {
-      EclipseAnnotationPeer eclipseAnnotation = new EclipseAnnotationPeer(ECLIPSE_ANNOTATION_TYPE,
-              false, "");
-
-      eclipseAnnotation.setAnnotation(annotation);
-
-      int start = annotation.getBegin();
-      int length = annotation.getEnd() - start;
-
-      annotationsToAdd.put(eclipseAnnotation, new Position(start, length));
-      mAnnotationToEclipseAnnotationMap.put(annotation, eclipseAnnotation);
-    }
-
-    IAnnotationModelExtension annotationModel = (IAnnotationModelExtension) getDocumentProvider()
-            .getAnnotationModel(getEditorInput());
-
-    annotationModel.replaceAnnotations(annotationsToRemove, annotationsToAdd);
+	mPainter.paint(AnnotationPainter.CONFIGURATION);
   }
 
   /**
@@ -943,7 +882,7 @@
   private void setProjectEditorStatus() {
     // TODO: do not replace if equal ... check this
     EditorAnnotationStatus status = new EditorAnnotationStatus(getAnnotationMode(), 
-            mTypesToDisplay);
+            mShowAnnotationsMenu.getSelectedTypes());
     getDocument().getProject().setEditorAnnotationStatus(status);
   }
 
@@ -953,6 +892,10 @@
   @Override
   protected void createActions() {
     super.createActions();
+    
+    
+    mFeatureStructureSelectionProvider = new FeatureStructureSelectionProvider();
+    getSite().setSelectionProvider(mFeatureStructureSelectionProvider);
 
     // create annotate action
     AnnotateAction annotateAction = new AnnotateAction(getSourceViewer().getTextWidget());
@@ -960,13 +903,15 @@
     annotateAction.setActionDefinitionId(ITextEditorActionDefinitionIds.SMART_ENTER);
 
     setAction(ITextEditorActionDefinitionIds.SMART_ENTER, annotateAction);
-    setActionActivationCode(ITextEditorActionDefinitionIds.SMART_ENTER, (char) 0, SWT.CR,
+    setActionActivationCode(ITextEditorActionDefinitionIds.SMART_ENTER, (char) '\r', SWT.CR,
             SWT.DEFAULT);
 
     // create delete action
     DeleteFeatureStructureAction deleteAnnotationAction = new DeleteFeatureStructureAction(
             getDocument());
-    mFeatureStructureSelectionProvider.addSelectionChangedListener(deleteAnnotationAction);
+    
+    getSite().getSelectionProvider().addSelectionChangedListener(deleteAnnotationAction);
+    
     deleteAnnotationAction.setActionDefinitionId(IWorkbenchActionDefinitionIds.DELETE);
 
     setAction(IWorkbenchActionDefinitionIds.DELETE, deleteAnnotationAction);
@@ -980,7 +925,7 @@
 
     setAction(ITextEditorActionDefinitionIds.QUICK_ASSIST, annotationContextEditAction);
   }
-
+  
   @Override
   public void dispose() {
     // remove selection listener

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorActionContributor.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorActionContributor.java?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorActionContributor.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditorActionContributor.java Fri Mar 30 11:08:15 2007
@@ -19,9 +19,10 @@
 
 package org.apache.uima.caseditor.editor;
 
+import org.apache.uima.cas.Type;
 import org.eclipse.jface.action.IStatusLineManager;
 import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.editors.text.TextEditorActionContributor;
+import org.eclipse.ui.part.EditorActionBarContributor;
 import org.eclipse.ui.texteditor.StatusLineContributionItem;
 
 /**
@@ -29,7 +30,7 @@
  * 
  * Contributes the "annotation mode" status item to the status bar.
  */
-public class AnnotationEditorActionContributor extends TextEditorActionContributor {
+public class AnnotationEditorActionContributor extends EditorActionBarContributor {
   /**
    * ID of the status item.
    */
@@ -52,9 +53,12 @@
       mActiveEditorPart = (AnnotationEditor) part;
 
       mActiveEditorPart.setStatusField(mStatusLineModeItem, ID);
-
-      // TODO: how todo this right ???
-      mStatusLineModeItem.setText(mActiveEditorPart.getAnnotationMode().getShortName());
+      
+      Type annotationType = mActiveEditorPart.getAnnotationMode(); 
+      
+      if (annotationType != null) {
+    	  mStatusLineModeItem.setText(annotationType.getShortName());
+      }
     }
   }
 

Added: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProvider.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProvider.java?view=auto&rev=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProvider.java (added)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/CasDocumentProvider.java Fri Mar 30 11:08:15 2007
@@ -0,0 +1,180 @@
+package org.apache.uima.caseditor.editor;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.uima.cas.text.AnnotationFS;
+import org.apache.uima.caseditor.CasEditorPlugin;
+import org.apache.uima.caseditor.FileEditorInput;
+import org.apache.uima.caseditor.core.model.DocumentElement;
+import org.apache.uima.caseditor.core.model.INlpElement;
+import org.apache.uima.caseditor.editor.annotation.EclipseAnnotationPeer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jface.text.source.IAnnotationModelListener;
+import org.eclipse.ui.texteditor.AbstractDocumentProvider;
+
+/**
+ * Provides the {@link org.apache.uima.caseditor.core.IDocument} for 
+ * the {@link AnnotationEditor}.
+ */
+public class CasDocumentProvider extends AbstractDocumentProvider {
+
+	/**
+	 * The method {@link #createDocument(Object)} put error status 
+	 * objects for the given element in this map, if something with document creation
+	 * goes wrong. 
+	 * 
+	 * The method {@link #getStatus(Object)} can than retrive and return the status.
+	 */
+	private Map<Object, IStatus> mElementErrorStatus = new HashMap<Object, IStatus>();
+
+	@Override
+	protected IAnnotationModel createAnnotationModel(Object element) throws CoreException {
+		return new IAnnotationModel() {
+			
+			private org.apache.uima.caseditor.core.IDocument mDocument;
+			
+			public void addAnnotation(Annotation annotation, Position position) {
+			}
+
+			public void addAnnotationModelListener(IAnnotationModelListener listener) {
+			}
+
+			public void connect(IDocument document) {
+				mDocument = (org.apache.uima.caseditor.core.IDocument) document;
+			}
+
+			public void disconnect(IDocument document) {
+				mDocument = null;
+			}
+
+			public Iterator getAnnotationIterator() {
+				return new Iterator() {
+					private Iterator mAnnotations = 
+						mDocument.getCAS().getAnnotationIndex().iterator();
+					
+					public boolean hasNext() {
+						return mAnnotations.hasNext();
+					}
+
+					public Object next() {
+						AnnotationFS annotation = (AnnotationFS) mAnnotations.next();
+						
+						EclipseAnnotationPeer peer = new EclipseAnnotationPeer(annotation.getType().getName(), false, "");
+						peer.setAnnotation(annotation);
+						return peer;
+					}
+
+					public void remove() {
+					}};
+			}
+
+			public Position getPosition(Annotation annotation) {
+				EclipseAnnotationPeer peer = (EclipseAnnotationPeer) annotation;
+				AnnotationFS annotationFS = peer.getAnnotationFS(); 
+				return new Position(annotationFS.getBegin(), 
+						annotationFS.getEnd() - annotationFS.getBegin());
+			}
+
+			public void removeAnnotation(Annotation annotation) {
+			}
+
+			public void removeAnnotationModelListener(IAnnotationModelListener listener) {
+			}
+		};
+	}
+	
+	/**
+	 * Creates the a new {@link AnnotationDocument} from the given {@link FileEditorInputOLD} 
+	 * element. For all other elemetns null is returned.
+	 */
+	@Override
+	protected IDocument createDocument(Object element) throws CoreException {
+		if (element instanceof FileEditorInput) {
+      FileEditorInput fileInput = (FileEditorInput) element;
+			
+			IFile file = fileInput.getFile();
+			
+			INlpElement nlpElement = CasEditorPlugin.getNlpModel().findMember(file);
+			
+			if (nlpElement instanceof DocumentElement) {
+
+				try {
+					org.apache.uima.caseditor.core.IDocument workingCopy = 
+						((DocumentElement) nlpElement).getDocument();
+					
+					AnnotationDocument document = new AnnotationDocument();
+					document.setProject(nlpElement.getNlpProject());
+					
+					document.setDocument(workingCopy);
+					return document;
+				}
+				catch (CoreException e) {
+					mElementErrorStatus.put(element, new Status(IStatus.INFO, 
+							CasEditorPlugin.ID, IStatus.ERROR,
+							"There is a problem with the document: " + e.getMessage(), e));
+				}
+			}
+			else {
+				IStatus status;
+				
+				if (nlpElement == null) {
+					status = new Status(IStatus.INFO, CasEditorPlugin.ID, IStatus.ERROR,
+							"Document not in a corpus folder!", null);
+				}
+				else {
+					status = new Status(IStatus.INFO, CasEditorPlugin.ID, IStatus.ERROR,
+							"Not a cas document!", null);
+				}
+			      
+				mElementErrorStatus.put(element, status);
+			}
+		}
+		
+		return null;
+	}
+
+	@Override
+	protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException {
+		fireElementStateChanging(element);
+		
+		org.apache.uima.caseditor.core.IDocument casDocument = 
+			(org.apache.uima.caseditor.core.IDocument) document;
+		
+		try {
+			casDocument.save();
+		}
+		catch (CoreException e) {
+			fireElementStateChangeFailed(element);
+			throw e;
+		}
+		
+		fireElementDirtyStateChanged(element, false);
+	}
+
+	@Override
+	protected IRunnableContext getOperationRunner(IProgressMonitor monitor) {
+		return null;
+	}
+	
+	@Override
+	public IStatus getStatus(Object element) {
+	    IStatus status = mElementErrorStatus.get(element);
+
+	    if (status == null) {
+	      status = super.getStatus(element);
+	    }
+
+	    return status;	
+	}
+}

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/FeatureStructureSelectionProvider.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/FeatureStructureSelectionProvider.java?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/FeatureStructureSelectionProvider.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/FeatureStructureSelectionProvider.java Fri Mar 30 11:08:15 2007
@@ -44,12 +44,6 @@
 
   private Set<ISelectionChangedListener> mListeners = new HashSet<ISelectionChangedListener>();
 
-  private IDocument mDocument;
-
-  public FeatureStructureSelectionProvider(IDocument document) {
-    mDocument = document;
-  }
-
   /**
    * Adds an {@link ISelectionChangedListener} to this provider.
    * 
@@ -109,7 +103,7 @@
       throw new IllegalArgumentException("annotation must not be null!");
     }
 
-    setSelection(new StructuredSelection(new ModelFeatureStructure(mDocument, annotation)));
+    setSelection(new StructuredSelection(new ModelFeatureStructure(document, annotation)));
   }
 
   public void setSelection(IDocument document, List<AnnotationFS> selection) {

Added: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/SimpleTextEditor.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/SimpleTextEditor.java?view=auto&rev=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/SimpleTextEditor.java (added)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/SimpleTextEditor.java Fri Mar 30 11:08:15 2007
@@ -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.caseditor.editor;
+
+import org.apache.uima.caseditor.FileDocumentProvider;
+import org.eclipse.ui.texteditor.AbstractTextEditor;
+
+public class SimpleTextEditor extends AbstractTextEditor {
+  public SimpleTextEditor() {
+    setDocumentProvider(new FileDocumentProvider());
+  }
+}

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/action/DeleteFeatureStructureAction.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/action/DeleteFeatureStructureAction.java?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/action/DeleteFeatureStructureAction.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/action/DeleteFeatureStructureAction.java Fri Mar 30 11:08:15 2007
@@ -27,9 +27,6 @@
 
 /**
  * Deletes all selected annotations.
- * 
- * TODO: create a FeatureStructreSelection class (AnnotationSelection) should then extend it and use
- * it for this class
  */
 public class DeleteFeatureStructureAction extends BaseSelectionListenerAction {
   private IDocument mDocument;

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/BracketDrawingStrategy.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/BracketDrawingStrategy.java?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/BracketDrawingStrategy.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/BracketDrawingStrategy.java Fri Mar 30 11:08:15 2007
@@ -69,7 +69,7 @@
             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, bounds.y, bounds.x + bounds.width, bounds.y
+            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,

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/DrawingStyle.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/DrawingStyle.java?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/DrawingStyle.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/annotation/DrawingStyle.java Fri Mar 30 11:08:15 2007
@@ -51,7 +51,7 @@
     mStrategy = strategy;
   }
 
-  IDrawingStrategy getStrategy() {
+  public IDrawingStrategy getStrategy() {
     return mStrategy;
   }
 }

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/fsview/FeatureStructureBrowserView.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/fsview/FeatureStructureBrowserView.java?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/fsview/FeatureStructureBrowserView.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/fsview/FeatureStructureBrowserView.java Fri Mar 30 11:08:15 2007
@@ -36,7 +36,7 @@
   /**
    * The ID of the feature structure view.
    */
-  public final String ID = "org.apache.uima.caseditor.fsview";
+  public static final String ID = "org.apache.uima.caseditor.fsview";
 
   @Override
   protected IPage createDefaultPage(PageBook book) {

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/fsview/FeatureStructureBrowserViewPage.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/fsview/FeatureStructureBrowserViewPage.java?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/fsview/FeatureStructureBrowserViewPage.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/fsview/FeatureStructureBrowserViewPage.java Fri Mar 30 11:08:15 2007
@@ -146,7 +146,7 @@
     typePaneData.horizontalAlignment = SWT.FILL;
     mTypePane.setLayoutData(typePaneData);
 
-    mFSList = new ListViewer(mInstanceComposite, SWT.MULTI);
+    mFSList = new ListViewer(mInstanceComposite, SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
     GridData instanceListData = new GridData();
     instanceListData.grabExcessHorizontalSpace = true;
     instanceListData.grabExcessVerticalSpace = true;

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/fsview/FeatureStructureLabelProvider.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/fsview/FeatureStructureLabelProvider.java?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/fsview/FeatureStructureLabelProvider.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/fsview/FeatureStructureLabelProvider.java Fri Mar 30 11:08:15 2007
@@ -19,7 +19,6 @@
 
 package org.apache.uima.caseditor.editor.fsview;
 
-
 import org.apache.uima.cas.FeatureStructure;
 import org.apache.uima.cas.text.AnnotationFS;
 import org.apache.uima.caseditor.core.util.Primitives;
@@ -34,10 +33,18 @@
  */
 public final class FeatureStructureLabelProvider implements ILabelProvider {
   public String getText(Object element) {
-    if (element instanceof IAdaptable
-            && ((IAdaptable) element).getAdapter(AnnotationFS.class) != null) {
-      FeatureStructure structure = (AnnotationFS) ((IAdaptable) element)
-              .getAdapter(AnnotationFS.class);
+    if (element instanceof IAdaptable) {
+      
+      FeatureStructure structure = null;
+      
+      if (((IAdaptable) element).getAdapter(AnnotationFS.class) != null) {
+        structure = (AnnotationFS) ((IAdaptable) element)
+                .getAdapter(AnnotationFS.class);
+      }
+
+      if (structure == null) {
+        structure = (FeatureStructure) ((IAdaptable) element).getAdapter(FeatureStructure.class);
+      }
 
       return structure.getType().getShortName();
     } else if (element instanceof FeatureValue) {

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/outline/AnnotationOutline.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/outline/AnnotationOutline.java?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/outline/AnnotationOutline.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/editor/outline/AnnotationOutline.java Fri Mar 30 11:08:15 2007
@@ -458,7 +458,7 @@
 
   /**
    * Adds the these actions to the global action handler: {@link DeleteFeatureStructureAction}
-   * SelectAllAction // TODO: implement it
+   * SelectAllAction
    * 
    * @param actionBars
    */

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/FeatureStructureTransfer.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/FeatureStructureTransfer.java?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/FeatureStructureTransfer.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/FeatureStructureTransfer.java Fri Mar 30 11:08:15 2007
@@ -20,7 +20,7 @@
 package org.apache.uima.caseditor.ui;
 
 /**
- * This class is able to transfer a {@link com.ibm.uima.cas.FeatureStructure}
+ * This class is able to transfer a {@link org.apache.uima.cas.FeatureStructure}
  * objects.
  */
 public class FeatureStructureTransfer extends ObjectTransfer

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/NlpPerspectiveFactory.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/NlpPerspectiveFactory.java?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/NlpPerspectiveFactory.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/NlpPerspectiveFactory.java Fri Mar 30 11:08:15 2007
@@ -20,9 +20,11 @@
 package org.apache.uima.caseditor.ui;
 
 
+import org.apache.uima.caseditor.editor.fsview.FeatureStructureBrowserView;
 import org.apache.uima.caseditor.ui.corpusview.CorpusExplorerView;
-import org.apache.uima.caseditor.ui.wizards.NewCorpusWizard;
-import org.apache.uima.caseditor.ui.wizards.NlpProjectWizard;
+import org.apache.uima.caseditor.ui.wizards.NewNlpProjectWizard;
+import org.apache.uima.caseditor.ui.wizards.WizardNewFileCreation;
+import org.apache.uima.caseditor.ui.wizards.WizardNewFolderCreation;
 import org.eclipse.ui.IFolderLayout;
 import org.eclipse.ui.IPageLayout;
 import org.eclipse.ui.IPerspectiveFactory;
@@ -51,10 +53,10 @@
     private void defineActions(IPageLayout layout)
     {
         // add "new wizards"
-        layout.addNewWizardShortcut(NlpProjectWizard.ID);
-        layout.addNewWizardShortcut(NewCorpusWizard.ID);
-        layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");
-        layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");
+        layout.addNewWizardShortcut(NewNlpProjectWizard.ID);
+//        layout.addNewWizardShortcut(NewCorpusWizard.ID);
+        layout.addNewWizardShortcut(WizardNewFolderCreation.ID);
+        layout.addNewWizardShortcut(WizardNewFileCreation.ID);
         
         // layout.addNewWizardShortcut("Annotator.NewDocumentWizard");
         
@@ -75,12 +77,16 @@
         IFolderLayout left = layout.createFolder("left", IPageLayout.LEFT,
                 0.19f, editorArea);
         left.addView(CorpusExplorerView.ID);
+        left.addView(CorpusExplorerView.ID + "s");
+        
         
         // right views
         IFolderLayout right = layout.createFolder("right", IPageLayout.RIGHT,
                 0.70f, editorArea);
         
         right.addView(IPageLayout.ID_OUTLINE);
+        right.addView(FeatureStructureBrowserView.ID);
+        right.addView("org.eclipse.pde.runtime.LogView");
         
         // bottom views
         IFolderLayout bottom = layout.createFolder("rightBottom",

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/action/ConsumerActionRunnable.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/action/ConsumerActionRunnable.java?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/action/ConsumerActionRunnable.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/action/ConsumerActionRunnable.java Fri Mar 30 11:08:15 2007
@@ -138,8 +138,8 @@
         
         XMLParser xmlParser = UIMAFramework.getXMLParser();
         
-        InputStream inIndex = getClass().getClassLoader().getResourceAsStream(
-                "org/apache/uima/caseditor/core/Index.xml");
+        InputStream inIndex = getClass().getResourceAsStream(
+                "Index.xml");
 
         if (inIndex == null)
         {
@@ -150,8 +150,6 @@
         
         XMLInputSource xmlIndexSource = new XMLInputSource(inIndex,
                 new File(""));
-        
-        xmlIndexSource = new XMLInputSource(inIndex, new File(""));
         
         FsIndexDescription indexDesciptor;
         

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/action/CorporaCollectionReader.xml
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/action/CorporaCollectionReader.xml?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/action/CorporaCollectionReader.xml (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/action/CorporaCollectionReader.xml Fri Mar 30 11:08:15 2007
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <collectionReaderDescription  xmlns="http://uima.watson.ibm.com/resourceSpecifier">
-	<frameworkImplementation>com.ibm.uima.java</frameworkImplementation>
+	<frameworkImplementation>org.apache.uima.java</frameworkImplementation>
 	<implementationName>org.apache.uima.caseditor.uima.CorporaCollectionReader</implementationName>
 	<processingResourceMetaData>
 		<name>Corpora Collection Reader</name>

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/action/DummyTAE.xml
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/action/DummyTAE.xml?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/action/DummyTAE.xml (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/action/DummyTAE.xml Fri Mar 30 11:08:15 2007
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <taeDescription xmlns="http://uima.watson.ibm.com/resourceSpecifier">
-	<frameworkImplementation>com.ibm.uima.java</frameworkImplementation>
+	<frameworkImplementation>org.apache.uima.java</frameworkImplementation>
 	<primitive>true</primitive>
 	<annotatorImplementationName>org.apache.uima.caseditor.uima.DummyAnnotator</annotatorImplementationName>
 	<analysisEngineMetaData>

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/AnnotatorActionGroup.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/AnnotatorActionGroup.java?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/AnnotatorActionGroup.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/AnnotatorActionGroup.java Fri Mar 30 11:08:15 2007
@@ -27,8 +27,7 @@
 import org.apache.uima.caseditor.core.model.CorpusElement;
 import org.apache.uima.caseditor.core.model.DocumentElement;
 import org.apache.uima.caseditor.core.model.NlpProject;
-import org.apache.uima.caseditor.core.model.UimaConfigurationElement;
-import org.apache.uima.caseditor.core.model.UimaSourceFolder;
+import org.apache.uima.caseditor.core.model.CasProcessorFolder;
 import org.apache.uima.caseditor.core.uima.AnnotatorConfiguration;
 import org.apache.uima.caseditor.ui.action.AnnotatorActionRunnable;
 import org.apache.uima.caseditor.ui.action.RunnableAction;
@@ -41,106 +40,76 @@
 /**
  * This is an action group for annotator actions.
  */
-final class AnnotatorActionGroup extends ActionGroup
-{
-    private Shell mShell;
-    
-    /**
-     * Initializes a new instance with the given shell.
-     * 
-     * @param shell
-     */
-    AnnotatorActionGroup(Shell shell)
-    {
-        mShell = shell;
-    }
-    
-    /**
-     * Adds for each uima annotator an appropriate configured 
-     * <code>AnnotatorAction</code> to the given menu.
-     * 
-     * Note: The action appears only in the menu if a document or 
-     * corpus is selected.
-     * 
-     * @param menu - the context menu manager // hier auf listen ???
-     */
-    @Override
-    public void fillContextMenu(IMenuManager menu)
-    {
-        IStructuredSelection selection = (IStructuredSelection) getContext()
-                .getSelection();
-        
-        LinkedList<DocumentElement> documentElements = new LinkedList<DocumentElement>();
-        
-        if (!CorpusExplorerUtil
-                .isContaingNLPProjectOrNonNLPResources(selection))
-        {
-            Iterator resources = selection.iterator();
-            while (resources.hasNext())
-            {
-                Object resource = resources.next();
-                
-                if (resource instanceof CorpusElement)
-                {
-                    documentElements.addAll(((CorpusElement) resource)
-                            .getDocuments());
-                }
-                
-                if (resource instanceof DocumentElement)
-                {
-                    documentElements.add(((DocumentElement) resource));
-                }
-            }
+final class AnnotatorActionGroup extends ActionGroup {
+  private Shell mShell;
+
+  /**
+   * Initializes a new instance with the given shell.
+   * 
+   * @param shell
+   */
+  AnnotatorActionGroup(Shell shell) {
+    mShell = shell;
+  }
+
+  /**
+   * Adds for each uima annotator an appropriate configured <code>AnnotatorAction</code> to the
+   * given menu.
+   * 
+   * Note: The action appears only in the menu if a document or corpus is selected.
+   * 
+   * @param menu -
+   *          the context menu manager // hier auf listen ???
+   */
+  @Override
+  public void fillContextMenu(IMenuManager menu) {
+    IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
+
+    LinkedList<DocumentElement> documentElements = new LinkedList<DocumentElement>();
+
+    if (!CorpusExplorerUtil.isContaingNLPProjectOrNonNLPResources(selection)) {
+      Iterator resources = selection.iterator();
+      while (resources.hasNext()) {
+        Object resource = resources.next();
+
+        if (resource instanceof CorpusElement) {
+          documentElements.addAll(((CorpusElement) resource).getDocuments());
+        }
+
+        if (resource instanceof DocumentElement) {
+          documentElements.add(((DocumentElement) resource));
         }
-        
-        // TODO: refactor this
-        // how to retrive the project of the selected elements ?
-        // what happends if someone selectes DocumentElements form
-        // different projects ?
-        if (!documentElements.isEmpty())
-        {
-            DocumentElement aDocument = documentElements.getFirst();
-            
-            NlpProject project = aDocument.getNlpProject();
-            
-            Collection<UimaSourceFolder> sourceFolders = 
-                    project.getUimaSourceFolder();
-            
-            
-            for (UimaSourceFolder sourceFolder : sourceFolders)
-            {
-                Collection<UimaConfigurationElement> configElements = 
-                    sourceFolder.getUimaConfigurationElements();
-                
-                for (UimaConfigurationElement element : configElements)
-                {
-                    
-                    Collection<AnnotatorElement> annotators = element
-                            .getAnnotators();
-                    
-                    for (AnnotatorElement annotator : annotators)
-                    {
-                        AnnotatorConfiguration config = 
-                                annotator.getAnnotatorConfiguration();
-                        
-                        if (config != null)
-                        {
-                            IRunnableWithProgress annotatorRunnableAction = 
-                                    new AnnotatorActionRunnable(
-                                    config, documentElements);
-                            
-                            
-                            RunnableAction annotatorAction = 
-                                    new RunnableAction(mShell, 
-                                    annotator.getName(),
-                                    annotatorRunnableAction);
-                            
-                            
-                            menu.add(annotatorAction);
-                        }
-                    }
-                }
-            }
+      }
+    }
+
+    // TODO: refactor this
+    // how to retrive the project of the selected elements ?
+    // what happends if someone selectes DocumentElements form
+    // different projects ?
+    if (!documentElements.isEmpty()) {
+      DocumentElement aDocument = documentElements.getFirst();
+
+      NlpProject project = aDocument.getNlpProject();
+
+      Collection<CasProcessorFolder> sourceFolders = project.getCasProcessorFolders();
+
+      for (CasProcessorFolder sourceFolder : sourceFolders) {
+        Collection<AnnotatorElement> annotators = sourceFolder.getAnnotators();
+
+        for (AnnotatorElement annotator : annotators) {
+          AnnotatorConfiguration config = annotator.getAnnotatorConfiguration();
+
+          if (config != null) {
+            IRunnableWithProgress annotatorRunnableAction = new AnnotatorActionRunnable(config,
+                    documentElements);
+
+            RunnableAction annotatorAction = new RunnableAction(mShell, annotator.getName(),
+                    annotatorRunnableAction);
+
+            menu.add(annotatorAction);
+          }
         }
+      }
     }
+  }
 }

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/ConsumerCorpusActionGroup.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/ConsumerCorpusActionGroup.java?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/ConsumerCorpusActionGroup.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/ConsumerCorpusActionGroup.java Fri Mar 30 11:08:15 2007
@@ -23,11 +23,10 @@
 import java.util.Iterator;
 import java.util.LinkedList;
 
+import org.apache.uima.caseditor.core.model.CasProcessorFolder;
 import org.apache.uima.caseditor.core.model.ConsumerElement;
 import org.apache.uima.caseditor.core.model.CorpusElement;
 import org.apache.uima.caseditor.core.model.NlpProject;
-import org.apache.uima.caseditor.core.model.UimaConfigurationElement;
-import org.apache.uima.caseditor.core.model.UimaSourceFolder;
 import org.apache.uima.caseditor.core.uima.CasConsumerConfiguration;
 import org.apache.uima.caseditor.ui.action.ConsumerActionRunnable;
 import org.apache.uima.caseditor.ui.action.RunnableAction;
@@ -39,85 +38,60 @@
 /**
  * This is an action group for cas consumer actions.
  */
-final class ConsumerCorpusActionGroup extends ActionGroup
-{
-    private Shell mShell;
-    
-    ConsumerCorpusActionGroup(Shell shell)
-    {
-        mShell = shell;
-    }
-    /**
-     * Adds for each uima cas consumer an appropriate configured 
-     * <code>CasConsumerAction</code> to the given menu.
-     * The action apears only in the menu if a document or corpus is selected. 
-     */
-    @Override
-    public void fillContextMenu(IMenuManager menu)
-    {
-        IStructuredSelection selection = (IStructuredSelection) getContext()
-                .getSelection();
-
-        if (!CorpusExplorerUtil
-                .isContaingNLPProjectOrNonNLPResources(selection))
-        {
-            // TODO: add here also single documents
-            LinkedList<CorpusElement> corpora = new LinkedList<CorpusElement>();
-
-            
-            for (Iterator resources = selection.iterator();
-                    resources.hasNext();)
-            {
-                Object resource = resources.next();
-
-                if (resource instanceof CorpusElement)
-                {
-                    corpora.add((CorpusElement) resource);
-                }
-            }
+final class ConsumerCorpusActionGroup extends ActionGroup {
+  private Shell mShell;
+
+  ConsumerCorpusActionGroup(Shell shell) {
+    mShell = shell;
+  }
+
+  /**
+   * Adds for each uima cas consumer an appropriate configured <code>CasConsumerAction</code> to
+   * the given menu. The action apears only in the menu if a document or corpus is selected.
+   */
+  @Override
+  public void fillContextMenu(IMenuManager menu) {
+    IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
+
+    if (!CorpusExplorerUtil.isContaingNLPProjectOrNonNLPResources(selection)) {
+      // TODO: add here also single documents
+      LinkedList<CorpusElement> corpora = new LinkedList<CorpusElement>();
+
+      for (Iterator resources = selection.iterator(); resources.hasNext();) {
+        Object resource = resources.next();
+
+        if (resource instanceof CorpusElement) {
+          corpora.add((CorpusElement) resource);
+        }
+      }
+
+      // TODO: refactor this here
+      if (!corpora.isEmpty()) {
+        CorpusElement aCorpus = corpora.getFirst();
+        NlpProject project = aCorpus.getNlpProject();
+
+        Collection<CasProcessorFolder> sourceFolders = project.getCasProcessorFolders();
+
+        for (CasProcessorFolder sourceFolder : sourceFolders) {
+
+          Collection<ConsumerElement> consumers = sourceFolder.getConsumers();
+
+          for (ConsumerElement consumer : consumers) {
+            CasConsumerConfiguration config = consumer.getConsumerConfiguration();
+
+            if (config != null) {
+              ConsumerActionRunnable consumerRunnableAction = new ConsumerActionRunnable(config,
+                      corpora);
+
+              RunnableAction consumerAction = new RunnableAction(mShell, consumer.getName(),
+                      consumerRunnableAction);
+
+              menu.add(consumerAction);
 
-            // TODO: refactor this here
-            if (!corpora.isEmpty())
-            {
-                CorpusElement aCorpus = corpora.getFirst();
-                NlpProject project = aCorpus.getNlpProject();
-
-                Collection<UimaSourceFolder> sourceFolders = 
-                        project.getUimaSourceFolder();
-
-                for (UimaSourceFolder sourceFolder : sourceFolders)
-                {
-                    Collection<UimaConfigurationElement> configElements = 
-                            sourceFolder.getUimaConfigurationElements();
-
-                    for (UimaConfigurationElement element : configElements)
-                    {
-                        Collection<ConsumerElement> consumers = 
-                                element.getConsumers();
-                        
-                        for (ConsumerElement consumer : consumers)
-                        {
-                            CasConsumerConfiguration config = 
-                                    consumer.getConsumerConfiguration();
-                            
-                            if (config != null)
-                            {
-                                ConsumerActionRunnable consumerRunnableAction = 
-                                        new ConsumerActionRunnable(config, 
-                                        corpora);
-    
-                                RunnableAction consumerAction = 
-                                        new RunnableAction(mShell, 
-                                        consumer.getName(),
-                                        consumerRunnableAction);
-
-                                menu.add(consumerAction);
-                                
-                            }
-                        }
-                    }
-                }
             }
+          }
         }
+      }
     }
+  }
 }

Added: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/CopyAction.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/CopyAction.java?view=auto&rev=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/CopyAction.java (added)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/CopyAction.java Fri Mar 30 11:08:15 2007
@@ -0,0 +1,144 @@
+/*
+ * 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.ui.corpusview;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWTError;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.ui.part.ResourceTransfer;
+
+/**
+ * The CopyAction can copy IResources to the <code>clipboard</code>.
+ */
+final class CopyAction  extends ResourceAction {
+  
+  /**
+   * OS clipboard
+   */
+  private Clipboard mClipboard;
+
+  /**
+   * Initializes the current instance.
+   * 
+   * @param clipboard
+   */
+  public CopyAction(Clipboard clipboard) {
+    super("Copy");
+
+    if (clipboard == null) {
+        throw new IllegalArgumentException();
+    }
+    
+    mClipboard = clipboard;
+  }
+
+  /**
+   * Starts the copy process.
+   */
+  @Override
+  @SuppressWarnings("unchecked")
+  public void run() {
+    List<IResource> selectedResources = getSelectedResources();
+
+    List<String> fileNames = new LinkedList<String>();
+
+    List<IResource> resources = new LinkedList<IResource>();
+
+    for (IResource resource : selectedResources) {
+      IPath location = resource.getLocation();
+
+       if (location != null) {
+        resources.add(resource);
+
+        fileNames.add(location.toOSString());
+      }
+    }
+
+    IResource[] resourcesArray = resources.toArray(new IResource[resources.size()]);
+
+    String[] fileNamesArray = fileNames.toArray(new String[fileNames.size()]);
+
+    try {
+      mClipboard.setContents(new Object[] { resourcesArray, fileNamesArray }, new Transfer[] {
+          ResourceTransfer.getInstance(), FileTransfer.getInstance() });
+     } catch (SWTError e) {
+      if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) {
+        throw e;
+      }
+    }
+  }
+  
+  @Override
+  protected boolean updateSelection(IStructuredSelection selection) {
+    
+    boolean result;
+    
+    int nonResources = getStructuredSelection().size() - 
+        getSelectedResources().size();
+    
+    if (nonResources > 0) {
+      result = false;
+    }
+    else if (getSelectedResources().size() == 0) {
+      result = false;
+    }
+    // currenlty project copy is not supported
+    else if (selectionIsOfType(IResource.PROJECT)) {
+      return false;
+    }
+    else if (!selectionIsOfType(IResource.PROJECT) &&  
+            !selectionIsOfType(IResource.FILE | IResource.FOLDER)) {
+      result = false;
+    }
+    else if (!isAllHaveSameParent()) {
+      result = false;
+    }
+    else {
+      result = true;
+    }
+    
+    return result;
+  }
+  
+  @SuppressWarnings("unchecked")
+  private boolean isAllHaveSameParent() {
+    List<IResource> resources = getSelectedResources();
+    
+    assert resources.size() > 0;
+    
+    // search for non identical parent
+    IResource parent = resources.get(0).getParent();
+    for (IResource resource : resources) {
+      if (!resource.getParent().equals(parent)) {
+        return false;
+      }
+    }
+    
+    return true;
+  }
+}

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/CorpusExplorerActionGroup.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/CorpusExplorerActionGroup.java?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/CorpusExplorerActionGroup.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/CorpusExplorerActionGroup.java Fri Mar 30 11:08:15 2007
@@ -19,7 +19,6 @@
 
 package org.apache.uima.caseditor.ui.corpusview;
 
-
 import org.apache.uima.caseditor.core.model.INlpElement;
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.action.IMenuManager;
@@ -35,10 +34,8 @@
 import org.eclipse.ui.actions.ActionContext;
 import org.eclipse.ui.actions.ActionFactory;
 import org.eclipse.ui.actions.ActionGroup;
-import org.eclipse.ui.actions.ExportResourcesAction;
 import org.eclipse.ui.actions.ImportResourcesAction;
 import org.eclipse.ui.dialogs.PropertyDialogAction;
-import org.eclipse.ui.ide.IDEActionFactory;
 
 /**
  * Main corpus explorer action group.
@@ -52,7 +49,7 @@
     
     protected ImportResourcesAction mImportAction;
     
-    protected ExportResourcesAction mExportAction;
+//    protected ExportResourcesAction mExportAction;
     
     private WorkspaceActionGroup mWorkspaceGroup;
     
@@ -84,9 +81,9 @@
         
         mImportAction = new ImportResourcesAction(mWindow);
         
-        mExportAction = new ExportResourcesAction(mWindow);
+//        mExportAction = new ExportResourcesAction(mWindow);
         
-        mWorkspaceGroup = new WorkspaceActionGroup(shell, mWindow);
+       mWorkspaceGroup = new WorkspaceActionGroup(shell, mWindow);
         
         mAnnotatorActionGroup = new AnnotatorActionGroup(shell);
         
@@ -110,7 +107,9 @@
         // For action order see "Eclipse User Interface Guidelines"
         
         // 1. New actions
-        menu.add(IDEActionFactory.NEW_WIZARD_DROP_DOWN.create(mWindow));
+        IAction newAction = ActionFactory.NEW.create(mWindow);
+        newAction.setText("New");
+        menu.add(newAction);
         menu.add(new Separator());
         
         // 2. Open actions
@@ -126,7 +125,7 @@
         // 4.2
         menu.add(ActionFactory.IMPORT.create(mWindow));
         
-        menu.add(ActionFactory.EXPORT.create(mWindow));
+//        menu.add(ActionFactory.EXPORT.create(mWindow));
         
         menu.add(new Separator());
         
@@ -198,8 +197,8 @@
         super.setContext(context);
         
         mOpenActionGroup.setContext(context);
-        mRefactorGroup.setContext(context);
-        mWorkspaceGroup.setContext(context);
+       mRefactorGroup.setContext(context);
+       mWorkspaceGroup.setContext(context);
         mAnnotatorActionGroup.setContext(context);
         mConsumerCorpusActionGroup.setContext(context);
     }
@@ -209,15 +208,13 @@
      */
     public void executeDefaultAction(IStructuredSelection selection)
     {
-        if (selection.getFirstElement() instanceof INlpElement)
-        {
+        if (selection.getFirstElement() instanceof INlpElement) {
             INlpElement nlpElement = (INlpElement) selection.getFirstElement();
             
             mOpenActionGroup.executeDefaultAction(new StructuredSelection(
                     nlpElement.getResource()));
         }
-        else
-        {
+        else {
             mOpenActionGroup.executeDefaultAction(selection);
         }
     }
@@ -233,7 +230,7 @@
         mOpenActionGroup.dispose();
         mRefactorGroup.dispose();
         mImportAction.dispose();
-        mExportAction.dispose();
+//        mExportAction.dispose();
         mWorkspaceGroup.dispose();
         mAnnotatorActionGroup.dispose();
         mConsumerCorpusActionGroup.dispose();

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/CorpusExplorerView.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/CorpusExplorerView.java?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/CorpusExplorerView.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/CorpusExplorerView.java Fri Mar 30 11:08:15 2007
@@ -34,18 +34,14 @@
 import org.eclipse.jface.viewers.SelectionChangedEvent;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.Transfer;
 import org.eclipse.swt.layout.FillLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Menu;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.actions.ActionContext;
+import org.eclipse.ui.model.BaseWorkbenchContentProvider;
 import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.part.PluginTransfer;
-import org.eclipse.ui.part.ResourceTransfer;
 import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.views.navigator.LocalSelectionTransfer;
 
 /**
  * The corpus explorer is a view which knows how to display and handle the nlp
@@ -74,14 +70,14 @@
         parent.setLayout(new FillLayout());
         
         mTreeViewer = new TreeViewer(parent);
-        mTreeViewer.setContentProvider(new CorpusExplorerContentProvider());
+        mTreeViewer.setContentProvider(new BaseWorkbenchContentProvider());
         
         mTreeViewer.setLabelProvider(new DecoratingLabelProvider(
                 new WorkbenchLabelProvider(), PlatformUI.getWorkbench()
                         .getDecoratorManager().getLabelDecorator()));
         
         // performence optimization
-        mTreeViewer.setUseHashlookup(false); // TODO: change back to true
+        mTreeViewer.setUseHashlookup(true); // TODO: change back to true
         
         initContextMenu();
         
@@ -184,9 +180,9 @@
     {
         int ops = DND.DROP_COPY | DND.DROP_MOVE;
         
-        Transfer[] transfers = new Transfer[]
-        { LocalSelectionTransfer.getInstance(), ResourceTransfer.getInstance(),
-                FileTransfer.getInstance(), PluginTransfer.getInstance() };
+        //Transfer[] transfers = new Transfer[]
+        //{ LocalSelectionTransfer.getInstance(), ResourceTransfer.getInstance(),
+        //        FileTransfer.getInstance(), PluginTransfer.getInstance() };
         
         //mTreeViewer
         //        .addDragSupport(ops, transfers, new CorpusExplorerDragAdapter(

Modified: incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/ModelChangeListener.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/ModelChangeListener.java?view=diff&rev=524212&r1=524211&r2=524212
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/ModelChangeListener.java (original)
+++ incubator/uima/sandbox/trunk/CasEditor/src/main/java/org/apache/uima/caseditor/ui/corpusview/ModelChangeListener.java Fri Mar 30 11:08:15 2007
@@ -60,14 +60,17 @@
         
         // INlpElementDelta childs[] = delta.getAffectedChildren();
         
-        
         INlpModelDeltaVisitor visitor = new INlpModelDeltaVisitor()
         {
             public boolean visit(INlpElementDelta delta)
             {
+              if (delta.getResource().getName().equals(".corpus")) {
+                return true;
+              }
+              
                 //if (delta.getKind() == IResourceDelta.OPEN
-                //        || delta.getKind() == IResourceDelta.CONTENT)
-                
+                //        || delta.getKind() == IResourceDelta.CONTENT)                
+             
                 if(delta.getKind().equals(Kind.CHANGED))
                 {
                     if (delta.isNlpElement())