Question

I have made my own editor by creating an eclipse plugin. I have implemented the code folding successfully and now I want to display instruction/function information on mouseover.
For example:
There is a instruction/function: print, in one of the file and this is used in other file(or may be same file), then on hovering over print it should display what it contains or may be comment written on top of it. How to achieve this?
Also I want to jump to the function print if user presses F3, as it happens in java editor

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top