Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 146934 Details for
Bug 163769
[rulers] overview ruler annotation arming not correct
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch v02
OverviewRuler 02.txt (text/plain), 3.73 KB, created by
Prakash Rangaraj
on 2009-09-11 04:59:32 EDT
(
hide
)
Description:
Patch v02
Filename:
MIME Type:
Creator:
Prakash Rangaraj
Created:
2009-09-11 04:59:32 EDT
Size:
3.73 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jface.text >Index: src/org/eclipse/jface/text/source/OverviewRuler.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRuler.java,v >retrieving revision 1.69 >diff -u -r1.69 OverviewRuler.java >--- src/org/eclipse/jface/text/source/OverviewRuler.java 10 Oct 2008 14:22:59 -0000 1.69 >+++ src/org/eclipse/jface/text/source/OverviewRuler.java 11 Sep 2009 08:56:56 -0000 >@@ -822,15 +822,18 @@ > } > > /** >- * Translates a given y-coordinate of this ruler into the corresponding >- * document lines. The number of lines depends on the concrete scaling >- * given as the ration between the height of this ruler and the length >- * of the document. >- * >+ * Translates a given y-coordinate of this ruler into the corresponding document lines. The >+ * number of lines depends on the concrete scaling given as the ration between the height of >+ * this ruler and the length of the document. >+ * >+ * When restrictForAnnotation is true, then line number calculation is done only for the height >+ * of the annotation, else it will be done for the entire lenght of the line. >+ * > * @param y_coordinate the y-coordinate >+ * @param restrictForAnnotation <code>true</code> if calculation is for annotation > * @return the corresponding document lines > */ >- private int[] toLineNumbers(int y_coordinate) { >+ private int[] toLineNumbers(int y_coordinate, boolean restrictForAnnotation) { > > StyledText textWidget= fTextViewer.getTextWidget(); > int maxLines= textWidget.getContent().getLineCount(); >@@ -850,8 +853,20 @@ > int pixel1= Math.min(rulerLength, y_coordinate + 1); > rulerLength= Math.max(rulerLength, 1); > >- lines[0]= (pixel0 * maxLines) / rulerLength; >- lines[1]= (pixel1 * maxLines) / rulerLength; >+ // if the ruler is very big, rounding off is heavy >+ if(rulerLength > maxLines){ >+ lines[0]= (int)(pixel0 * (maxLines / (double)rulerLength)); >+ lines[1]= (int)(pixel1 * (maxLines / (double)rulerLength)); >+ }else{ >+ lines[0]= pixel0 * (maxLines / rulerLength); >+ lines[1]= pixel1 * (maxLines / rulerLength); >+ } >+ >+ if (restrictForAnnotation) { >+ // hit test should be only for the annotation height - not for the entire line length >+ if (y_coordinate > (((lines[0] * rulerLength) / maxLines) + fAnnotationHeight)) >+ return new int[] { -1, -1 }; >+ } > > if (fTextViewer instanceof ITextViewerExtension5) { > ITextViewerExtension5 extension= (ITextViewerExtension5) fTextViewer; >@@ -955,7 +970,7 @@ > */ > private void handleMouseDown(MouseEvent event) { > if (fTextViewer != null) { >- int[] lines= toLineNumbers(event.y); >+ int[] lines= toLineNumbers(event.y, false); > Position p= getAnnotationPosition(lines); > if (p == null && event.button == 1) { > try { >@@ -980,7 +995,7 @@ > */ > private void handleMouseMove(MouseEvent event) { > if (fTextViewer != null) { >- int[] lines= toLineNumbers(event.y); >+ int[] lines= toLineNumbers(event.y, true); > Position p= getAnnotationPosition(lines); > Cursor cursor= (p != null ? fHitDetectionCursor : null); > if (cursor != fLastCursor) { >@@ -1234,7 +1249,7 @@ > if (fTextViewer == null || y_coordinate == -1) > return -1; > >- int[] lineNumbers= toLineNumbers(y_coordinate); >+ int[] lineNumbers= toLineNumbers(y_coordinate, false); > int bestLine= findBestMatchingLineNumber(lineNumbers); > if (bestLine == -1 && lineNumbers.length > 0) > return lineNumbers[0]; >@@ -1259,7 +1274,7 @@ > * @see org.eclipse.jface.text.source.IOverviewRuler#hasAnnotation(int) > */ > public boolean hasAnnotation(int y) { >- return findBestMatchingLineNumber(toLineNumbers(y)) != -1; >+ return findBestMatchingLineNumber(toLineNumbers(y, true)) != -1; > } > > /*
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 163769
:
72050
|
143870
|
144937
|
146934
|
150218
|
150219
|
150488
|
186620
|
186622
|
186755