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 150488 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 v04
OverviewRuler 04.txt (text/plain), 9.57 KB, created by
Prakash Rangaraj
on 2009-10-26 04:11:23 EDT
(
hide
)
Description:
Patch v04
Filename:
MIME Type:
Creator:
Prakash Rangaraj
Created:
2009-10-26 04:11:23 EDT
Size:
9.57 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jface.text >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface.text/META-INF/MANIFEST.MF,v >retrieving revision 1.28 >diff -u -r1.28 MANIFEST.MF >--- META-INF/MANIFEST.MF 22 Sep 2009 06:55:58 -0000 1.28 >+++ META-INF/MANIFEST.MF 26 Oct 2009 07:51:22 -0000 >@@ -2,7 +2,7 @@ > Bundle-ManifestVersion: 2 > Bundle-Name: %pluginName > Bundle-SymbolicName: org.eclipse.jface.text >-Bundle-Version: 3.5.100.qualifier >+Bundle-Version: 3.6.0.qualifier > Bundle-Vendor: %providerName > Bundle-Localization: plugin > Export-Package: >Index: src/org/eclipse/jface/text/source/DefaultAnnotationHover.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface.text/src/org/eclipse/jface/text/source/DefaultAnnotationHover.java,v >retrieving revision 1.7 >diff -u -r1.7 DefaultAnnotationHover.java >--- src/org/eclipse/jface/text/source/DefaultAnnotationHover.java 31 Dec 2008 21:14:34 -0000 1.7 >+++ src/org/eclipse/jface/text/source/DefaultAnnotationHover.java 26 Oct 2009 07:51:22 -0000 >@@ -26,7 +26,7 @@ > * > * @since 3.2 > */ >-public class DefaultAnnotationHover implements IAnnotationHover { >+public class DefaultAnnotationHover implements IAnnotationHover, IAnnotationHoverExtension3 { > > > /** >@@ -90,7 +90,18 @@ > return formatMultipleMessages(messages); > } > } >+ >+ return getHoverInfo(lineNumber); > >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.text.source.IAnnotationHoverExtension3#getHoverInfo(int) >+ */ >+ /** >+ * @since 3.6 >+ */ >+ public String getHoverInfo(int lineNumber) { > if (fShowLineNumber && lineNumber > -1) > return JFaceTextMessages.getFormattedString("DefaultAnnotationHover.lineNumber", new String[] { Integer.toString(lineNumber + 1) }); //$NON-NLS-1$ > >@@ -232,4 +243,5 @@ > > return javaAnnotations; > } >+ > } >Index: src/org/eclipse/jface/text/source/IAnnotationHoverExtension3.java >=================================================================== >RCS file: src/org/eclipse/jface/text/source/IAnnotationHoverExtension3.java >diff -N src/org/eclipse/jface/text/source/IAnnotationHoverExtension3.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/jface/text/source/IAnnotationHoverExtension3.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,38 @@ >+/******************************************************************************* >+ * Copyright (c) 2009 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jface.text.source; >+ >+/** >+ * Extension interface for {@link org.eclipse.jface.text.source.IAnnotationHover} for >+ * <ul> >+ * <li>providing the hover information of a line without any annotations</li> >+ * </ul> >+ * >+ * @since 3.6 >+ * @author Prakash G.R. >+ * >+ */ >+public interface IAnnotationHoverExtension3 { >+ >+ /** >+ * Returns the text which should be presented in the a >+ * hover popup window. This information is requested based on >+ * the specified line number. The implementation should ignore any >+ * annotations in the line >+ * >+ * @param lineNumber the line number for which information is requested >+ * @return the requested information or <code>null</code> if no such information exists >+ * @since 3.6 >+ */ >+ String getHoverInfo(int lineNumber); >+ >+ >+} >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.71 >diff -u -r1.71 OverviewRuler.java >--- src/org/eclipse/jface/text/source/OverviewRuler.java 13 Oct 2009 12:39:46 -0000 1.71 >+++ src/org/eclipse/jface/text/source/OverviewRuler.java 26 Oct 2009 07:51:25 -0000 >@@ -804,15 +804,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(); >@@ -832,8 +835,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; >@@ -937,7 +952,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 { >@@ -962,7 +977,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) { >@@ -1216,7 +1231,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]; >@@ -1241,7 +1256,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; > } > > /* >Index: src/org/eclipse/jface/text/source/OverviewRulerHoverManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface.text/src/org/eclipse/jface/text/source/OverviewRulerHoverManager.java,v >retrieving revision 1.12 >diff -u -r1.12 OverviewRulerHoverManager.java >--- src/org/eclipse/jface/text/source/OverviewRulerHoverManager.java 11 Sep 2008 11:58:24 -0000 1.12 >+++ src/org/eclipse/jface/text/source/OverviewRulerHoverManager.java 26 Oct 2009 07:51:25 -0000 >@@ -51,7 +51,8 @@ > */ > protected void computeInformation() { > Point location= getHoverEventLocation(); >- int line= getVerticalRulerInfo().toDocumentLineNumber(location.y); >+ IVerticalRulerInfo verticalRulerInfo= getVerticalRulerInfo(); >+ int line= verticalRulerInfo.toDocumentLineNumber(location.y); > IAnnotationHover hover= getAnnotationHover(); > > IInformationControlCreator controlCreator= null; >@@ -59,7 +60,35 @@ > controlCreator= ((IAnnotationHoverExtension)hover).getHoverControlCreator(); > setCustomInformationControlCreator(controlCreator); > >- setInformation(hover.getHoverInfo(getSourceViewer(), line), computeArea(location.y)); >+ String hoverInfo; >+ if(hover instanceof IAnnotationHoverExtension3 && !hasAnnotation(verticalRulerInfo, location.y)) { >+ hoverInfo= ((IAnnotationHoverExtension3)hover).getHoverInfo(line); >+ }else { >+ hoverInfo= hover.getHoverInfo(getSourceViewer(), line); >+ } >+ >+ setInformation(hoverInfo, computeArea(location.y)); >+ } >+ >+ /** >+ * This method calculates whether an annotation is shown in the particular y coordinate. >+ * >+ * @param verticalRulerInfo The vertical ruler in which annotions are searched for >+ * @param y_coordinate The coordinate in the ruler's SWT control >+ * >+ * @return <code>true</code> if an annotation exists, <code>false</code> otherwise >+ */ >+ private boolean hasAnnotation(IVerticalRulerInfo verticalRulerInfo, int y_coordinate) { >+ >+ if(verticalRulerInfo instanceof IOverviewRuler) { >+ IOverviewRuler overviewRuler = (IOverviewRuler)verticalRulerInfo; >+ int height= overviewRuler.getAnnotationHeight(); >+ for (int i= y_coordinate-height; i <y_coordinate+height; i++) { >+ if(overviewRuler.hasAnnotation(i)) >+ return true; >+ } >+ } >+ return false; > } > > /**
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