You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opennlp.apache.org by jo...@apache.org on 2011/11/01 12:51:24 UTC
svn commit: r1195939 -
/incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/namefinder/EntityContentProvider.java
Author: joern
Date: Tue Nov 1 11:51:24 2011
New Revision: 1195939
URL: http://svn.apache.org/viewvc?rev=1195939&view=rev
Log:
OPENNLP-345 Now handles the case correctly where nothing is selected in the entity list.
Modified:
incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/namefinder/EntityContentProvider.java
Modified: incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/namefinder/EntityContentProvider.java
URL: http://svn.apache.org/viewvc/incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/namefinder/EntityContentProvider.java?rev=1195939&r1=1195938&r2=1195939&view=diff
==============================================================================
--- incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/namefinder/EntityContentProvider.java (original)
+++ incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/namefinder/EntityContentProvider.java Tue Nov 1 11:51:24 2011
@@ -144,8 +144,6 @@ public class EntityContentProvider imple
entity.setLinkedAnnotation(annotation);
entity.setConfidence(null);
- int selectionIndex = EntityContentProvider.this.entityListViewer.
- getTable().getSelectionIndex();
entityListViewer.remove(entity);
candidateEntities.remove(entity);
@@ -161,16 +159,21 @@ public class EntityContentProvider imple
}
}
- if (selectionIndex < entityListViewer.
- getTable().getItemCount()) {
- entityListViewer.setSelection(
- new StructuredSelection(entityListViewer.getElementAt(selectionIndex)));
- }
- else {
- if (entityListViewer.getTable().getItemCount() > 0) {
- entityListViewer.setSelection(new StructuredSelection(
- entityListViewer.getElementAt(
- entityListViewer.getTable().getItemCount() - 1)));
+ int selectionIndex = EntityContentProvider.this.entityListViewer.
+ getTable().getSelectionIndex();
+
+ if (selectionIndex != -1) {
+ if (selectionIndex < entityListViewer.
+ getTable().getItemCount()) {
+ entityListViewer.setSelection(
+ new StructuredSelection(entityListViewer.getElementAt(selectionIndex)));
+ }
+ else {
+ if (entityListViewer.getTable().getItemCount() > 0) {
+ entityListViewer.setSelection(new StructuredSelection(
+ entityListViewer.getElementAt(
+ entityListViewer.getTable().getItemCount() - 1)));
+ }
}
}
@@ -595,7 +598,7 @@ public class EntityContentProvider imple
}
// Could pass null, means any type
- static Entity searchEntity(List<Entity> entities, int begin, int end, String type) {
+ public static Entity searchEntity(List<Entity> entities, int begin, int end, String type) {
Span testSpan = new Span(begin, end);