How to add breakpoint with my plugin


I'm developing a plugin and I'm in a situation where I have a class name and line number and I would like to add a breakpoint for this class and line (condition breakpoint actually, but this I will investigate later).

Thanks for any hint

Comment actions Permalink

It is possible but the required classes aren't included into Open API so use it at your own risk:
DebuggerManagerEx.getInstanceEx(project).getBreakpointManager().addLineBreakpoint(document, line)

Nikolay Chashnikov
Software Developer
JetBrains, Inc
"Develop with pleasure!"

Comment actions Permalink

Thank you Nikolay it works. I thought that conditional breakpouint would be easy, but I didn't find a way.

I used following construction

     BreakpointFactory testBreakpointFactory = BreakpointFactory.getInstance(new Key<LineBreakpoint>("test"));

and  planned to create new breakpoint by the factory (with class, line, condition ....), but there is only method

  createBreakpoint(com.intellij.openapi.project.Project project, org.jdom.Element element);

I assume element contains all those params, but I'm wondering what is the structure.

Thanks again Milan

Comment actions Permalink

BreakpointManager.addLineBreakpoint() gives you back a LineBreakpoint object. Doesn't it work to do a getCondition().setText("<your condition here>") on the LineBreakpoint instance? Just an idea, didn't test it though.

Comment actions Permalink

Thanks Bjorn! I have downloaded the Idea source code during the weekend and now many things make sense ;-). It works perfectly!


Please sign in to leave a comment.