Customising debugger actions

Answered

Is it possible to add actions to the context menu on variables in the debugger? - I'd like to be able to add an option that, when I right click and select it, runs an action and gets the contents of the selected variable - a peer with "Evaluate Expression" or "Add to watches".

0
4 comments

Hi Richard,

Do you mean that you want to add your action in the menu that appears on right mouse click in editor? If so, you should implement an action and add it to EditorPopupMenu group, see http://www.jetbrains.org/intellij/sdk/docs/basics/action_system.html for details.

As for action itself, are you going to implement something like QuickEvaluateAction (its Alt+Cmd+F8 or Alt+Click on expression)?

0

Hi Alexander,

Yes, but in the debugger variables rather than the editor, as here:

so that I can access the value of (e.g) requiredPeriods [ My popup would then create a Junit assertion for the value ].

I can't find the action group defined for this, but http://keithlea.com/idea-actions/ suggests it might be "Debugger"?

0

Got it now. I believe that it's 'XDebugger.Actions' group. In the action you can use following method in order to get selected variable:

com.intellij.xdebugger.impl.ui.tree.actions.XDebuggerTreeActionBase#getSelectedNode(e.getDataContext())

Please let me know if it doesn't work.

0
XDebugger.Variables.Tree.Popup worked, and the getSelectedNode gives me details on the context variable.

Thanks for your help!

0

Please sign in to leave a comment.