private boolean submitFieldOrMethodBreakpoint(String className, String fieldName,
String methodName, String methodSignature,
String url, int line) {
// 2) find and remove existing line breakpoint
JPDABreakpoint b;
if (fieldName != null) {
b = findBreakpoint (className, fieldName);
} else if (methodName != null) {
b = findBreakpoint (className, methodName, methodSignature);
} else {
return false;
}
if (b == null) {
b = ToggleBreakpointActionProvider.findBreakpoint(url, line);
}
DebuggerManager d = DebuggerManager.getDebuggerManager();
if (b != null) {
d.removeBreakpoint (b);
return true;
}
// 3) create a new breakpoint
if (fieldName != null) {
b = FieldBreakpoint.create(className, fieldName, FieldBreakpoint.TYPE_MODIFICATION | FieldBreakpoint.TYPE_ACCESS);
b.setPrintText(NbBundle.getMessage(FieldBreakpointPanel.class, "CTL_Field_Breakpoint_Print_Text"));
} else {
b = MethodBreakpoint.create(className, methodName);
((MethodBreakpoint) b).setMethodSignature(methodSignature);
b.setPrintText(NbBundle.getMessage(MethodBreakpointPanel.class, "CTL_Method_Breakpoint_Print_Text"));
}
d.addBreakpoint(b);
return true;
}