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/12/01 23:11:51 UTC
svn commit: r885968 - in
/incubator/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/outline:
ModeSensitiveContentProvider.java TypeGroupedContentProvider.java
Author: joern
Date: Tue Dec 1 22:11:51 2009
New Revision: 885968
URL: http://svn.apache.org/viewvc?rev=885968&view=rev
Log:
UIMA-1690 After cleaning a document the outline view does not sync
Modified:
incubator/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/outline/ModeSensitiveContentProvider.java
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/ModeSensitiveContentProvider.java
URL: http://svn.apache.org/viewvc/incubator/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/outline/ModeSensitiveContentProvider.java?rev=885968&r1=885967&r2=885968&view=diff
==============================================================================
--- incubator/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/outline/ModeSensitiveContentProvider.java (original)
+++ incubator/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/outline/ModeSensitiveContentProvider.java Tue Dec 1 22:11:51 2009
@@ -20,8 +20,6 @@
package org.apache.uima.caseditor.editor.outline;
import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
import org.apache.uima.cas.text.AnnotationFS;
import org.apache.uima.caseditor.core.model.NlpModel;
@@ -39,9 +37,6 @@
private AnnotationTreeNodeList mAnnotationNodeList;
- private Map<AnnotationFS, AnnotationTreeNode> mParentNodeLookup =
- new HashMap<AnnotationFS, AnnotationTreeNode>();
-
protected ModeSensitiveContentProvider(AnnotationEditor editor, TreeViewer viewer) {
super(editor, viewer);
this.viewer = viewer;
@@ -75,7 +70,7 @@
}
/**
- * Removes the removed annoations from the viewer.
+ * Removes the removed annotations from the viewer.
*
* @param deletedAnnotations
*/
@@ -109,8 +104,6 @@
mAnnotationNodeList = annotations != null ? new AnnotationTreeNodeList(mEditor
.getDocument(), annotations) : null;
- mParentNodeLookup.clear();
-
Display.getDefault().syncExec(new Runnable() {
public void run() {
viewer.refresh();
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=885968&r1=885967&r2=885968&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 Dec 1 22:11:51 2009
@@ -33,11 +33,9 @@
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;
-import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.widgets.Display;
/**
* The content provider for the type grouped annotation outline.
@@ -137,54 +135,40 @@
return typeNode.getAnnotations();
}
- @Override
- public void dispose() {
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (oldInput != null) {
- ((ICasDocument) oldInput).removeChangeListener(this);
- }
- if (newInput != null) {
- mInputDocument = (ICasDocument) newInput;
+ public void changed() {
+ nameAnnotationTypeNodeMap.clear();
+
+ TypeSystem typeSystem = mInputDocument.getCAS().getTypeSystem();
+
+ List<Type> types = typeSystem.getProperlySubsumedTypes(
+ typeSystem.getType(CAS.TYPE_NAME_ANNOTATION));
+
+ types.add(typeSystem.getType(CAS.TYPE_NAME_ANNOTATION));
+
+ for (Type type : types) {
- mInputDocument.addChangeListener(this);
-
- nameAnnotationTypeNodeMap.clear();
+ AnnotationTypeTreeNode typeNode = new AnnotationTypeTreeNode(type);
- TypeSystem typeSystem = mInputDocument.getCAS().getTypeSystem();
+ nameAnnotationTypeNodeMap.put(type.getName(), typeNode);
- List<Type> types = typeSystem.getProperlySubsumedTypes(
- typeSystem.getType(CAS.TYPE_NAME_ANNOTATION));
+ CAS cas = mInputDocument.getCAS();
- types.add(typeSystem.getType(CAS.TYPE_NAME_ANNOTATION));
+ AnnotationIndex<AnnotationFS> index = cas.getAnnotationIndex(type);
- for (Type type : types) {
-
- AnnotationTypeTreeNode typeNode = new AnnotationTypeTreeNode(type);
-
- nameAnnotationTypeNodeMap.put(type.getName(), typeNode);
-
- CAS cas = mInputDocument.getCAS();
+ for (FSIterator<AnnotationFS> it = index.iterator(); it.hasNext(); ) {
+ AnnotationFS annotation = it.next();
- AnnotationIndex index = cas.getAnnotationIndex(type);
-
- for (FSIterator it = index.iterator(); it.hasNext(); ) {
- AnnotationFS annotation = (AnnotationFS) it.next();
-
- if (annotation.getType().equals(type)) {
- typeNode.add(new AnnotationTreeNode(mInputDocument, annotation));
- }
+ if (annotation.getType().equals(type)) {
+ typeNode.add(new AnnotationTreeNode(mInputDocument, annotation));
}
}
-
- viewer.refresh();
}
- }
- public void changed() {
- // update on changes
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ viewer.refresh();
+ }
+ });
}
}