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/10/06 13:56:00 UTC
svn commit: r822230 -
/incubator/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/outline/TypeGroupedContentProvider.java
Author: joern
Date: Tue Oct 6 11:55:59 2009
New Revision: 822230
URL: http://svn.apache.org/viewvc?rev=822230&view=rev
Log:
UIMA-1599 Outline view may throw ClassCastException in TypeGroupedContentProvider
Modified:
incubator/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/outline/TypeGroupedContentProvider.java
Modified: incubator/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/outline/TypeGroupedContentProvider.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/outline/TypeGroupedContentProvider.java?rev=822230&r1=822229&r2=822230&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/outline/TypeGroupedContentProvider.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/outline/TypeGroupedContentProvider.java Tue Oct 6 11:55:59 2009
@@ -33,6 +33,7 @@
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.core.TaeError;
import org.apache.uima.caseditor.editor.AnnotationEditor;
import org.apache.uima.caseditor.editor.ICasDocument;
import org.eclipse.jface.viewers.TreeViewer;
@@ -102,11 +103,21 @@
public Object getParent(Object element) {
- AnnotationTreeNode annotation = (AnnotationTreeNode) element;
-
- String name = annotation.getAnnotation().getType().getName();
-
- return nameAnnotationTypeNodeMap.get(name);
+ if (element instanceof AnnotationTreeNode) {
+ AnnotationTreeNode annotation = (AnnotationTreeNode) element;
+
+ String name = annotation.getAnnotation().getType().getName();
+
+ return nameAnnotationTypeNodeMap.get(name);
+ }
+ else if (element instanceof AnnotationTypeTreeNode) {
+ // The head type elements to not have a parent
+ return null;
+ }
+ else {
+ CasEditorPlugin.logError("TypeGroupedContentProvider: Unexpected type " + element.getClass().getName());
+ return null;
+ }
}
public boolean hasChildren(Object element) {