You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by sc...@apache.org on 2008/07/02 16:46:38 UTC

svn commit: r673409 [5/10] - in /incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src: ./ main/ main/java/ main/java/org/ main/java/org/apache/ main/java/org/apache/uima/ main/java/org/apache/uima/casviewer/ main/java/org/apa...

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/CasViewerSourceViewerConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/CasViewerSourceViewerConfiguration.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/CasViewerSourceViewerConfiguration.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/CasViewerSourceViewerConfiguration.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,194 @@
+package org.apache.uima.casviewer.ui.internal.document;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.uima.casviewer.ui.internal.hover.AnnotationHover;
+import org.apache.uima.casviewer.ui.internal.style.TypeSystemStyle;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.ITextHover;
+import org.eclipse.jface.text.contentassist.ContentAssistant;
+import org.eclipse.jface.text.contentassist.IContentAssistant;
+import org.eclipse.jface.text.information.IInformationPresenter;
+import org.eclipse.jface.text.presentation.IPresentationReconciler;
+import org.eclipse.jface.text.presentation.PresentationReconciler;
+import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
+import org.eclipse.jface.text.source.DefaultAnnotationHover;
+import org.eclipse.jface.text.source.IAnnotationHover;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+
+public class CasViewerSourceViewerConfiguration extends SourceViewerConfiguration 
+{
+    protected TypeSystemStyle       typeSystemStyle;
+    
+    protected AnnotationHover fTextHover;
+
+    public CasViewerSourceViewerConfiguration(TypeSystemStyle tsStyle) {
+        super();
+        if (tsStyle != null) {
+            typeSystemStyle = tsStyle;
+        }
+    }
+    
+    public void setTypeSystemStyle (TypeSystemStyle tsStyle) {
+        typeSystemStyle = tsStyle;
+    }
+    
+    public IContentAssistant getContentAssistant_(ISourceViewer sourceViewer) {
+
+        ContentAssistant assistant= new ContentAssistant();
+//        assistant.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
+//        assistant.setContentAssistProcessor(new JavaCompletionProcessor(), IDocument.DEFAULT_CONTENT_TYPE);
+//
+//
+//        assistant.enableAutoActivation(true);
+//        assistant.setAutoActivationDelay(500);
+//        assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
+//        assistant.setContextInformationPopupOrientation(IContentAssistant.CONTEXT_INFO_ABOVE);
+//        assistant.setContextInformationPopupBackground(getJavaColorProvider().getColor(new RGB(150, 150, 0)));
+
+        return assistant;
+    }
+    
+
+    /**
+     * This is the Hover support for text in editor area.
+     * see JavaTextHover for Java editor example or see "JavaSourceHover" for JDT Java editor
+     * 
+     * see HTMLTextPresenter, DefaultInformationControl
+     * TextSourceViewerConfiguration, DefaultAnnotationHover
+     */
+    
+    public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
+        if (fTextHover == null) {
+            fTextHover = new AnnotationHover(sourceViewer, typeSystemStyle);
+        }
+        return fTextHover;
+    }
+    
+    public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
+        // Trace.trace();
+        return new DefaultAnnotationHover() {
+            /**
+             * Hook method to formats the given messages.
+             * <p>
+             * Subclasses can change this to create a different
+             * format like HTML.
+             * </p>
+             * 
+             * @param messages the messages to format 
+             * @return the formatted message
+             */
+            protected String formatMultipleMessages(List messages, int lineNumber) {
+                StringBuffer buffer= new StringBuffer();
+                buffer.append("Multiple annotations at line#" + lineNumber); //$NON-NLS-1$
+                
+                Iterator e= messages.iterator();
+                while (e.hasNext()) {
+                    buffer.append('\n');
+                    String listItemText= (String) e.next();
+                    buffer.append(listItemText); //$NON-NLS-1$
+                }
+                return buffer.toString();
+            }
+        };
+    }
+    
+    public IAnnotationHover getOverviewRulerAnnotationHover(ISourceViewer sourceViewer) {
+        return new DefaultAnnotationHover() {
+            /**
+             * Hook method to formats the given messages.
+             * <p>
+             * Subclasses can change this to create a different
+             * format like HTML.
+             * </p>
+             * 
+             * @param messages the messages to format 
+             * @return the formatted message
+             */
+            protected String formatMultipleMessages(List messages, int lineNumber) {
+                StringBuffer buffer= new StringBuffer();
+                buffer.append("Multiple annotations at line#" + lineNumber); //$NON-NLS-1$
+                
+                Iterator e= messages.iterator();
+                while (e.hasNext()) {
+                    buffer.append('\n');
+                    String listItemText= (String) e.next();
+                    buffer.append(listItemText); //$NON-NLS-1$
+                }
+                return buffer.toString();
+            }
+        };
+    }
+    
+    /**
+     * Returns the presentation reconciler ready to be used with the given source viewer.
+     * This implementation always returns <code>null</code>.
+     *
+     * @param sourceViewer the source viewer
+     * @return the presentation reconciler or <code>null</code> if presentation reconciling should not be supported
+     */
+    public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
+        PresentationReconciler reconciler= new PresentationReconciler();
+        DefaultDamagerRepairer dr = new DefaultDamagerRepairer (new AnnotationScanner());
+        reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
+        reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
+
+        return reconciler;
+//        return null;
+    }
+    
+
+    /**
+     * Returns the type system presenter control creator. The creator is a factory creating
+     * type system presenter controls for the given source viewer. 
+     * This implementation always returns a creator
+     * for <code>TypeSystemInfoControl</code> instances.
+     *
+     * @param sourceViewer the source viewer to be configured by this configuration
+     * @param commandId the ID of the command that opens this control
+     * @return an information control creator
+     */
+//    private IInformationControlCreator getTypeSystemPresenterControlCreator(final ISourceViewer sourceViewer, final String commandId) {
+//        return new IInformationControlCreator() {
+//            public IInformationControl createInformationControl(Shell parent) 
+//            {
+//                if (sourceViewer == null) {
+//                    Trace.trace("sourceViewer == null");
+//                } else {
+//                    Trace.trace("sourceViewer != null");
+//                }
+//                // Trace.err();
+//                int shellStyle= SWT.RESIZE;
+//                int treeStyle= SWT.V_SCROLL | SWT.H_SCROLL;
+//                return new TypeSystemInfoControl(sourceViewer, parent, shellStyle, treeStyle, commandId);
+//            }
+//        };
+//    }
+
+    /**
+     * Returns the type system presenter which will determine and shown
+     * information requested for the current cursor position.
+     *
+     * @param sourceViewer the source viewer to be configured by this configuration
+     * @return an information presenter
+     * 
+     * Called from CASSourceViewer.configure
+     */
+    public IInformationPresenter getTypeSystemPresenter(final ISourceViewer sourceViewer) {
+//        Trace.trace();
+//        InformationPresenter presenter;
+//        presenter= new InformationPresenter(getTypeSystemPresenterControlCreator(sourceViewer, IJavaEditorActionDefinitionIds.SHOW_OUTLINE));
+//        presenter.setDocumentPartitioning(getConfiguredDocumentPartitioning(sourceViewer));
+//        presenter.setAnchor(AbstractInformationControlManager.ANCHOR_BOTTOM);
+//        
+//        IInformationProvider provider= new TypeSystemProvider ((ICASSourceViewer) sourceViewer);
+//        presenter.setInformationProvider(provider, IDocument.DEFAULT_CONTENT_TYPE);
+//        presenter.setSizeConstraints(50, 20, true, false);
+//        return presenter;
+        return null;
+    }
+
+    
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/CasViewerSourceViewerConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/ColorProvider.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/ColorProvider.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/ColorProvider.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/ColorProvider.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,43 @@
+package org.apache.uima.casviewer.ui.internal.document;
+
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * Manager for colors used in the CAS Viewer
+ */
+public class ColorProvider {
+
+	protected Map fColorTable= new HashMap(10);
+
+	/**
+	 * Release all of the color resources held onto by the receiver.
+	 */	
+	public void dispose() {
+		Iterator e= fColorTable.values().iterator();
+		while (e.hasNext())
+			 ((Color) e.next()).dispose();
+	}
+	
+	/**
+	 * Return the color that is stored in the color table under the given RGB
+	 * value.
+	 * 
+	 * @param rgb the RGB value
+	 * @return the color stored in the color table for the given RGB value
+	 */
+	public Color getColor(RGB rgb) {
+		Color color= (Color) fColorTable.get(rgb);
+		if (color == null) {
+			color= new Color(Display.getCurrent(), rgb);
+			fColorTable.put(rgb, color);
+		}
+		return color;
+	}
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/ColorProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/CustomSourceViewerDecorationSupport.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/CustomSourceViewerDecorationSupport.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/CustomSourceViewerDecorationSupport.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/CustomSourceViewerDecorationSupport.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,28 @@
+package org.apache.uima.casviewer.ui.internal.document;
+
+import org.apache.uima.tools.debug.util.Trace;
+import org.eclipse.jface.text.source.AnnotationPainter;
+import org.eclipse.jface.text.source.IAnnotationAccess;
+import org.eclipse.jface.text.source.IOverviewRuler;
+import org.eclipse.jface.text.source.ISharedTextColors;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;
+
+public class CustomSourceViewerDecorationSupport extends
+		SourceViewerDecorationSupport {
+
+	public CustomSourceViewerDecorationSupport(ISourceViewer sourceViewer, IOverviewRuler overviewRuler, IAnnotationAccess annotationAccess, ISharedTextColors sharedTextColors) {
+		super(sourceViewer,overviewRuler,annotationAccess,sharedTextColors);
+	}
+	
+	protected AnnotationPainter createAnnotationPainter() {
+        Trace.trace();
+		AnnotationPainter painter = super.createAnnotationPainter();
+
+//		painter.addAnnotationType("annotationperformance.wordHighlight",AnnotationPreference.STYLE_BOX);
+//		painter.setAnnotationTypeColor("annotationperformance.wordHighlight", new Color(null,255,0,0));
+
+		return painter;
+	}
+
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/CustomSourceViewerDecorationSupport.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/ICASSourceViewer.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/ICASSourceViewer.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/ICASSourceViewer.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/ICASSourceViewer.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,20 @@
+package org.apache.uima.casviewer.ui.internal.document;
+
+import org.apache.uima.casviewer.core.internal.ICASObjectView;
+import org.eclipse.jface.text.source.ISourceViewer;
+
+
+/**
+ *  Provide the information source for:
+ *      - TypeSystemProvider to get the current type system
+ *
+ */
+public interface ICASSourceViewer extends ISourceViewer {
+    
+    public ICASObjectView  getCASView ();
+    public void     setCASView (ICASObjectView aCASView);
+    
+    public Object   getTypeSystem ();
+    public void     setTypeSystem (Object typesystem);
+
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/ICASSourceViewer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/IVisualDecoration.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/IVisualDecoration.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/IVisualDecoration.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/IVisualDecoration.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,15 @@
+package org.apache.uima.casviewer.ui.internal.document;
+
+public interface IVisualDecoration {
+    
+    /**
+     * @return the uimaTypeName
+     */
+    public String getUimaTypeName();
+
+    /**
+     * @param uimaTypeName the uimaTypeName to set
+     */
+    public void setUimaTypeName(String uimaTypeName);
+
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/IVisualDecoration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/VisualDecoration.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/VisualDecoration.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/VisualDecoration.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/VisualDecoration.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,39 @@
+package org.apache.uima.casviewer.ui.internal.document;
+
+import org.eclipse.jface.text.source.Annotation;
+
+public class VisualDecoration extends Annotation implements IVisualDecoration {
+    
+    protected int casDiffStatus = 0;    // AnnotationObject.DIFF_STATUS_ADDED, ...
+    
+    protected String uimaTypeName;      // Type name from UIMA
+
+    public VisualDecoration() {
+    }
+
+    public VisualDecoration(boolean isPersistent) {
+        super(isPersistent);
+    }
+
+    public VisualDecoration(String type, boolean isPersistent, String text,
+            String uimaTypeName) {
+        super(type, isPersistent, text);
+        this.uimaTypeName = uimaTypeName;
+    }
+
+    /**
+     * @return the uimaTypeName
+     */
+    public String getUimaTypeName() {
+        return uimaTypeName;
+    }
+
+    /**
+     * @param uimaTypeName the uimaTypeName to set
+     */
+    public void setUimaTypeName(String uimaTypeName) {
+        this.uimaTypeName = uimaTypeName;
+    }
+
+
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/document/VisualDecoration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/AnnotationHover.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/AnnotationHover.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/AnnotationHover.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/AnnotationHover.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,174 @@
+package org.apache.uima.casviewer.ui.internal.hover;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.uima.casviewer.ui.internal.document.IVisualDecoration;
+import org.apache.uima.casviewer.ui.internal.style.TypeSystemStyle;
+import org.apache.uima.tools.debug.util.Trace;
+import org.eclipse.jface.text.IInformationControl;
+import org.eclipse.jface.text.IInformationControlCreator;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextHover;
+import org.eclipse.jface.text.ITextHoverExtension;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseTrackListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+
+// see InformationDispatchAction on how to make Hover focusable
+public class AnnotationHover implements ITextHoverExtension, ITextHover {
+  
+  final static int  MAX_LINE_LENGTH = 80;
+  final static int  LINE_LENGTH_BEFORE = 38;
+  final static int  LINE_LENGTH_AFTER  = 38;
+
+  private ISourceViewer fSourceViewer;
+  protected TypeSystemStyle       typeSystemStyle;
+
+  public AnnotationHover(ISourceViewer sourceViewer, TypeSystemStyle tsStyle) {
+    fSourceViewer = sourceViewer;
+    typeSystemStyle = tsStyle;
+  }
+
+  public IInformationControlCreator getHoverControlCreator() {
+    return getInformationControlCreator();
+  }
+
+  public String getHoverInfo(ITextViewer textViewer, IRegion hoverRegion) {
+    IAnnotationModel model = fSourceViewer.getAnnotationModel();
+    if (model == null) {
+      Trace.err("No annotation model");
+      return null;
+    }
+    
+    // Find all annotations inside hoverRegion
+    // Trace.err(hoverRegion.getOffset() + " " + hoverRegion.getLength());
+    Iterator e = model.getAnnotationIterator();
+    List list = new ArrayList();
+    while (e.hasNext()) {
+      Annotation a = (Annotation) e.next();
+      Position p = model.getPosition(a);
+      // Trace.err(a.getText() + " type:" + a.getType() + " offset:" + p.offset + " lenght:" + p.length);
+      if (p != null && p.overlapsWith(hoverRegion.getOffset(), hoverRegion.getLength())) {
+        String t = a.getText();
+        if (t != null && t.trim().length() > 0) {
+          list.add(a);
+        }
+      }
+    }
+    
+    // Sort list of annotations
+    if (list.size() > 0) {
+        Collections.sort(list, new MyComparator());
+        Annotation a;
+        String msg = "";
+        for (int i=0; i<list.size(); ++i) {
+            a = (Annotation) list.get(i);
+            String t = a.getText();
+            t = t.replace("\n", " "); // need to handle splitted text of annotation
+            if (t.length() > MAX_LINE_LENGTH) {
+                t = t.substring(0, LINE_LENGTH_BEFORE) + " ... " 
+                + t.substring(t.length() - LINE_LENGTH_AFTER);
+            }
+            // msg += "<li>[<b>" + a.getType() + "</b>] " + t + "</li>"; 
+            if (a instanceof IVisualDecoration) {
+                msg += "[" + ((IVisualDecoration)a).getUimaTypeName() + "]" + t + "\n"; 
+            } else {
+                msg += "[" + a.getType() + "]" + t + "\n";       
+            }
+        }
+        return msg;
+    }
+    
+    return null;
+  }
+    
+  public static class MyComparator implements Comparator {
+
+    public int compare(Object o1, Object o2) {
+        if ( ((Annotation)o1).getText().length() < ((Annotation)o2).getText().length() ) {
+            return -1;
+        } else if ( ((Annotation)o1).getText().length() > ((Annotation)o2).getText().length() ) {
+            return 1;
+        } else {
+            return 0;
+        }
+    }
+  }
+
+  public IRegion getHoverRegion(ITextViewer textViewer, int offset) {
+    return new Region(offset, 0);
+  }
+
+  /***************************************************************************/
+
+
+  public IInformationControlCreator getInformationControlCreator() {
+    // Trace.err("getInformationControlCreator");
+    return new IInformationControlCreator() {
+      public IInformationControl createInformationControl(Shell parent) {
+        // Trace.err("createInformationControl");
+        return new CasViewerInformationControl(parent, SWT.TOOL | SWT.NO_TRIM, 
+                        0, typeSystemStyle); 
+      }
+    };
+  }
+
+  /**
+   * @param infoControl
+   * @param control
+   * @param provider
+   */
+  public static void addHoverListenerToControl(
+          final IInformationControl infoControl, final Control control,
+          final IControlHoverContentProvider provider) {
+
+    control.addMouseTrackListener(new MouseTrackListener() {
+      public void mouseEnter(MouseEvent e) {
+      }
+      public void mouseExit(MouseEvent e) {
+        if (infoControl instanceof CasViewerInformationControl && ((CasViewerInformationControl)infoControl).isDisposed())
+          return;
+        infoControl.setVisible(false);
+      }
+      public void mouseHover(MouseEvent e) {
+        if (infoControl instanceof CasViewerInformationControl && ((CasViewerInformationControl)infoControl).isDisposed())
+          return;
+        String text = provider.getHoverContent(control);
+        if (text == null || text.trim().length() == 0)
+          return;
+        updateHover(infoControl, text);
+        infoControl.setLocation(control.toDisplay(new Point(10, 25)));
+        infoControl.setVisible(true);
+      }
+    });
+  }
+
+  /**
+   * @param infoControl
+   * @param text
+   */
+  public static void updateHover(IInformationControl infoControl, String text) {
+    infoControl.setInformation(text);
+    Point p = infoControl.computeSizeHint();
+    infoControl.setSize(p.x, p.y);
+    if (text == null || text.trim().length() == 0)
+      infoControl.setVisible(false);
+  }
+
+
+
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/AnnotationHover.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/CasViewerDefaultInformationControl.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/CasViewerDefaultInformationControl.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/CasViewerDefaultInformationControl.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/CasViewerDefaultInformationControl.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,26 @@
+package org.apache.uima.casviewer.ui.internal.hover;
+
+import org.eclipse.jface.text.DefaultInformationControl;
+import org.eclipse.swt.widgets.Shell;
+
+public class CasViewerDefaultInformationControl extends DefaultInformationControl {
+
+    private boolean fDisposed = false;
+    
+    public CasViewerDefaultInformationControl(Shell parent, int style, IInformationPresenter presenter, String statusFieldText) {
+        super(parent, style, presenter, statusFieldText);
+    }
+    
+    /*
+     * @see IInformationControl#dispose()
+     */
+    public void dispose() {
+        fDisposed = true;
+        super.dispose();
+    }
+    
+    public boolean isDisposed() {
+        return fDisposed;
+    }
+
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/CasViewerDefaultInformationControl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/CasViewerInformationControl.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/CasViewerInformationControl.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/CasViewerInformationControl.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/CasViewerInformationControl.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,219 @@
+package org.apache.uima.casviewer.ui.internal.hover;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.uima.casviewer.ui.internal.style.TypeStyle;
+import org.apache.uima.casviewer.ui.internal.style.TypeSystemStyle;
+import org.apache.uima.tools.debug.util.Trace;
+import org.eclipse.jface.dialogs.PopupDialog;
+import org.eclipse.jface.text.IInformationControl;
+import org.eclipse.jface.text.IInformationControlExtension2;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+
+
+public class CasViewerInformationControl extends PopupDialog implements IInformationControl,
+        IInformationControlExtension2 {
+    private static final int INNER_BORDER = 1;
+
+  private Font boldTextFont;
+
+  private String hoverText;
+  
+  protected TypeSystemStyle       typeSystemStyle;
+  
+  private StyledText styledText;
+
+  /** ********************************************************************** */
+
+  public CasViewerInformationControl(Shell parent, int shellStyle, int treeStyle,
+              TypeSystemStyle tsStyle) {
+    this(parent, shellStyle, treeStyle, null, false);
+    typeSystemStyle = tsStyle;
+  }
+
+  public CasViewerInformationControl(Shell parent, int shellStyle, int treeStyle,
+          String invokingCommandId, boolean showStatusField) {
+    super(parent, shellStyle | SWT.NO_FOCUS | SWT.ON_TOP, false, false, false, false, null,
+            null /*"Info Area"*/);
+    create();
+  }
+
+  public boolean isDisposed() {
+      return getShell().isDisposed();
+  }
+
+  public void setVisible(boolean visible) {
+
+    if (visible) {
+        if (styledText.getWordWrap()) {
+            Point currentSize= getShell().getSize();
+            getShell().pack(true);
+            Point newSize= getShell().getSize();
+            if (newSize.x > currentSize.x || newSize.y > currentSize.y)
+                setSize(currentSize.x, currentSize.y); // restore previous size
+        }
+      open();
+    } else {
+      saveDialogBounds(getShell());
+      getShell().setVisible(false);
+    }
+  }
+
+  /** ********************************************************************** */
+
+  public void addDisposeListener(DisposeListener listener) {
+    // TODO Auto-generated method stub
+
+  }
+
+  public void addFocusListener(FocusListener listener) {
+    // TODO Auto-generated method stub
+
+  }
+
+  public Point computeSizeHint() {
+    int widthHint = 400; // SWT.DEFAULT;
+
+    if (getShell() != null) {
+      Point pt = getShell().computeSize(widthHint, SWT.DEFAULT, true);
+      pt.y += 10;
+      return pt;
+    } else {
+      return new Point(400, 200);
+    }
+  }
+
+  public void dispose() {
+    if (boldTextFont != null) {
+      boldTextFont.dispose();
+    }
+  }
+
+  public boolean isFocusControl() {
+    Trace.err();
+    return false;
+  }
+
+  public void removeDisposeListener(DisposeListener listener) {
+    // TODO Auto-generated method stub
+
+  }
+
+  public void removeFocusListener(FocusListener listener) {
+    // TODO Auto-generated method stub
+
+  }
+
+  public void setBackgroundColor(Color background) {
+    // TODO Auto-generated method stub
+
+  }
+
+  public void setFocus() {
+    // TODO Auto-generated method stub
+
+  }
+
+  public void setForegroundColor(Color foreground) {
+    // TODO Auto-generated method stub
+
+  }
+
+  public void setInformation(String information) {
+    // hoverText = information;
+    // formText.setText(information, true, false);
+  }
+
+  public void setLocation(Point location) {
+    // Trace.err(location.toString());
+    getShell().setLocation(location);
+  }
+
+  public void setSize(int width, int height) {
+    getShell().setSize(width, height);
+    // Trace.err("width: " + width + " height:" + height);
+  }
+
+  public void setSizeConstraints(int maxWidth, int maxHeight) {
+  }
+
+  public void setInput (Object input) {
+      // Trace.err();
+      StringBuffer buf = new StringBuffer();
+      if (input != null) {
+        if (input instanceof String) {          
+          HoverInfoReader reader = new HoverInfoReader((String) input);
+          HoverInfo hover;
+          List list = new ArrayList(3);
+          int offset = 0;
+          int length;
+          while ( (hover = reader.getAnnotationHover()) != null ) {
+              TypeStyle style = typeSystemStyle.getTypeStyle(hover.type);
+              int typeLength = style.getTypeShortName().length();
+              buf.append("[" + style.getTypeShortName() + "] "
+                      + hover.span + "\n");
+              length = typeLength + hover.span.length() + 4;
+              
+              list.add(new StyleRange(offset+1, typeLength, 
+                      TypeSystemStyle.SYSTEM_COLOR_BLACK, TypeSystemStyle.SYSTEM_COLOR_WHITE,
+                      SWT.BOLD));
+
+              list.add(new StyleRange(offset + typeLength + 3, 
+                      length - typeLength - 3, 
+                      style.getForeground(), style.getBackground()));
+              offset += length;
+          }
+          styledText.setText(buf.toString());   
+          styledText.setStyleRanges((StyleRange[]) list.toArray(new StyleRange[list.size()]));
+        }
+      }
+    }
+  
+  public static Font createBoldFont(Display display, Font regularFont) {
+    FontData[] fontDatas = regularFont.getFontData();
+    for (int i = 0; i < fontDatas.length; i++) {
+      fontDatas[i].setStyle(fontDatas[i].getStyle() | SWT.BOLD);
+    }
+    return new Font(display, fontDatas);
+  }
+
+  /** ********************************************************************** */
+
+  protected Control createDialogArea(Composite parent) {
+      parent.setLayout(new GridLayout());
+      styledText = new StyledText(parent, SWT.WRAP | SWT.READ_ONLY);
+      GridData gd = new GridData(GridData.BEGINNING | GridData.FILL_BOTH);
+      gd.horizontalIndent = INNER_BORDER;
+      gd.verticalIndent = INNER_BORDER;
+      styledText.setLayoutData(gd);
+      styledText.addKeyListener(new KeyListener() {
+
+        public void keyPressed(KeyEvent e) {
+          if (e.character == 0x1B) // ESC
+            close();
+        }
+
+        public void keyReleased(KeyEvent e) {
+        }
+      });
+      return styledText;
+  }
+
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/CasViewerInformationControl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/HoverInfo.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/HoverInfo.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/HoverInfo.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/HoverInfo.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,13 @@
+package org.apache.uima.casviewer.ui.internal.hover;
+
+public class HoverInfo {
+
+    public String type;
+    public String span;
+    
+    public HoverInfo(String type, String span) {
+        this.type = type;
+        this.span = span;
+    }
+
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/HoverInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/HoverInfoReader.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/HoverInfoReader.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/HoverInfoReader.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/HoverInfoReader.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,52 @@
+package org.apache.uima.casviewer.ui.internal.hover;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
+
+import org.apache.uima.tools.debug.util.Trace;
+
+public class HoverInfoReader {
+    
+    protected String inputText;
+    
+    protected BufferedReader reader;
+
+    public HoverInfoReader(String info) {
+        reader = new BufferedReader(new StringReader(info));
+        inputText = info;
+    }
+    
+    /**
+     * Each annotation is always started with [type_name].
+     * 
+     * @return
+     * @throws IOException
+     * @return String
+     */
+    private String getLine () throws IOException  {
+        return reader.readLine();
+    }
+    
+    public HoverInfo getAnnotationHover () {
+        String line;
+        try {
+            line = getLine();
+        } catch (IOException e) {
+            e.printStackTrace();
+            return null;
+        }
+        if (line == null || (line.trim().length() == 0)) {
+            return null;            
+        }
+        
+        // Get type and span
+//         String type = line.substring(1, line.indexOf(']'));
+//         String span = line.substring(type.length()+2);
+//         Trace.err("Type:" + type + " -> " + span);
+//         Trace.err("|"+ line + "|");
+        return new HoverInfo(line.substring(1, line.indexOf(']')), 
+                    line.substring(line.indexOf(']')+1));
+    }
+
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/HoverInfoReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/HoverManager.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/HoverManager.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/HoverManager.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/HoverManager.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,32 @@
+package org.apache.uima.casviewer.ui.internal.hover;
+
+import org.eclipse.jface.text.AbstractHoverInformationControlManager;
+import org.eclipse.jface.text.IInformationControlCreator;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.TreeItem;
+
+public class HoverManager extends AbstractHoverInformationControlManager {
+
+  private TreeViewer viewer;
+
+  public HoverManager(TreeViewer viewer, IInformationControlCreator creator) {
+    super(creator);
+    this.viewer = viewer;
+  }
+
+  @Override
+  protected void computeInformation() {
+    Point pt = getHoverEventLocation();
+    // Trace.err("x: " + pt.x + " y: " + pt.y);
+    TreeItem item = viewer.getTree().getItem(pt);
+    if (item != null) {
+      // Trace.err("Hover");
+      setInformation(item, item.getBounds());
+    } else {
+      // Trace.err("NOT Hover");
+      setInformation(null, null);
+    }
+  }
+
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/HoverManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/IControlHoverContentProvider.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/IControlHoverContentProvider.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/IControlHoverContentProvider.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/IControlHoverContentProvider.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,18 @@
+package org.apache.uima.casviewer.ui.internal.hover;
+
+import org.eclipse.swt.widgets.Control;
+
+
+/**
+ * IControlHoverContentProvider
+ *
+ */
+public interface IControlHoverContentProvider {
+
+    /**
+     * @param control
+     * @return
+     */
+    public String getHoverContent(Control control);
+    
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/IControlHoverContentProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/KeyValuePair.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/KeyValuePair.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/KeyValuePair.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/KeyValuePair.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,83 @@
+package org.apache.uima.casviewer.ui.internal.hover;
+
+public class KeyValuePair {
+  
+  protected Object parent;
+
+  protected String label;
+
+  protected String key;
+  
+  protected Object value;
+  
+  public KeyValuePair (String key, Object value) {
+    this.parent = parent;
+    this.label = label;
+    this.key = key;
+    this.value = value;
+  }
+
+  public KeyValuePair (String key, Object value, Object parent, String label) {
+    this.parent = parent;
+    this.label = label;
+    this.key = key;
+    this.value = value;
+  }
+
+  /**
+   * @return the key
+   */
+  public String getKey() {
+    return key;
+  }
+
+  /**
+   * @param key the key to set
+   */
+  public void setKey(String key) {
+    this.key = key;
+  }
+
+  /**
+   * @return the label
+   */
+  public String getLabel() {
+    return label;
+  }
+
+  /**
+   * @param label the label to set
+   */
+  public void setLabel(String label) {
+    this.label = label;
+  }
+
+  /**
+   * @return the parent
+   */
+  public Object getParent() {
+    return parent;
+  }
+
+  /**
+   * @param parent the parent to set
+   */
+  public void setParent(Object parent) {
+    this.parent = parent;
+  }
+
+  /**
+   * @return the value
+   */
+  public Object getValue() {
+    return value;
+  }
+
+  /**
+   * @param value the value to set
+   */
+  public void setValue(Object value) {
+    this.value = value;
+  }
+
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/hover/KeyValuePair.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoContentProvider.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoContentProvider.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoContentProvider.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoContentProvider.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,217 @@
+package org.apache.uima.casviewer.ui.internal.index;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.uima.cas.CAS;
+import org.apache.uima.cas.FSIndex;
+import org.apache.uima.cas.FSIndexRepository;
+import org.apache.uima.cas.FSIterator;
+import org.apache.uima.casviewer.core.internal.BaseNode;
+import org.apache.uima.casviewer.core.internal.CasIndexRepository;
+import org.apache.uima.casviewer.core.internal.IItemTypeConstants;
+import org.apache.uima.casviewer.core.internal.UFSIndex;
+import org.apache.uima.casviewer.core.internal.UFeatureStructure;
+import org.apache.uima.tools.debug.util.Trace;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+public class CasIndexRepoContentProvider implements ITreeContentProvider {
+
+    private boolean showAllIndexes = false; // Show all indexes (even do not have annotations)
+
+    public CasIndexRepoContentProvider() {
+        super();
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
+     */
+    public Object[] getChildren(Object parent) 
+    {
+        if (parent instanceof BaseNode) {
+            int kind = ((BaseNode)parent).getObjectType();
+            if (kind == IItemTypeConstants.ITEM_TYPE_U_FS_INDEX) {
+                UFSIndex index = (UFSIndex) ((BaseNode)parent).getObject();
+                // Has FS ?
+                if (index.size() > 0) {   
+                    // Return nodes of sub-indexes (children UFSIndex)
+                    if (((BaseNode)parent).getChildren() != null) {
+                        if (showAllIndexes) {
+                            // Show all indexes
+                            return ((BaseNode)parent).getChildren().toArray();
+                        } else {
+                            // Count indexes having FS
+                            List<BaseNode> nodes = ((BaseNode)parent).getChildren();
+                            int count = 0;
+                            for (BaseNode node: nodes) {
+                                if ( ((UFSIndex) node.getObject()).size() > 0 ) {
+                                    ++count;
+                                }
+                            }
+                            if (count > 0) {
+                                Object[] objs = new Object[count];
+                                int k =0;
+                                for (BaseNode node: nodes) {
+                                    if ( ((UFSIndex) node.getObject()).size() > 0 ) {
+                                        objs[k++] = node;
+                                    }
+                                }
+                                return objs;
+                            }
+                            
+                        }
+                    }
+                }                
+            } else if (kind == IItemTypeConstants.ITEM_TYPE_LABEL_U_FS_INDEX) {
+                UFSIndex index = (UFSIndex) ((BaseNode)parent).getObject();
+                if (index.size() == 0) { 
+                    return null;
+                }
+                FSIterator it = index.iterator();
+                
+                Object[] objs = new Object[index.size()];
+                int i = 0;
+                for (it.moveToFirst(); it.isValid(); it.moveToNext()) {
+                    // FeatureStructure fs = it.get();
+                    objs[i] = new UFeatureStructure(it.get(), i);
+                    ++i;
+                }
+                return objs;
+            }
+            
+        } else if (parent instanceof UFSIndex) {
+            UFSIndex index = (UFSIndex) parent;
+            if (index.size() == 0) { 
+                return null;
+            }
+            FSIterator it = index.iterator();
+            
+            Object[] objs = new Object[index.size()];
+            int i = 0;
+            for (it.moveToFirst(); it.isValid(); it.moveToNext()) {
+                // FeatureStructure fs = it.get();
+                objs[i] = new UFeatureStructure(it.get(), i);
+                ++i;
+            }
+            return objs;
+        }
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
+     */
+    public Object getParent(Object element) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
+     */
+    public boolean hasChildren(Object element) 
+    {
+        if (element instanceof BaseNode) {
+            // Check item type
+            int kind = ((BaseNode)element).getObjectType();
+            if (kind == IItemTypeConstants.ITEM_TYPE_U_FS_INDEX) {
+                UFSIndex index = (UFSIndex) ((BaseNode)element).getObject();
+                // Has FS and sub-indexes ?
+                if ( index.size() > 0 && ((BaseNode)element).getChildren().size() > 0 ) {
+                    if (showAllIndexes) {
+                        return true;
+                    } else {
+                        // Show sub-indexes having FS
+                        List<BaseNode> nodes = ((BaseNode)element).getChildren();
+                        int count = 0;
+                        for (BaseNode node: nodes) {
+                            if ( ((UFSIndex) node.getObject()).size() > 0 ) {
+                                ++count;
+                            }
+                        }
+                        if (count > 0) {
+                            return true;
+                        }
+                    }
+                }
+            } else if (kind == IItemTypeConstants.ITEM_TYPE_LABEL_U_FS_INDEX) {
+                return true;
+            }
+        } else if (element instanceof UFSIndex) {
+            if ( ((UFSIndex) element).size() > 0 ) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
+     */
+    public Object[] getElements(Object inputElement) 
+    {
+        if ( inputElement instanceof CasIndexRepository ) {
+            BaseNode root = ((CasIndexRepository) inputElement).getRoot();
+            if (root != null) {
+                /*      TreeNode
+                *          - label     : type's name
+                *          - obj type  : ITEM_TYPE_U_FS_INDEX
+                *          - object    : UFSIndex
+                */
+                return root.getChildren().toArray();
+            }
+        } else if ( inputElement instanceof CAS ) {
+            CAS aCas = (CAS) inputElement;
+            FSIndexRepository ir = aCas.getIndexRepository();
+            Iterator it = ir.getLabels();
+            List list = new ArrayList();
+            while (it.hasNext()) {
+                String label = (String) it.next();
+                FSIndex index1 = ir.getIndex(label);
+                list.add(index1);
+                Trace.trace("label: " + label + " ; type: " + index1.getType()
+                        + " ; size: " + index1.size());
+            }
+            return list.toArray(new FSIndex[list.size()]);
+            
+        } else if ( inputElement instanceof FSIndex ) {
+            // Add label for FSIndex
+            BaseNode fNode = new BaseNode(((FSIndex) inputElement).getType().getName(), null, new ArrayList());
+            fNode.setObjectType(IItemTypeConstants.ITEM_TYPE_LABEL_FS_INDEX);
+            fNode.setObject(inputElement);
+            Object[] objs = new Object[1];
+            objs[0] = fNode;
+            return objs;
+            
+        } else if ( inputElement instanceof UFSIndex ) {
+            // Add label for FSIndex
+            BaseNode fNode = new BaseNode(((UFSIndex) inputElement).getUimaFSIndex().getType().getName(), null, new ArrayList());
+            fNode.setObjectType(IItemTypeConstants.ITEM_TYPE_LABEL_U_FS_INDEX);
+            fNode.setObject(inputElement);
+            Object[] objs = new Object[1];
+            objs[0] = fNode;
+            return objs;
+        }
+        Trace.trace("Unknown inputElement: " + inputElement.getClass().getName());
+        return new Object[0];
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+     */
+    public void dispose() {
+        // TODO Auto-generated method stub
+
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+     */
+    public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+        // input is "CasIndexRepository"
+
+    }
+
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoContentProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoLabelProvider.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoLabelProvider.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoLabelProvider.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoLabelProvider.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,147 @@
+package org.apache.uima.casviewer.ui.internal.index;
+
+import org.apache.uima.cas.FSIndex;
+import org.apache.uima.cas.FeatureStructure;
+import org.apache.uima.casviewer.core.internal.AnnotationObject;
+import org.apache.uima.casviewer.core.internal.BaseNode;
+import org.apache.uima.casviewer.core.internal.IItemTypeConstants;
+import org.apache.uima.casviewer.core.internal.UFSIndex;
+import org.apache.uima.casviewer.core.internal.UFeatureStructure;
+import org.apache.uima.casviewer.ui.internal.style.TypeStyle;
+import org.apache.uima.casviewer.ui.internal.style.TypeSystemStyle;
+import org.apache.uima.tools.debug.util.Trace;
+import org.eclipse.jface.viewers.IColorProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+
+public class CasIndexRepoLabelProvider extends LabelProvider implements IColorProvider {
+
+    private boolean         showShortName = true; // true: type's short name; false: full name
+    private TypeSystemStyle typesystemStyle;
+    
+    public CasIndexRepoLabelProvider(TypeSystemStyle tsStyle) {
+        super();
+        this.typesystemStyle = tsStyle;
+    }
+    public CasIndexRepoLabelProvider(TypeSystemStyle tsStyle, boolean showShortName) {
+        super();
+        this.typesystemStyle = tsStyle;
+        this.showShortName = showShortName;
+    }
+
+    /*************************************************************************/
+    
+    public void setTypeSystemStyle (TypeSystemStyle style)
+    {
+        Trace.trace(style==null? "style==null":"");
+        this.typesystemStyle = style;
+    }
+
+    /*************************************************************************/
+    
+    public Image getImage(Object element) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public String getText(Object element) {
+        if (element instanceof BaseNode) {
+            Object obj = ((BaseNode)element).getObject();
+            if (obj == null) {
+                return ((BaseNode) element).getLabel();
+            }
+            
+            int kind = ((BaseNode)element).getObjectType();
+            if (kind == IItemTypeConstants.ITEM_TYPE_U_FS_INDEX) {
+                // Short Name ?
+                String  typeName;
+                if (showShortName) {
+                    typeName = ((UFSIndex) obj).getType().getShortName();
+                } else {
+                    typeName = ((UFSIndex) obj).getType().getName();
+                }
+                String  text;
+                if (((UFSIndex) obj).getIndexLevel() == 1) {
+                    text = ((UFSIndex) obj).getLabel()
+                           + " - " + typeName;
+                } else {
+                    // Index of sub-type
+                    text = typeName; // ((TreeNode) element).getLabel();
+                }
+                return text + " [" + ((UFSIndex) obj).size() 
+                            + " : " + ((UFSIndex) obj).getSelfFSCount() + "]"; 
+                
+            } else if (kind == IItemTypeConstants.ITEM_TYPE_FS_INDEX) {
+                return ((BaseNode) element).getLabel() 
+                        + " [" + ((FSIndex) obj).size() + "]"; 
+            }
+            return ((BaseNode) element).getLabel();
+            
+        } else if (element instanceof FSIndex) {
+            FSIndex index = (FSIndex) element;
+            return index.getType() + " [" + index.size() + "]";
+            
+        } else if (element instanceof UFSIndex) {
+            UFSIndex index = (UFSIndex) element;
+            return index.getType() + " [" + index.size() + "]";
+            
+        } else if (element instanceof UFeatureStructure) {
+            return "FS[" + ((UFeatureStructure) element).getIndexInIterator() + "] - " + ((UFeatureStructure) element).getType().getShortName();
+            
+        } else if (element instanceof FeatureStructure) {
+            return ((FeatureStructure) element).getType().getShortName();
+        }
+            
+        return "Unknown";
+    }
+    
+    public Color getForeground(Object element) {
+        return null;
+    }       
+    
+    public Color getBackground(Object element) {
+        if (element instanceof BaseNode) {
+            Object obj = ((BaseNode)element).getObject();
+            if (obj == null) {
+                return null;
+            }
+            
+            // Get BG based on type name
+            String  typeName = null;
+            int kind = ((BaseNode)element).getObjectType();
+            if (kind == IItemTypeConstants.ITEM_TYPE_U_FS_INDEX) {
+                if (((UFSIndex) obj).getSelfFSCount() == 0) {
+                    // No self-annotation
+                    return null;
+                }
+                return getTypeBackground(((UFSIndex) obj).getType().getName());
+            }
+        }
+        else if ( element instanceof UFeatureStructure ) {
+            if ( ((UFeatureStructure) element).getUserData() != null ) {
+                AnnotationObject annot = (AnnotationObject) ((UFeatureStructure) element).getUserData();                
+                return getTypeBackground(annot.getTypeName());
+            }
+        } else {
+            Trace.trace("Unknown " + element.getClass().getName());
+        }
+        return null; 
+    }
+
+    protected Color getTypeBackground (String typeName)
+    {
+        if (typesystemStyle != null) {   
+            TypeStyle style = typesystemStyle.getTypeStyle(typeName);
+            if (style != null) {
+                // Trace.trace("HAS bg for " + type.getName() + " " + style.bgColor);
+                return style.bgColor;
+            // } else {
+                // Trace.trace("NO bg for " + type.getName());
+            }
+        }
+        // Trace.trace("typesystemStyle == null");
+        return null;
+    }
+    
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoLabelProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoSectionPart.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoSectionPart.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoSectionPart.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoSectionPart.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,212 @@
+package org.apache.uima.casviewer.ui.internal.index;
+
+import org.apache.uima.casviewer.core.internal.BaseNode;
+import org.apache.uima.casviewer.core.internal.ICASObjectView;
+import org.apache.uima.casviewer.core.internal.IItemTypeConstants;
+import org.apache.uima.casviewer.ui.internal.style.TypeSystemStyle;
+import org.apache.uima.casviewer.ui.internal.util.AbstractSectionPart;
+import org.apache.uima.casviewer.ui.internal.util.FormSection;
+import org.apache.uima.casviewer.ui.internal.util.IObjectSelectionListener;
+import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.forms.IManagedForm;
+import org.eclipse.ui.forms.events.ExpansionAdapter;
+import org.eclipse.ui.forms.events.ExpansionEvent;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+public class CasIndexRepoSectionPart extends AbstractSectionPart implements ISelectionChangedListener {
+
+    // private CheckboxTreeViewer indexRepoViewer;   
+    private  TreeViewer             treeViewer;   
+    private Label                   inputDocName = null;
+    private TypeSystemStyle         typesystemStyle;
+    
+    protected CasIndexRepoSectionPart (IManagedForm managedForm, Composite parent,
+            Section section, int style, String title, String description)
+    {
+        super(managedForm, parent, section, style, title, description);        
+        
+        // final SectionPart spart = new SectionPart(section);
+        managedForm.addPart(this);
+        initialize (managedForm);  // Need this code. Otherwise, exception in SectionPart !!!       
+    }
+    
+    static public CasIndexRepoSectionPart createInstance (IManagedForm managedForm, 
+            Composite parent, int style, String title,
+            String description, TypeSystemStyle tsStyle)
+    {
+        FormToolkit toolkit = managedForm.getToolkit();
+        Section section = FormSection.createGridDataSection(toolkit, parent,
+                style, title, description, 5, 8,
+                GridData.FILL_BOTH|GridData.VERTICAL_ALIGN_BEGINNING,
+                1, 1);
+                
+        CasIndexRepoSectionPart sectionPart = new CasIndexRepoSectionPart (managedForm, parent, 
+                section, style, title, description);
+        sectionPart.typesystemStyle = tsStyle;
+        sectionPart.createContents();
+                
+        return sectionPart;
+    }
+    
+    /*************************************************************************/
+    
+    public Section createContents () 
+    {
+        FormToolkit toolkit = managedForm.getToolkit();
+        // Section section = getSection();
+        // Expand | Collapse
+        section.addExpansionListener(new ExpansionAdapter() {
+            public void expansionStateChanged(ExpansionEvent e) {
+                //  parent.layout(true);
+                managedForm.reflow(true);
+            }
+        });        
+        section.setExpanded(true);
+        
+        ///////////////////////////////////////////////////////////////////////
+        
+        // Create ToolBar
+        Composite sectionToolbarComposite = FormSection.createGridLayoutContainer (toolkit, section,
+                3, 0, 0);
+        section.setTextClient(sectionToolbarComposite);
+        
+        ///////////////////////////////////////////////////////////////////////
+        
+        // Create Composite
+        Composite client = FormSection.createGridLayoutContainer (toolkit, section,
+                1, 0, 0);
+        client.setLayoutData(new GridData(GridData.FILL_BOTH|GridData.VERTICAL_ALIGN_BEGINNING));
+        
+        toolkit.paintBordersFor(client);        
+        section.setClient(client);   
+        
+        /*********************************************************************/        
+        
+        createIndexRepositoryTreeViewer(toolkit, client);
+               
+        createSectionToolbar (toolkit, section, sectionToolbarComposite, treeViewer);
+        
+        return section;
+    }    
+    
+    protected void createSectionToolbar (FormToolkit toolkit, Section section, 
+            Composite toolbarComposite, final TreeViewer treeViewer)
+    {
+        AbstractSectionPart.createExpandAllMenu (toolkit, section, toolbarComposite, 
+                treeViewer);
+        AbstractSectionPart.createCollapseAllMenu(toolkit, section, toolbarComposite, 
+                treeViewer);        
+    }
+    
+    /**
+     * Create the TreeViewer for the index repository.
+     * 
+     * @param parent
+     */
+    private void createIndexRepositoryTreeViewer (FormToolkit toolkit, Composite parent) 
+    {                
+        // Create Tree for FSIndex
+        Tree tree = toolkit.createTree(parent, SWT.NONE);
+        GridData gd = new GridData(GridData.FILL_BOTH|GridData.VERTICAL_ALIGN_BEGINNING);
+        gd.grabExcessVerticalSpace   = true;
+        gd.grabExcessHorizontalSpace = true;
+        gd.heightHint = 160;
+        tree.setLayoutData(gd);
+        
+        // Create Viewer for Tree
+        treeViewer = new TreeViewer(tree);         
+        treeViewer.addSelectionChangedListener(this);
+        
+        // Set Content/Label Provider
+        treeViewer.setContentProvider(new CasIndexRepoContentProvider());
+        treeViewer.setLabelProvider(new CasIndexRepoLabelProvider(typesystemStyle));
+        treeViewer.setSorter(new CasIndexRepoSorter());        
+    } // createIndexRepositoryTreeViewer
+    
+    /**
+     * An index is selected
+     * 
+     * @param event
+     * @return void
+     */
+    public void selectionChanged (SelectionChangedEvent event) 
+    {
+        ISelection selection = event.getSelection();
+        if (selection != null && selection instanceof IStructuredSelection) {
+            IStructuredSelection ssel = (IStructuredSelection)selection;
+            if (ssel.size() == 0 || !(ssel.getFirstElement() instanceof BaseNode)) {
+                return;
+            }
+
+            final BaseNode _selectedTreeNode = (BaseNode) ssel.getFirstElement();
+            if (_selectedTreeNode.getObjectType() == IItemTypeConstants.ITEM_TYPE_U_FS_INDEX) {
+                Object[] listeners = selectionListeners.getListeners();
+                for (int i = 0; i < listeners.length; ++i) {
+                    final IObjectSelectionListener l = (IObjectSelectionListener) listeners[i];
+                    
+                    Display.getCurrent().asyncExec(new Runnable() {
+                        public void run() {
+                            // see CASViewControl
+                            l.objectSelected(CasIndexRepoSectionPart.this, _selectedTreeNode.getObject());
+                        }
+                    });
+                    
+                }                       
+            }
+
+        }
+    }
+        
+    public void setInput(ICASObjectView casView, String title) {
+        treeViewer.setInput(casView.getCasIndexRepository());
+    }
+    
+//    public void setFSIndexSectionPart (FSIndexSectionPart fsIndexSectionPart)
+//    {
+//        this.fsIndexSectionPart = fsIndexSectionPart;
+//        
+//    }
+    
+    public void setDocumentInputName (String docName) 
+    {
+        inputDocName.setText(docName.substring(1+docName.lastIndexOf("\\")));
+    }
+    /*************************************************************************/
+    
+    public void refreshTypeSystemStyle ()
+    {
+        // treeViewer.refresh();
+    }
+    
+    /*************************************************************************/
+    /*                     IObjectSelectionListener                          */
+    /*************************************************************************/
+    
+    private ListenerList selectionListeners = new ListenerList(ListenerList.IDENTITY);
+    
+    /**
+     * Note: CASViewControl is the listener
+     */
+    public void addSelectionListener(IObjectSelectionListener listener)
+    {
+        selectionListeners.add(listener);
+    }
+    
+    public void removeSelectionListener(IObjectSelectionListener listener)
+    {
+        selectionListeners.remove(listener);
+    }
+    
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoSectionPart.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoSorter.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoSorter.java?rev=673409&view=auto
==============================================================================
--- incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoSorter.java (added)
+++ incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoSorter.java Wed Jul  2 07:46:35 2008
@@ -0,0 +1,39 @@
+package org.apache.uima.casviewer.ui.internal.index;
+
+import java.text.Collator;
+
+import org.apache.uima.casviewer.core.internal.BaseNode;
+import org.apache.uima.casviewer.core.internal.IItemTypeConstants;
+import org.eclipse.jface.viewers.ViewerSorter;
+
+public class CasIndexRepoSorter extends ViewerSorter {
+
+    public CasIndexRepoSorter() {
+        super();
+        // TODO Auto-generated constructor stub
+    }
+
+    /**
+     * @param collator
+     */
+    public CasIndexRepoSorter(Collator collator) {
+        super(collator);
+        // TODO Auto-generated constructor stub
+    }
+    
+    public int category(Object element) 
+    {
+        if (element instanceof BaseNode) {
+            int kind = ((BaseNode) element).getObjectType();
+            if (kind == IItemTypeConstants.ITEM_TYPE_LABEL_U_FS_INDEX
+                // || kind == ITEM_TYPE_LABEL_U_FS_INDEX
+               ) {
+                return 0;
+            }
+            
+        }
+        
+        return 1;
+    }
+
+}

Propchange: incubator/uima/sandbox/trunk/CasViewerEclipsePlugin/uimaj-ep-casviewer-core/src/main/java/org/apache/uima/casviewer/ui/internal/index/CasIndexRepoSorter.java
------------------------------------------------------------------------------
    svn:eol-style = native