Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2014-10-09 11:47:12 +0000
committerDani Megert2014-10-09 11:47:12 +0000
commit8a1df72b32d13765ec6e719f211a79d27a86667c (patch)
tree0881723c138cbedd03a2b6ae87d8ae0a17434e4f
parent7a25e04d06eb13797a5e1ac0a61c9d48b30af179 (diff)
downloadeclipse.platform.debug-8a1df72b32d13765ec6e719f211a79d27a86667c.tar.gz
eclipse.platform.debug-8a1df72b32d13765ec6e719f211a79d27a86667c.tar.xz
eclipse.platform.debug-8a1df72b32d13765ec6e719f211a79d27a86667c.zip
Fixed bug 333891: [breakpoints] Breakpoint Undo doesn't handle duplicates
Signed-off-by: Sarika Sinha <sarika.sinha@in.ibm.com>
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java35
1 files changed, 33 insertions, 2 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
index 1ff798226..01e69a787 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2014 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -847,7 +847,14 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
handleChangeBreakpoint(marker, mDelta);
fPostChangMarkersChanged.remove(marker);
} else if (marker.getAttribute(DebugPlugin.ATTR_BREAKPOINT_IS_DELETED, false) && getBreakpoint(marker) == null) {
- try {
+ try { /*
+ * There may be breakpoints with matching resource
+ * and same line number
+ */
+ IBreakpoint breakpoint = findMatchingBreakpoint(marker);
+ if (breakpoint != null) {
+ removeBreakpoint(breakpoint, true);
+ }
fAdded.add(createBreakpoint(marker));
} catch (CoreException e) {
DebugPlugin.log(e);
@@ -859,6 +866,30 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
/**
+ * To find a breakpoint with matching marker resources and line number.
+ *
+ * @param marker the {@link IMarker} for which existing breakpoint is
+ * retrieved
+ * @return matching breakpoint if exists else return <code>null</code>
+ */
+ private IBreakpoint findMatchingBreakpoint(IMarker marker) {
+ Vector<IBreakpoint> breakpoints = getBreakpoints0();
+ try {
+ Integer line = (Integer) marker.getAttribute(IMarker.LINE_NUMBER);
+ for (int i = 0; i < breakpoints.size(); i++) {
+ IBreakpoint breakpoint = breakpoints.get(i);
+ IMarker bpMarker = breakpoint.getMarker();
+ if (bpMarker != null && marker.getResource().equals(bpMarker.getResource()) && (Integer) bpMarker.getAttribute(IMarker.LINE_NUMBER) == (line == null ? -1 : line.intValue())) {
+ return breakpoint;
+ }
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ /**
* Wrapper for handling removes
* @param marker the {@link IMarker}
*/

Back to the top