What is the ToolTip library that Eclipse uses when hovering over variables?

霸气de小男生 提交于 2019-12-11 02:17:36

问题


Eclipse has these highly interactive tooltips that appear when you hover over variables while debugging. You can actually click on the inside of these tooltips (or press F2) to focus and start interacting with the controls inside of it (specifically to explore that variable's object and its contents).

I really want to know if the library for this interactive ToolTip is accessible so I can use it for my own project. I like how it acts like a ToolTip until you click on it, then it persists until you exit it. I also like how it is easily resizeable. I could make some very awesome instant reports in my Java application using this interactive ToolTip. I am guessing it supports adding JComponents too and acts as a container.

I played with the JCustomTooltip library by Prefuse but I like Eclipse's better as it's more elegant.

Can someone point to it in a library somewhere? I'll even look at the Eclipse GITHub project if it is easily extractable.


回答1:


First off, all the Eclipse code is based on SWT, you mention Swing which SWT is not compatible with.

Eclipse actually uses several different classes to do the various tooltips.

The easiest to use is org.eclipse.jface.window.ToolTip which can be added to most SWT controls. You provide a subclass which can use any SWT controls in the popup window. There is also DefaultToolTip which provides a simpler interface.

The hover windows you see in things like the Java editor use a much more elaborate mechanism provided by the Eclipse text editor support based on the ITextHover, ITextHoverExtension, IInformationControlCreator, and IInformationControl interfaces. Since they rely heavily on support code in the Eclipse text editor classes they can't easily be used outside of this environment.



来源:https://stackoverflow.com/questions/22214399/what-is-the-tooltip-library-that-eclipse-uses-when-hovering-over-variables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!