Bug 344352 - [breakpoints] Error dialog when deleting a working set

In fact there is no issue with deleting working set but a regular user
is most likely seeing this unnecessary error message from that action.
Deleting working set give the option to remove the working set, all
containing breakpoints or both. If removing breakpoints is unselected it
will still perform a remove operation for zero markers and the standard
remove-marker-operation will produce an error dialog because there are
no markers to delete.

Change-Id: If08c5f930bbdbf0236dd8a20af3f43b60b77d427
Signed-off-by: Paul Pazderski <paul-eclipse@ppazderski.de>
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
index 1f5a267..e934f3b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java
@@ -301,6 +301,13 @@
 	 * @since 3.7
 	 */
 	public static void deleteBreakpoints(IBreakpoint[] breakpoints, final Shell shell, IProgressMonitor progressMonitor) throws CoreException {
+		if (breakpoints.length == 0) {
+			// Note: this is not only a small performance optimization but also the fix for
+			// bug 344352. When removing no breakpoints the DeleteMarkersOperation will show
+			// an error dialog about missing markers.
+			return;
+		}
+
 		IMarker[] markers= new IMarker[breakpoints.length];
 		int markerCount;
 		for (markerCount= 0; markerCount < breakpoints.length; markerCount++) {