I'm really no debugging expert and lately I came across a problem which hopefully has an easy solution. When I test and debug the Mathematica plugin for IDEA, I write some code, build it and run it in a sandbox IDEA.
For those who are not familiar with writing plugins for IDEA: The main problem is, that all the UI code is already there because it comes with IDEA. My plugin only implements specific interfaces which are required to make IDEA understand the Mathematica language. Therefore, setting a breakpoint or throwing something in an onClickListener
like suggested by @Jeroen is not possible, because I virtually haven't written any single line of UI code*.
Now I had the situation that everything works fine, but when I cancel a specific action, something weird happens. I have no idea which specific method (it is none of mine!) is called at the moment when I press Esc to cancel this action. The current point is very likely deep inside the sources of IDEA which I have and which I can navigate with the debugger!.
Question: What is the easiest way in Java to make the debugger break, wherever it might be when I press Esc in the UI-program I currently debug?
*This is not entirely true, but for the sake of a general solution I would like to think of it that way.