return Collections.singleton(ActionsManager.ACTION_TOGGLE_BREAKPOINT);
}
@Override
public void doAction(Object action) {
DebuggerManager d = DebuggerManager.getDebuggerManager();
// 1) get source name & line number
int lineNumber = EditorContextBridge.getContext().getCurrentLineNumber();
String url = EditorContextBridge.getContext().getCurrentURL();
if ("".equals(url.trim())) {
return;
}
// 2) find and remove existing line breakpoint
LineBreakpoint lb = findBreakpoint(url, lineNumber);
if (lb != null) {
d.removeBreakpoint(lb);
return;
}
// Breakpoint[] bs = d.getBreakpoints ();
// int i, k = bs.length;
// for (i = 0; i < k; i++) {
// if (!(bs [i] instanceof LineBreakpoint)) continue;
// LineBreakpoint lb = (LineBreakpoint) bs [i];
// if (ln != lb.getLineNumber ()) continue;
// if (!url.equals (lb.getURL ())) continue;
// d.removeBreakpoint (lb);
// return;
// }
// 3) create a new line breakpoint
lb = LineBreakpoint.create(url, lineNumber);
lb.setPrintText(NbBundle.getBundle(ToggleBreakpointActionProvider.class).getString("CTL_Line_Breakpoint_Print_Text"));
d.addBreakpoint(lb);
}