This is how I did it:
In the TextSourceViewerConfiguration
class(instantiated in Editor's initialize function), add the following code to instantiate the text hover class:
//global variable
private ITextHover hover_class
@Override
public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType) {
if(hover_class==null)
//instantiate the hover class
return hover_class
Next, create the class that was instantiated in the previous step. It should implement ITextHover
, ITextHoverExtension
. The class getHoverRegion()
, getHoverInfo()
, getHoverControCreator()
can be used to display needed information.