Question

I have a graphical representation for my model, and I want to implement a tooltip that look like jdt tooltip in the following :
- the tooltip shows up when hover over the object in the canvas
- being able to click on the tooltip window to focus, and scroll bar is there if needed.
- Ability to resize the tooltip window after the user change focus to it
- being able to assign command with F2 keybind to pop up the tooltip window (I know how to create command, and how to associate keybind with it)
- Ability to have hyperlinks in the tooltip text ( optional )

I do not know from where to start.
Which eclipse interfaces/classes to implement, extensions to add, adaptors to support.

I tried to find a work through tutorial but I could not.

Thanks in advance

Était-ce utile?

La solution

A lot of what you describe is specific to the Eclipse Text editor and JDT code so won't be available in a Canvas so you would have to write your own code.

You can create a tooltip based on org.eclipse.jface.window.ToolTip. If the tooltip contains StyledText you can create hyperlinks.

There is an example of a fairly elaborate custom tooltip Here

What Eclipse does when the tooltip is clicked is open a new normal window of exactly the same size and contents over the tooltip and close the tooltip.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top