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/17 17:17:40 UTC
svn commit: r1203237 -
/incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceContentProvider.java
Author: joern
Date: Thu Nov 17 16:17:40 2011
New Revision: 1203237
URL: http://svn.apache.org/viewvc?rev=1203237&view=rev
Log:
OPENNLP-392 Now maintains the selection after confirmation.
Modified:
incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceContentProvider.java
Modified: incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceContentProvider.java
URL: http://svn.apache.org/viewvc/incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceContentProvider.java?rev=1203237&r1=1203236&r2=1203237&view=diff
==============================================================================
--- incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceContentProvider.java (original)
+++ incubator/opennlp/sandbox/caseditor-opennlp-plugin/src/main/java/org/apache/opennlp/caseditor/sentdetect/SentenceContentProvider.java Thu Nov 17 16:17:40 2011
@@ -38,9 +38,11 @@ import org.eclipse.core.runtime.jobs.IJo
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Table;
public class SentenceContentProvider implements IStructuredContentProvider {
@@ -104,6 +106,9 @@ public class SentenceContentProvider imp
// TODO:
// Remove all detected sentences from the last run which are not detected anymore
+ Table sentenceTable = SentenceContentProvider.this.sentenceList.getTable();
+
+ int selectionIndex = sentenceTable.getSelectionIndex();
SentenceContentProvider.this.sentenceList.refresh();
@@ -119,6 +124,21 @@ public class SentenceContentProvider imp
SentenceContentProvider.this.sentenceList.add(sentence);
}
}
+
+ int newSelectionIndex = -1;
+
+ if (sentenceTable.getSelectionIndex() == -1 && sentenceTable.getItemCount() > 0) {
+ newSelectionIndex = 0;
+ }
+
+ if (selectionIndex < sentenceTable.getItemCount()) {
+ newSelectionIndex = selectionIndex;
+ }
+
+ if (newSelectionIndex != -1) {
+ SentenceContentProvider.this.sentenceList.setSelection(
+ new StructuredSelection(SentenceContentProvider.this.sentenceList.getElementAt(selectionIndex)));
+ }
}
else {
SentenceContentProvider.this.sentenceDetectorView.setMessage(event.getResult().getMessage());