Programmatically adding IJavaLineBreakpoint to source file with one token per line

49 Views Asked by At

I am currently working with the debugging side of JDT. I have code to add breakpoints to lines that works under normal circumstances but I have some strange requirements.

The source code I am working with is one token per line. So instead of 'JFrame frame = new JFrame(..)' I have:

(10) JFrame
(12) frame
(13) =
(14) new
(15) JFrame
(16) (
(17) ...
(18) )

When I try to install a breakpoint at line 14 my registered listeners get all the required events (addingBreakpoint, installingBreakpoint & breakpointInstalled) and everything is fine and dandy.

However if I try to install a breakpoint at line 10 I don't get the breakpointInstalled event; only addingBreakpoint and installingBreakpoint. The breakpoint isn't installed.

Interestingly, if you pop code into eclipse as one token per line like above; and then try to insert a breakpoint at line 10; it instead puts it in at line 14. Somehow it is finding the closest valid line.

My question is, Does anyone either:

  1. Know how to programmatically find the next valid line.
  2. Know which source code file I might need to dig through to figure out how eclipse does it.
  3. Or know how to detect when installing a breakpoint fails.
0

There are 0 best solutions below