Reputation: 4192
I would like to programmatically set/create a breakpoint in another file at an arbitrary line number in Eclipse. I would love to see a generic solution, but I guess I have to rely on the Eclipse JDT plugin for it. How can I do that? I tried something like:
JDIDebugModel.createLineBreakpoint(resource, typeName, lineNumber, -1, -1, 0, false, null);
But I have two problems with it:
/usr/local/eclipse/plugins/org.eclipse.core.resources_3.9.0.v20140514-1307.jar
. If I add them, they require other ones etc. I probably have to add all Eclipse plugins/libraries to make it work.null
value will most probably not work. But all implementations of IResource
are internal...I also thought about directly communicating with the JDI, but I could not get it going in combination with the Eclipse debugger (here is a great, but german resource for it).
If it is not possible from arbitrary code, would it be possible from within an Eclipse plugin? This would also be an option, though not preferable.
I could not find any solution for it and hope to get some help here. Thanks in advance!
Upvotes: 0
Views: 685
Reputation: 111142
Most Eclipse plugins can only be run in the Eclipse environment because they rely on the Eclipse/OSGi plugin infrastructure being initialized properly.
Since JDIDebugModel.createLineBreakpoint
requires an IResource
object it can only be used in the Eclipse IDE (or an RCP based on the IDE) with a workspace.
So, yes, you can use this in a Eclipse plugin which would have to be installed in to Eclipse or an Eclipse RCP.
Upvotes: 2