@Override protected void computeInformation() { Point location= getHoverEventLocation(); int line= getVerticalRulerInfo().toDocumentLineNumber(location.y); IAnnotationHover hover= getAnnotationHover(); IInformationControlCreator controlCreator= null; if (hover instanceof IAnnotationHoverExtension) controlCreator= ((IAnnotationHoverExtension)hover).getHoverControlCreator(); setCustomInformationControlCreator(controlCreator); setInformation(hover.getHoverInfo(getSourceViewer(), line), computeArea(location.y)); }
/** * Creates an overview hover manager with the given parameters. In addition, * the hovers anchor is RIGHT and the margin is 5 points to the right. * * @param ruler the overview ruler this manager connects to * @param sourceViewer the source viewer this manager connects to * @param annotationHover the annotation hover providing the information to be displayed * @param creator the information control creator */ public OverviewRulerHoverManager(IOverviewRuler ruler, ISourceViewer sourceViewer, IAnnotationHover annotationHover, IInformationControlCreator creator) { super(ruler, sourceViewer, annotationHover, creator); setAnchor(ANCHOR_LEFT); StyledText textWidget= sourceViewer.getTextWidget(); if (textWidget != null) { ScrollBar verticalBar= textWidget.getVerticalBar(); if (verticalBar != null) setMargins(verticalBar.getSize().x, 5); } }
/** * After this method has been executed the caller knows that any installed overview hover has been installed. */ protected void ensureOverviewHoverManagerInstalled() { if (fOverviewRuler != null && fOverviewRulerAnnotationHover != null && fOverviewRulerHoveringController == null && fHoverControlCreator != null) { fOverviewRulerHoveringController= new OverviewRulerHoverManager(fOverviewRuler, this, fOverviewRulerAnnotationHover, fHoverControlCreator); fOverviewRulerHoveringController.install(fOverviewRuler.getControl()); fOverviewRulerHoveringController.getInternalAccessor().setInformationControlReplacer(new StickyHoverManager(this)); } }
/** * Determines graphical area covered for which the hover is valid. * * @param y y-coordinate in the vertical ruler * @return the graphical extend where the hover is valid */ private Rectangle computeArea(int y) { // This is OK (see constructor) IOverviewRuler overviewRuler= (IOverviewRuler) getVerticalRulerInfo(); int hover_height= overviewRuler.getAnnotationHeight(); int hover_width= getVerticalRulerInfo().getControl().getSize().x; // Calculate y-coordinate for hover int hover_y= y; boolean hasAnnotation= true; while (hasAnnotation && hover_y > y - hover_height) { hover_y--; hasAnnotation= overviewRuler.hasAnnotation(hover_y); } hover_y++; return new Rectangle(0, hover_y, hover_width, hover_height); } }
/** * Creates an overview hover manager with the given parameters. In addition, * the hovers anchor is RIGHT and the margin is 5 points to the right. * * @param ruler the overview ruler this manager connects to * @param sourceViewer the source viewer this manager connects to * @param annotationHover the annotation hover providing the information to be displayed * @param creator the information control creator */ public OverviewRulerHoverManager(IOverviewRuler ruler, ISourceViewer sourceViewer, IAnnotationHover annotationHover, IInformationControlCreator creator) { super(ruler, sourceViewer, annotationHover, creator); setAnchor(ANCHOR_LEFT); StyledText textWidget= sourceViewer.getTextWidget(); if (textWidget != null) { ScrollBar verticalBar= textWidget.getVerticalBar(); if (verticalBar != null) setMargins(verticalBar.getSize().x, 5); } }
/** * After this method has been executed the caller knows that any installed overview hover has been installed. */ protected void ensureOverviewHoverManagerInstalled() { if (fOverviewRuler != null && fOverviewRulerAnnotationHover != null && fOverviewRulerHoveringController == null && fHoverControlCreator != null) { fOverviewRulerHoveringController= new OverviewRulerHoverManager(fOverviewRuler, this, fOverviewRulerAnnotationHover, fHoverControlCreator); fOverviewRulerHoveringController.install(fOverviewRuler.getControl()); fOverviewRulerHoveringController.getInternalAccessor().setInformationControlReplacer(new StickyHoverManager(this)); } }
/** * Determines graphical area covered for which the hover is valid. * * @param y y-coordinate in the vertical ruler * @return the graphical extend where the hover is valid */ private Rectangle computeArea(int y) { // This is OK (see constructor) IOverviewRuler overviewRuler= (IOverviewRuler) getVerticalRulerInfo(); int hover_height= overviewRuler.getAnnotationHeight(); int hover_width= getVerticalRulerInfo().getControl().getSize().x; // Calculate y-coordinate for hover int hover_y= y; boolean hasAnnotation= true; while (hasAnnotation && hover_y > y - hover_height) { hover_y--; hasAnnotation= overviewRuler.hasAnnotation(hover_y); } hover_y++; return new Rectangle(0, hover_y, hover_width, hover_height); } }
@Override protected void computeInformation() { Point location= getHoverEventLocation(); int line= getVerticalRulerInfo().toDocumentLineNumber(location.y); IAnnotationHover hover= getAnnotationHover(); IInformationControlCreator controlCreator= null; if (hover instanceof IAnnotationHoverExtension) controlCreator= ((IAnnotationHoverExtension)hover).getHoverControlCreator(); setCustomInformationControlCreator(controlCreator); setInformation(hover.getHoverInfo(getSourceViewer(), line), computeArea(location.y)); }