public class LineChangeHover extends Object implements IAnnotationHover, IAnnotationHoverExtension, IInformationProviderExtension2
Constructor and Description |
---|
LineChangeHover() |
Modifier and Type | Method and Description |
---|---|
boolean |
canHandleMouseCursor()
Returns whether the provided information control can interact with the mouse cursor.
|
protected Point |
computeLineRange(ISourceViewer viewer,
int line,
int min,
int max)
Computes the block of lines which form a contiguous block of changes covering
line . |
protected String |
decorateText(List diffInfos,
int maxLines)
Takes a list of
ILineDiffInfo s and computes a hover of at most maxLines . |
protected String |
formatSource(String content)
Formats the source w/ syntax coloring etc.
|
IInformationControlCreator |
getHoverControlCreator()
Returns the hover control creator of this annotation hover.
|
Object |
getHoverInfo(ISourceViewer sourceViewer,
ILineRange lineRange,
int visibleLines)
Returns the object which should be presented in the a
hover popup window.
|
String |
getHoverInfo(ISourceViewer sourceViewer,
int lineNumber)
Returns the text which should be presented in the a
hover popup window.
|
ILineRange |
getHoverLineRange(ISourceViewer viewer,
int lineNumber)
Returns the range of lines that include the given line number for which
the same hover information is valid.
|
IInformationControlCreator |
getInformationPresenterControlCreator()
Returns the information control creator of this information provider.
|
protected String |
getTabReplacement()
Returns a replacement for the tab character.
|
public String getHoverInfo(ISourceViewer sourceViewer, int lineNumber)
IAnnotationHover
getHoverInfo
in interface IAnnotationHover
sourceViewer
- the source viewer this hover is registered withlineNumber
- the line number for which information is requestednull
if no such information existsprotected String formatSource(String content)
content
- the hover contentcontent
reformattedprotected String getTabReplacement()
protected String decorateText(List diffInfos, int maxLines)
ILineDiffInfo
s and computes a hover of at most maxLines
.
Added lines are prefixed with a '+'
, changed lines with '>'
and
deleted lines with '-'
.
Deleted and added lines can even each other out, so that a number of deleted lines get displayed where - in the current document - the added lines are.
diffInfos
- a List
of ILineDiffInfo
maxLines
- the maximum number of lines. Note that adding up all annotations might give
more than that due to deleted lines.String
suitable for hover displayprotected Point computeLineRange(ISourceViewer viewer, int line, int min, int max)
line
.viewer
- the source viewer showingline
- the line which a hover is displayed formin
- the first line in viewer
's document to considermax
- the last line in viewer
's document to considerviewer
containing line
that is covered by the hover information returned by the receiver.public Object getHoverInfo(ISourceViewer sourceViewer, ILineRange lineRange, int visibleLines)
IAnnotationHoverExtension
getHoverInfo
in interface IAnnotationHoverExtension
sourceViewer
- the source viewer this hover is registered withlineRange
- the line range for which information is requestedvisibleLines
- the number of visible linesnull
if no such information existspublic ILineRange getHoverLineRange(ISourceViewer viewer, int lineNumber)
IAnnotationHoverExtension
getHoverLineRange
in interface IAnnotationHoverExtension
viewer
- the viewer which the hover is queried forlineNumber
- the line number of the line for which a hover is displayed fornull
for no rangepublic boolean canHandleMouseCursor()
IAnnotationHoverExtension
canHandleMouseCursor
in interface IAnnotationHoverExtension
true
if the mouse cursor can be handledpublic IInformationControlCreator getHoverControlCreator()
IAnnotationHoverExtension
getHoverControlCreator
in interface IAnnotationHoverExtension
public IInformationControlCreator getInformationPresenterControlCreator()
IInformationProviderExtension2
getInformationPresenterControlCreator
in interface IInformationProviderExtension2
null
if none is available
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.