|
Lines 51-57
Link Here
|
| 51 |
*/ |
51 |
*/ |
| 52 |
protected void computeInformation() { |
52 |
protected void computeInformation() { |
| 53 |
Point location= getHoverEventLocation(); |
53 |
Point location= getHoverEventLocation(); |
| 54 |
int line= getVerticalRulerInfo().toDocumentLineNumber(location.y); |
54 |
IVerticalRulerInfo verticalRulerInfo= getVerticalRulerInfo(); |
|
|
55 |
int line= verticalRulerInfo.toDocumentLineNumber(location.y); |
| 55 |
IAnnotationHover hover= getAnnotationHover(); |
56 |
IAnnotationHover hover= getAnnotationHover(); |
| 56 |
|
57 |
|
| 57 |
IInformationControlCreator controlCreator= null; |
58 |
IInformationControlCreator controlCreator= null; |
|
Lines 59-65
Link Here
|
| 59 |
controlCreator= ((IAnnotationHoverExtension)hover).getHoverControlCreator(); |
60 |
controlCreator= ((IAnnotationHoverExtension)hover).getHoverControlCreator(); |
| 60 |
setCustomInformationControlCreator(controlCreator); |
61 |
setCustomInformationControlCreator(controlCreator); |
| 61 |
|
62 |
|
| 62 |
setInformation(hover.getHoverInfo(getSourceViewer(), line), computeArea(location.y)); |
63 |
String hoverInfo; |
|
|
64 |
if(hover instanceof IAnnotationHoverExtension3 && hasAnnotation(verticalRulerInfo, location.y)) { |
| 65 |
hoverInfo= ((IAnnotationHoverExtension3)hover).getHoverInfo(line); |
| 66 |
}else { |
| 67 |
hoverInfo= hover.getHoverInfo(getSourceViewer(), line); |
| 68 |
} |
| 69 |
|
| 70 |
setInformation(hoverInfo, computeArea(location.y)); |
| 71 |
} |
| 72 |
|
| 73 |
/** |
| 74 |
* This method calculates whether an annotation is shown in the particular y coordinate. |
| 75 |
* |
| 76 |
* @param verticalRulerInfo The vertical ruler in which annotions are searched for |
| 77 |
* @param y_coordinate The coordinate in the ruler's SWT control |
| 78 |
* |
| 79 |
* @return <code>true</code> if an annotation exists, <code>false</code> otherwise |
| 80 |
*/ |
| 81 |
private boolean hasAnnotation(IVerticalRulerInfo verticalRulerInfo, int y_coordinate) { |
| 82 |
|
| 83 |
if(verticalRulerInfo instanceof IOverviewRuler) { |
| 84 |
IOverviewRuler overviewRuler = (IOverviewRuler)verticalRulerInfo; |
| 85 |
int height= overviewRuler.getAnnotationHeight(); |
| 86 |
for (int i= y_coordinate-height; i <y_coordinate+height; i++) { |
| 87 |
if(overviewRuler.hasAnnotation(i)) |
| 88 |
return true; |
| 89 |
} |
| 90 |
} |
| 91 |
return false; |
| 63 |
} |
92 |
} |
| 64 |
|
93 |
|
| 65 |
/** |
94 |
/** |