You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by jo...@apache.org on 2009/05/21 10:45:43 UTC
svn commit: r777015 - in
/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor:
CasEditorPlugin.java editor/outline/AnnotationTypeTreeNode.java
editor/outline/TypeGroupedContentProvider.java
Author: joern
Date: Thu May 21 08:45:42 2009
New Revision: 777015
URL: http://svn.apache.org/viewvc?rev=777015&view=rev
Log:
UIMA-1351
Modified:
incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/CasEditorPlugin.java
incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/editor/outline/AnnotationTypeTreeNode.java
incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/editor/outline/TypeGroupedContentProvider.java
Modified: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/CasEditorPlugin.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/CasEditorPlugin.java?rev=777015&r1=777014&r2=777015&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/CasEditorPlugin.java (original)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/CasEditorPlugin.java Thu May 21 08:45:42 2009
@@ -134,6 +134,10 @@
public static void log(Throwable t) {
getDefault().getLog().log(new Status(IStatus.ERROR, ID, IStatus.OK, t.getMessage(), t));
}
+
+ public static void logError(String message) {
+ getDefault().getLog().log(new Status(IStatus.ERROR, ID, message));
+ }
/**
* Retrieves an image.
Modified: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/editor/outline/AnnotationTypeTreeNode.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/editor/outline/AnnotationTypeTreeNode.java?rev=777015&r1=777014&r2=777015&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/editor/outline/AnnotationTypeTreeNode.java (original)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/editor/outline/AnnotationTypeTreeNode.java Thu May 21 08:45:42 2009
@@ -30,7 +30,7 @@
* by their type. Only the {@link TypeGroupedContentProvider} creates
* {@link AnnotationTreeNode} objects.
*/
-public class AnnotationTypeTreeNode implements IAdaptable {
+class AnnotationTypeTreeNode implements IAdaptable {
// annotation type
private Type type;
Modified: incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/editor/outline/TypeGroupedContentProvider.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/editor/outline/TypeGroupedContentProvider.java?rev=777015&r1=777014&r2=777015&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/editor/outline/TypeGroupedContentProvider.java (original)
+++ incubator/uima/sandbox/trunk/CasEditorEclipsePlugin/src/main/java/org/apache/uima/caseditor/editor/outline/TypeGroupedContentProvider.java Thu May 21 08:45:42 2009
@@ -30,15 +30,17 @@
import org.apache.uima.cas.TypeSystem;
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.cas.text.AnnotationIndex;
+import org.apache.uima.caseditor.CasEditorPlugin;
import org.apache.uima.caseditor.editor.AnnotationDocument;
import org.apache.uima.caseditor.editor.AnnotationEditor;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
/**
+ * The content provider for the type grouped annotation outline.
+ *
* TODO:
* Make it sensitive to show annotations menu from the editor ...
- *
* Who sends selection events which are not from the UI thread ?
*/
public class TypeGroupedContentProvider extends OutlineContentProviderBase {
@@ -74,11 +76,16 @@
String name = annotation.getType().getName();
AnnotationTypeTreeNode typeNode = nameAnnotationTypeNodeMap.get(name);
-
- AnnotationTreeNode annotationNode = new AnnotationTreeNode(mInputDocument, annotation);
- typeNode.remove(annotationNode);
- viewer.remove(annotationNode);
+ if (typeNode != null) {
+ AnnotationTreeNode annotationNode = new AnnotationTreeNode(mInputDocument, annotation);
+ typeNode.remove(annotationNode);
+
+ viewer.remove(annotationNode);
+ }
+ else {
+ CasEditorPlugin.logError("Unmapped annotation type!");
+ }
}
}
@@ -133,6 +140,8 @@
List<Type> types = typeSystem.getProperlySubsumedTypes(
typeSystem.getType(CAS.TYPE_NAME_ANNOTATION));
+ types.add(typeSystem.getType(CAS.TYPE_NAME_ANNOTATION));
+
for (Type type : types) {
AnnotationTypeTreeNode typeNode = new AnnotationTypeTreeNode(type);
@@ -146,7 +155,9 @@
for (FSIterator it = index.iterator(); it.hasNext(); ) {
AnnotationFS annotation = (AnnotationFS) it.next();
- typeNode.add(new AnnotationTreeNode(mInputDocument, annotation));
+ if (annotation.getType().equals(type)) {
+ typeNode.add(new AnnotationTreeNode(mInputDocument, annotation));
+ }
}
}
@@ -157,4 +168,4 @@
public void changed() {
// update on changes
}
-}
\ No newline at end of file
+}