org.eclipse.xtext.ui.editor.hover
Class AbstractHover

java.lang.Object
  extended by org.eclipse.xtext.ui.editor.hover.AbstractHover
All Implemented Interfaces:
org.eclipse.jface.text.ITextHover, org.eclipse.jface.text.ITextHoverExtension, org.eclipse.jface.text.ITextHoverExtension2, ISourceViewerAware
Direct Known Subclasses:
AbstractEObjectHover, AbstractProblemHover

public abstract class AbstractHover
extends java.lang.Object
implements org.eclipse.jface.text.ITextHover, org.eclipse.jface.text.ITextHoverExtension, org.eclipse.jface.text.ITextHoverExtension2, ISourceViewerAware

Author:
Patrick Schoenbach - Initial API and implementation

Field Summary
protected  org.eclipse.jface.text.source.ISourceViewer sourceViewer
           
 
Constructor Summary
AbstractHover()
           
 
Method Summary
 org.eclipse.jface.text.IDocument getDocument()
           
 org.eclipse.jface.text.IInformationControlCreator getHoverControlCreator()
          Returns the hover control creator of this text hover or null
 java.lang.String getHoverInfo(org.eclipse.jface.text.ITextViewer textViewer, org.eclipse.jface.text.IRegion hoverRegion)
          Deprecated. Use ITextHoverExtension2.getHoverInfo2(ITextViewer, IRegion) instead
 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.
 int getLineNumber(org.eclipse.jface.text.ITextViewer textViewer, org.eclipse.jface.text.IRegion hoverRegion)
           
 void setSourceViewer(org.eclipse.jface.text.source.ISourceViewer sourceViewer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.text.ITextHoverExtension2
getHoverInfo2
 

Field Detail

sourceViewer

protected org.eclipse.jface.text.source.ISourceViewer sourceViewer
Constructor Detail

AbstractHover

public AbstractHover()
Method Detail

setSourceViewer

public void setSourceViewer(org.eclipse.jface.text.source.ISourceViewer sourceViewer)
Specified by:
setSourceViewer in interface ISourceViewerAware

getDocument

public org.eclipse.jface.text.IDocument getDocument()

getHoverInfo

@Deprecated
public java.lang.String getHoverInfo(org.eclipse.jface.text.ITextViewer textViewer,
                                                org.eclipse.jface.text.IRegion hoverRegion)
Deprecated. Use ITextHoverExtension2.getHoverInfo2(ITextViewer, IRegion) instead

Description copied from interface: org.eclipse.jface.text.ITextHover
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 getHoverRegion. If the returned information is null or empty no hover popup will be shown.

Specified by:
getHoverInfo in interface org.eclipse.jface.text.ITextHover
Parameters:
textViewer - the viewer on which the hover popup should be shown
hoverRegion - 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

getLineNumber

public int getLineNumber(org.eclipse.jface.text.ITextViewer textViewer,
                         org.eclipse.jface.text.IRegion hoverRegion)
                  throws org.eclipse.jface.text.BadLocationException
Throws:
org.eclipse.jface.text.BadLocationException

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
Parameters:
textViewer - the viewer on which the hover popup should be shown
offset - the offset for which the hover request has been issued
Returns:
the hover region used to compute the hover display information

getHoverControlCreator

public org.eclipse.jface.text.IInformationControlCreator getHoverControlCreator()
Description copied from interface: org.eclipse.jface.text.ITextHoverExtension
Returns the hover control creator of this text hover or null

Specified by:
getHoverControlCreator in interface org.eclipse.jface.text.ITextHoverExtension
Returns:
the hover control creator or null