Issue
I creating an editor for my own language in Eclipse. In this language, there are javadoc-like documentation comments. I'm using class ITextHover to show this documentation when the mouse cursor is above name of the commented function.
The problem is that my documentation contains basic HTML tags (list, table, bold) but the hover shows only plain text. For example:
Of course, I would like it to look like this:
I know for sure that this kind of text formatting in a hover can be handled by eclipse because e.g. Java editor does that.
Unfortunately, the only clue I found so far is to use class IInformationPresenter and I can't found any information about what this class does or how to use it. Can someone help?
Solution
Your ITextHover class should implement ITextHoverExtension and return an IInformationControl that can handle HTML. The standard DefaultInformationControl handles simple HTML.
An example is the text hover from the standard text editor:
class TextHover extends DefaultTextHover implements ITextHoverExtension {
public TextHover(ISourceViewer sourceViewer) {
super(sourceViewer);
}
... other stuff ...
@Override
public IInformationControlCreator getHoverControlCreator() {
return new IInformationControlCreator() {
@Override
public IInformationControl createInformationControl(Shell parent) {
return new DefaultInformationControl(parent, EditorsUI.getTooltipAffordanceString());
}
};
}
}
Answered By - greg-449


0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.