org.eclipse.datatools.sqltools.sqleditor.internal.sql
Class SQLAnnotationHover

java.lang.Object
  extended by org.eclipse.datatools.sqltools.sqleditor.sql.AbstractSQLEditorTextHover
      extended by org.eclipse.datatools.sqltools.sqleditor.internal.sql.SQLAnnotationHover
All Implemented Interfaces:
org.eclipse.jface.text.ITextHover, org.eclipse.jface.text.ITextHoverExtension, org.eclipse.jface.text.source.IAnnotationHover

public class SQLAnnotationHover
extends AbstractSQLEditorTextHover
implements org.eclipse.jface.text.ITextHover, org.eclipse.jface.text.source.IAnnotationHover, org.eclipse.jface.text.ITextHoverExtension

This class provides annotation hover (tooltip) support for SQL syntax error and portability target annotations.

Author:
Hui Cao

Constructor Summary
SQLAnnotationHover(org.eclipse.ui.IEditorPart editor)
           
 
Method Summary
 java.lang.String getHoverInfo(org.eclipse.jface.text.source.ISourceViewer sourceViewer, int lineNumber)
          Returns the text which should be presented in the a hover popup window.
 java.lang.String getHoverInfo(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.
 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.
 void setEditor(org.eclipse.ui.IEditorPart editor)
          Associates a SQL editor with this hover.
 
Methods inherited from class org.eclipse.datatools.sqltools.sqleditor.sql.AbstractSQLEditorTextHover
getHoverControlCreator
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.text.ITextHoverExtension
getHoverControlCreator
 

Constructor Detail

SQLAnnotationHover

public SQLAnnotationHover(org.eclipse.ui.IEditorPart editor)
Method Detail

getHoverInfo

public java.lang.String getHoverInfo(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. 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

getHoverRegion

public 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. 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 AbstractSQLEditorTextHover
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

getHoverInfo

public java.lang.String getHoverInfo(org.eclipse.jface.text.source.ISourceViewer sourceViewer,
                                     int lineNumber)
Returns the text which should be presented in the a hover popup window. This information is requested based on the specified line number.

Specified by:
getHoverInfo in interface org.eclipse.jface.text.source.IAnnotationHover
Parameters:
sourceViewer - the source viewer this hover is registered with
lineNumber - the line number for which information is requested
Returns:
the requested information or null if no such information exists

setEditor

public void setEditor(org.eclipse.ui.IEditorPart editor)
Description copied from class: AbstractSQLEditorTextHover
Associates a SQL editor with this hover. Subclass can cache it for later use.

Specified by:
setEditor in class AbstractSQLEditorTextHover