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 2011/09/29 12:23:02 UTC
svn commit: r1177252 -
/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java
Author: joern
Date: Thu Sep 29 10:23:01 2011
New Revision: 1177252
URL: http://svn.apache.org/viewvc?rev=1177252&view=rev
Log:
UIMA-2242 Annotate actions are now also enabled via a selection listener.
Modified:
uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java
Modified: uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java
URL: http://svn.apache.org/viewvc/uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java?rev=1177252&r1=1177251&r2=1177252&view=diff
==============================================================================
--- uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java (original)
+++ uima/uimaj/trunk/uimaj-ep-cas-editor/src/main/java/org/apache/uima/caseditor/editor/AnnotationEditor.java Thu Sep 29 10:23:01 2011
@@ -131,7 +131,6 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.PageBookView;
-import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.ui.texteditor.IStatusField;
import org.eclipse.ui.texteditor.ITextEditorActionConstants;
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
@@ -673,7 +672,7 @@ public final class AnnotationEditor exte
if (newCaretOffset != mCursorPosition) {
mCursorPosition = newCaretOffset;
- cursorPositionChanged();
+ refreshSelection();
}
}
@@ -689,7 +688,7 @@ public final class AnnotationEditor exte
if (newCaretOffset != mCursorPosition) {
mCursorPosition = newCaretOffset;
- cursorPositionChanged();
+ refreshSelection();
}
}
@@ -702,12 +701,29 @@ public final class AnnotationEditor exte
if (newCaretOffset != mCursorPosition) {
mCursorPosition = newCaretOffset;
- cursorPositionChanged();
+ refreshSelection();
}
}
});
+
+ // UIMA-2242:
+ // When a single character is selected with a double click the selection
+ // changes but the caret does not.
+ // A press on enter now fails to create an annotation.
+ getSourceViewer().getTextWidget().addSelectionListener(new SelectionListener() {
+
+ public void widgetSelected(SelectionEvent e) {
+ refreshSelection();
+ }
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // This method is never called!
+ }
+ });
+
+
DragSource dragSource = new DragSource(getSourceViewer().getTextWidget(), DND.DROP_COPY);
Transfer[] types = new Transfer[] { FeatureStructureTransfer.getInstance() };
@@ -754,7 +770,7 @@ public final class AnnotationEditor exte
initiallySynchronizeUI();
}
- private void cursorPositionChanged() {
+ private void refreshSelection() {
mFeatureStructureSelectionProvider.setSelection(getDocument(), getSelectedAnnotations());
}
@@ -1207,7 +1223,7 @@ public final class AnnotationEditor exte
} else {
Map<Integer, AnnotationFS> view = getView(getAnnotationMode());
- AnnotationFS annotation = view.get(mCursorPosition);
+ AnnotationFS annotation = view.get(getSourceViewer().getTextWidget().getCaretOffset());
if (annotation == null) {
annotation = view.get(mCursorPosition - 1);