Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » How to display a custom tooltip on mouse hover over a line of code in C/C++ perspective?
How to display a custom tooltip on mouse hover over a line of code in C/C++ perspective? [message #1842461] Sun, 20 June 2021 10:26 Go to next message
Eclipse UserFriend
I have an eclipse-rcp project which is used to develop embedded software (C/C++ projects). I would like to display a custom tooltip when the mouse hovers for a couple of seconds over a line of code in the code editor of the C/C++ perspective. The text should contain the path and name of the file and the line number at which the mouse is hovering. Something like when you hover over a class name in the java editor (find the attached image).
What is the correct way to implement this?
Re: How to display a custom tooltip on mouse hover over a line of code in C/C++ perspective? [message #1843166 is a reply to message #1842461] Sat, 17 July 2021 03:51 Go to previous message
Eclipse UserFriend
I had a similar problem, when activating the 'hover' feature for C++ code in eclipse.
In this case, the Doxygen documentation (= my 'customer tooltip') had to become visible when hovering with cursor over a word.
This did need the modification of several items to get it working.

In your case, it looks somewhat easier: I assume, that you have alredy added the cdt-hover plugin in eclipse.
In that case, you just need to adapt (edit the java code) the plugin 'org.eclipse.linuxtools.cdt.libhover'.

There exists a function 'getFunctionInfo' in file 'LibHover.java'.
Whenever you hover with cursor over any word in your C++ text-editor window, then this function is called. (make a breakpoint there for debugging).

Inside that function 'getFunctionInfo', there is a line like 'IRegion region...'.
This variable 'region' will contain offset and length of the hovered word inside your file.
You can then use this information to create your 'custom tooltip', which is for me the same as a 'hover information'.


Previous Topic:Error Copying Volume
Next Topic:"Index -> Rebuild" gets ignored unless I delete the [Subprojects] folder from project t
Goto Forum:
  


Current Time: Tue Jul 08 01:58:32 EDT 2025

Powered by FUDForum. Page generated in 0.28661 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top