0
votes

Is there a way I can make it so Inspect (see picture from context menu) is called when I hover on a selected text/code in an editor (e.g. Java editor)? I can see the menu at Preferences->Java->Editor->Hovers but I was wondering if I could tweak it more than that as I need to be able to debug things like this.getInstance()

Right click on some code shows Inspect and a keyboard combination Ctrl+Shift+I

I'm running Eclipse Luna 4.4.2.

1

1 Answers

0
votes

The Hover options in Eclipse are those that you see :

enter image description here

There is not any option for the execution of statements and it makes sense for a Hover option.
If the statement to execute with inspect doesn't have any side effect, your idea would be acceptable. But if the statement has a side effect, it would be undesirable to have random executions according to the pointer of the mouse on the screen.

Note that other debugger tools are less strict than Eclipse : instead of using the hover + key combination, they use the selection of the expression to evaluate and display its result.
But Eclipse doesn't have this option.
A workaround in Eclipse would be to change the Inspect shortcut (in Key preferences) with a much simpler shortcut such as the i letter.
In this way select this.getInstance() + I entered trigger the inspection :

enter image description here