Conditional breakpoints are breakpoints that suspend code and open the debugger only when certain conditions are met. For example, you can set a breakpoint to suspend code only if a variable's value falls in a particular range of values.
To set conditions on a breakpoint, click mouse button 2 on the breakpoint symbol , and select Modify from
the pop-up menu.
In the dialog that appears, you can select a condition from the drop-down list, or you can type in your own condition. (The drop-down list contains up to ten conditions you have previously set on breakpoints). If the condition is evaluated to a boolean value of true, then the breakpoint suspends the code and opens the Debugger browser.
Example: Using a Conditional Breakpoint
Configuring the Breakpoint to Do Something
Similarly, you can configure a breakpoint to run a Java statement and then return
true or false. For example, when the IDE encounters the breakpoint, you can have it
output a message and then evaluate to false, thereby not suspending the code.
The text entry field in the dialog has code assist support; if you type in the start of a package or class name, press Ctrl+Spacebar to get a pop-up list of available classes or methods. Select the desired one by continuing to type or by using the arrow keys, and press Enter.
Example: Configuring a Breakpoint to Print a Message
Setting Breakpoints in Source Code
Clearing and Disabling Breakpoints