org.eclipse.xtext.ui.editor.hover
Class AbstractProblemHover
java.lang.Object
org.eclipse.xtext.ui.editor.hover.AbstractHover
org.eclipse.xtext.ui.editor.hover.AbstractProblemHover
- All Implemented Interfaces:
- org.eclipse.jface.text.ITextHover, org.eclipse.jface.text.ITextHoverExtension, org.eclipse.jface.text.ITextHoverExtension2, ISourceViewerAware
- Direct Known Subclasses:
- AnnotationWithQuickFixesHover, ProblemAnnotationHover
public abstract class AbstractProblemHover
- extends AbstractHover
Base class for all hovers showing annotations and problems.
- Author:
- Christoph Kulla - Initial contribution and API
Method Summary |
protected org.eclipse.jface.text.source.IAnnotationModel |
getAnnotationModel()
|
java.util.List<org.eclipse.jface.text.source.Annotation> |
getAnnotations(int lineNumber,
int offset)
|
java.lang.Object |
getHoverInfo2(org.eclipse.jface.text.ITextViewer textViewer,
org.eclipse.jface.text.IRegion hoverRegion)
Returns the information which should be presented when a hover popup is shown
for the specified hover region. |
protected abstract java.lang.Object |
getHoverInfoInternal(org.eclipse.jface.text.ITextViewer textViewer,
int lineNumber,
int offset)
|
org.eclipse.jface.text.IRegion |
getHoverRegion(org.eclipse.jface.text.ITextViewer textViewer,
int offset)
Returns the text region which should serve as the source of information
to compute the hover popup display information. |
protected abstract org.eclipse.jface.text.IRegion |
getHoverRegionInternal(int lineNumber,
int offset)
|
protected boolean |
isLineDiffInfo(org.eclipse.jface.text.source.Annotation annotation)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractProblemHover
public AbstractProblemHover()
getHoverRegion
public org.eclipse.jface.text.IRegion getHoverRegion(org.eclipse.jface.text.ITextViewer textViewer,
int offset)
- Description copied from interface:
org.eclipse.jface.text.ITextHover
- Returns the text region which should serve as the source of information
to compute the hover popup display information. The popup has been requested
for the given offset.
For example, if hover information can be provided on a per method basis in a
source viewer, the offset should be used to find the enclosing method and the
source range of the method should be returned.
- Specified by:
getHoverRegion
in interface org.eclipse.jface.text.ITextHover
- Overrides:
getHoverRegion
in class AbstractHover
- Parameters:
textViewer
- the viewer on which the hover popup should be shownoffset
- the offset for which the hover request has been issued
- Returns:
- the hover region used to compute the hover display information
getHoverRegionInternal
protected abstract org.eclipse.jface.text.IRegion getHoverRegionInternal(int lineNumber,
int offset)
getHoverInfo2
public java.lang.Object getHoverInfo2(org.eclipse.jface.text.ITextViewer textViewer,
org.eclipse.jface.text.IRegion hoverRegion)
- Description copied from interface:
org.eclipse.jface.text.ITextHoverExtension2
- Returns the information which should be presented when a hover popup is shown
for the specified hover region. The hover region has the same semantics
as the region returned by
ITextHover.getHoverRegion(ITextViewer, int)
.
If the returned information is null
, no hover popup will be shown.
Note: Implementers have to ensure that ITextHoverExtension.getHoverControlCreator()
returns IInformationControl
s that implement
IInformationControlExtension2
and whose
IInformationControlExtension2.setInput(Object)
can handle the
information objects returned by this method.
Callers should ignore the text returned by ITextHover.getHoverInfo(ITextViewer, IRegion)
.
- Parameters:
textViewer
- the viewer on which the hover popup should be shownhoverRegion
- the text range in the viewer which is used to determine
the hover display information
- Returns:
- the hover popup display information, or
null
if none available
getHoverInfoInternal
protected abstract java.lang.Object getHoverInfoInternal(org.eclipse.jface.text.ITextViewer textViewer,
int lineNumber,
int offset)
getAnnotationModel
protected org.eclipse.jface.text.source.IAnnotationModel getAnnotationModel()
getAnnotations
public java.util.List<org.eclipse.jface.text.source.Annotation> getAnnotations(int lineNumber,
int offset)
isLineDiffInfo
protected boolean isLineDiffInfo(org.eclipse.jface.text.source.Annotation annotation)