Configure Those Annoying Tooltips in Eclipse to Only Popup on Request

DZone 's Guide to

Configure Those Annoying Tooltips in Eclipse to Only Popup on Request

· Java Zone ·
Free Resource

Whenever you hover over any piece of code in Eclipse, it pops up a tooltip that displays more information about the item, such as its declaration, variable values or Javadoc information, as in the example below.

Although useful at times, this becomes extremely annoying after a while, especially when you’re using your mouse to browse some code. Popup after popup of unwanted information keeps obscuring your view of the code, leading to some lengthy expletives and big productivity loss. It’s useful information, but not every time all the time, almost like your car’s GPS giving you directions to 10 different places at once while you’re still parked in the driveway.

Luckily there is a way to alleviate the problem and all it takes is changing some preferences in Eclipse. We don’t want to completely disable tooltips (they can be useful), so I’ll show you how to tell Eclipse to bring up the tooltips only when you request them.

Show tooltips only on request

To tell Eclipse to only show tooltips on request, do the following:

  1. Go to Window > Preferences > Java > Editor > Hovers.
  2. Select the Source item in the list. Make sure the entire row is highlighted and that the checkbox is selected.
  3. Move focus to the Pressed key modifier while hovering field, positioning the cursor at the end of the default value Shift. Press and release Ctrl. The value should now read Shift+Ctrl. If you made a mistake, just clear the field by pressing Backspace or Delete and try again.
  4. Select the Combined Hover item in the list.
  5. Move focus to the Pressed key modifier while hovering field and press Shift. The value should now read Shift.
  6. Click Ok to accept the changes.

The preferences should look something like this:

You should now notice the following:

  • If you want to show the Javadoc or the declaration of some element hold down Shift while hovering over the element.
  • Variable values won’t popup automatically anymore. To show a variable’s value in debug mode, press Shift and hover over the variable. This is probably the only time when it’s a bit of a hassle to press Shift, but the pros totally outweigh the cons here as I view variable values a lot less than the number of times annoying tooltips appear.
  • If you want to show a quick preview of a method’s code, press Ctrl+Shift and hover over the method. This is a nice feature combined with the tooltip enrichment Eclipse provides, so you can view a method’s code in a scrollable tooltip without having to navigate to the method and back again.

Other options – configure, disable or use the keyboard

You can, of course, choose your own modifier keys in Preferences, but these are the ones I found that work the best, especially given that Ctrl and a click is a way to go to an element’s declaration or implementation in Eclipse. I’ve found Shift to conflict the least with existing features and easy enough to use on a frequent basis. Keep in mind that 2 hovers can’t share the same modifier key (which is why we reassigned the Source hover to use Shift+Ctrl).

You can also disable tooltips completely by deselecting the Combined Hover checkbox in the preference above, but I’ve found the Shift key to be a nice middle ground so keep it enabled.

To get similar information using the keyboard, press F2 while the cursor’s positioned on the code. To show variable values in debug mode, press Ctrl+Shift+D. A nice tip if you’ve disabled tooltips completely.

From http://eclipseone.wordpress.com/2010/08/24/configure-tooltips-in-eclipse-to-only-popup-on-request/


Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}