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/07/22 12:56:29 UTC
svn commit: r1149564 -
/incubator/opennlp/sandbox/opennlp-caseditor-plugin/src/main/java/org/apache/opennlp/caseditor/namefinder/NameFinderViewPage.java
Author: joern
Date: Fri Jul 22 10:56:29 2011
New Revision: 1149564
URL: http://svn.apache.org/viewvc?rev=1149564&view=rev
Log:
OPENNLP-235 Added a sorter to the table.
Modified:
incubator/opennlp/sandbox/opennlp-caseditor-plugin/src/main/java/org/apache/opennlp/caseditor/namefinder/NameFinderViewPage.java
Modified: incubator/opennlp/sandbox/opennlp-caseditor-plugin/src/main/java/org/apache/opennlp/caseditor/namefinder/NameFinderViewPage.java
URL: http://svn.apache.org/viewvc/incubator/opennlp/sandbox/opennlp-caseditor-plugin/src/main/java/org/apache/opennlp/caseditor/namefinder/NameFinderViewPage.java?rev=1149564&r1=1149563&r2=1149564&view=diff
==============================================================================
--- incubator/opennlp/sandbox/opennlp-caseditor-plugin/src/main/java/org/apache/opennlp/caseditor/namefinder/NameFinderViewPage.java (original)
+++ incubator/opennlp/sandbox/opennlp-caseditor-plugin/src/main/java/org/apache/opennlp/caseditor/namefinder/NameFinderViewPage.java Fri Jul 22 10:56:29 2011
@@ -30,6 +30,8 @@ import org.eclipse.jface.viewers.ISelect
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -87,7 +89,16 @@ class NameFinderViewPage extends Page im
entityList.setContentProvider(new EntityContentProvider(new NameFinderJob(), entityList));
getSite().setSelectionProvider(entityList);
- // TODO: Do we need a sorter here?!
+ entityList.setComparator(new ViewerComparator(){
+ @Override
+ public int compare(Viewer viewer, Object o1, Object o2) {
+
+ Entity e1 = (Entity) o1;
+ Entity e2 = (Entity) o2;
+
+ return e1.getBeginIndex() - e2.getBeginIndex();
+ }
+ });
entityList.setInput(editor.getDocument());
}