private IAnnotationHover createProjectionAnnotationHover() { ProjectionAnnotationHover hover= new ProjectionAnnotationHover(); hover.setHoverControlCreator(fInformationControlCreator); hover.setInformationPresenterControlCreator(fInformationPresenterControlCreator); return hover; }
private String getProjectionTextAtLine(ISourceViewer viewer, int line, int numberOfLines) { IAnnotationModel model= null; if (viewer instanceof ISourceViewerExtension2) { ISourceViewerExtension2 viewerExtension= (ISourceViewerExtension2) viewer; IAnnotationModel visual= viewerExtension.getVisualAnnotationModel(); if (visual instanceof IAnnotationModelExtension) { IAnnotationModelExtension modelExtension= (IAnnotationModelExtension) visual; model= modelExtension.getAnnotationModel(ProjectionSupport.PROJECTION); } } if (model != null) { try { IDocument document= viewer.getDocument(); Iterator<Annotation> e= model.getAnnotationIterator(); while (e.hasNext()) { ProjectionAnnotation annotation= (ProjectionAnnotation) e.next(); if (!annotation.isCollapsed()) continue; Position position= model.getPosition(annotation); if (position == null) continue; if (isCaptionLine(position, document, line)) return getText(document, position.getOffset(), position.getLength(), numberOfLines); } } catch (BadLocationException x) { } } return null; }
@Override public Object getHoverInfo(ISourceViewer sourceViewer, ILineRange lineRange, int visibleLines) { return getProjectionTextAtLine(sourceViewer, lineRange.getStartLine(), visibleLines); }
private String getProjectionTextAtLine(ISourceViewer viewer, int line, int numberOfLines) { IAnnotationModel model= null; if (viewer instanceof ISourceViewerExtension2) { ISourceViewerExtension2 viewerExtension= (ISourceViewerExtension2) viewer; IAnnotationModel visual= viewerExtension.getVisualAnnotationModel(); if (visual instanceof IAnnotationModelExtension) { IAnnotationModelExtension modelExtension= (IAnnotationModelExtension) visual; model= modelExtension.getAnnotationModel(ProjectionSupport.PROJECTION); } } if (model != null) { try { IDocument document= viewer.getDocument(); Iterator<Annotation> e= model.getAnnotationIterator(); while (e.hasNext()) { ProjectionAnnotation annotation= (ProjectionAnnotation) e.next(); if (!annotation.isCollapsed()) continue; Position position= model.getPosition(annotation); if (position == null) continue; if (isCaptionLine(position, document, line)) return getText(document, position.getOffset(), position.getLength(), numberOfLines); } } catch (BadLocationException x) { } } return null; }
@Override public Object getHoverInfo(ISourceViewer sourceViewer, ILineRange lineRange, int visibleLines) { return getProjectionTextAtLine(sourceViewer, lineRange.getStartLine(), visibleLines); }
private IAnnotationHover createProjectionAnnotationHover() { ProjectionAnnotationHover hover= new ProjectionAnnotationHover(); hover.setHoverControlCreator(fInformationControlCreator); hover.setInformationPresenterControlCreator(fInformationPresenterControlCreator); return hover; }