Author: scabanovich
Date: 2011-06-13 20:08:10 -0400 (Mon, 13 Jun 2011)
New Revision: 32074
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
Log:
JBIDE-9040
https://issues.jboss.org/browse/JBIDE-9040
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2011-06-13
23:58:45 UTC (rev 32073)
+++
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2011-06-14
00:08:10 UTC (rev 32074)
@@ -25,6 +25,7 @@
import org.eclipse.jface.text.ITextListener;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.ITextViewerExtension5;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.TextEvent;
import org.eclipse.jface.text.contentassist.ContentAssistant;
@@ -1026,7 +1027,18 @@
private int getPosition(int x, int y) {
ISourceViewer v = getSourceViewer();
- return v == null ? 0 : getPosition(v.getTextWidget(), x, y);
+ int result = 0;
+ if(v != null) {
+ result = getPosition(v.getTextWidget(), x, y);
+ if (v instanceof ITextViewerExtension5) {
+ ITextViewerExtension5 ext = (ITextViewerExtension5) v;
+ int off = ext.widgetOffset2ModelOffset(result);
+ if (off >= 0) {
+ result = off;
+ }
+ }
+ }
+ return result;
}
private int getPosition(StyledText t, int x, int y) {