Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2011-01-13 13:15:26 +0000
committerDani Megert2011-01-13 13:15:26 +0000
commit37369c80382ef730f0fdf401456324de52444782 (patch)
tree2b53aaa218e8b44b43007e9ffe30e14c32f238da
parent1fa60b4996516d04be3941d435f0d11654c8d033 (diff)
downloadeclipse.platform.debug-37369c80382ef730f0fdf401456324de52444782.tar.gz
eclipse.platform.debug-37369c80382ef730f0fdf401456324de52444782.tar.xz
eclipse.platform.debug-37369c80382ef730f0fdf401456324de52444782.zip
Fixed bug 334007: Breakpoint undo should not automatically register a breakpoint
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java40
-rw-r--r--org.eclipse.debug.core/core/org/eclipse/debug/internal/core/BreakpointManager.java17
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java7
3 files changed, 47 insertions, 17 deletions
diff --git a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
index 308bcfb72..7b9d27b71 100644
--- a/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
+++ b/org.eclipse.debug.core/core/org/eclipse/debug/core/DebugPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2010 IBM Corporation and others.
+ * Copyright (c) 2000, 2011 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
@@ -26,9 +26,17 @@ import javax.xml.parsers.FactoryConfigurationError;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
-import org.eclipse.core.resources.ISaveContext;
-import org.eclipse.core.resources.ISaveParticipant;
-import org.eclipse.core.resources.ResourcesPlugin;
+import com.ibm.icu.text.MessageFormat;
+
+import org.osgi.framework.BundleContext;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import org.eclipse.osgi.service.environment.Constants;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IAdapterManager;
@@ -44,6 +52,11 @@ import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+
+import org.eclipse.core.resources.ISaveContext;
+import org.eclipse.core.resources.ISaveParticipant;
+import org.eclipse.core.resources.ResourcesPlugin;
+
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IDisconnect;
import org.eclipse.debug.core.model.IDropToFrame;
@@ -67,14 +80,6 @@ import org.eclipse.debug.internal.core.Preferences;
import org.eclipse.debug.internal.core.StepFilterManager;
import org.eclipse.debug.internal.core.commands.CommandAdapterFactory;
import org.eclipse.debug.internal.core.sourcelookup.SourceLookupUtils;
-import org.eclipse.osgi.service.environment.Constants;
-import org.osgi.framework.BundleContext;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-import com.ibm.icu.text.MessageFormat;
/**
* There is one instance of the debug plug-in available from
@@ -286,6 +291,17 @@ public class DebugPlugin extends Plugin {
*/
public static final String PREF_DELETE_CONFIGS_ON_PROJECT_DELETE = DebugPlugin.getUniqueIdentifier() + ".PREF_DELETE_CONFIGS_ON_PROJECT_DELETE"; //$NON-NLS-1$
+ /**
+ * Deleted breakpoint marker attribute (value
+ * <code>"org.eclipse.debug.core.breakpointIsDeleted"</code>). The attribute is a
+ * <code>boolean</code> corresponding to the deleted state of a breakpoint.
+ *
+ * @see org.eclipse.core.resources.IMarker#getAttribute(String, boolean)
+ * @since 3.7
+ */
+ public static final String ATTR_BREAKPOINT_IS_DELETED= DebugPlugin.getUniqueIdentifier() + ".breakpointIsDeleted"; //$NON-NLS-1$
+
+
/**
* The singleton debug plug-in instance.
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 5cddb5924..c7f12a82f 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
@@ -727,6 +727,17 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
}
if (!fAdded.isEmpty()) {
try {
+ IWorkspaceRunnable runnable= new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ Iterator iter= fAdded.iterator();
+ while (iter.hasNext()) {
+ IBreakpoint breakpoint= (IBreakpoint)iter.next();
+ breakpoint.getMarker().setAttribute(DebugPlugin.ATTR_BREAKPOINT_IS_DELETED, false);
+ breakpoint.setRegistered(true);
+ }
+ }
+ };
+ getWorkspace().run(runnable, null, 0, null);
addBreakpoints((IBreakpoint[])fAdded.toArray(new IBreakpoint[fAdded.size()]), false);
} catch (CoreException e) {
DebugPlugin.log(e);
@@ -787,11 +798,9 @@ public class BreakpointManager implements IBreakpointManager, IResourceChangeLis
if (fPostChangMarkersChanged.contains(marker)) {
handleChangeBreakpoint(marker, mDelta);
fPostChangMarkersChanged.remove(marker);
- } else if (getBreakpoint(marker) == null) {
+ } else if (marker.getAttribute(DebugPlugin.ATTR_BREAKPOINT_IS_DELETED, false) && getBreakpoint(marker) == null) {
try {
- IBreakpoint breakpoint= createBreakpoint(marker);
- breakpoint.setRegistered(true);
- fAdded.add(breakpoint);
+ fAdded.add(createBreakpoint(marker));
} catch (CoreException e) {
DebugPlugin.log(e);
}
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 c555aed0a..04840ac91 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
@@ -258,18 +258,23 @@ public class DebugUITools {
public static void deleteBreakpoints(IBreakpoint[] breakpoints, final Shell shell, IProgressMonitor progressMonitor) throws CoreException {
IMarker[] markers= new IMarker[breakpoints.length];
for (int i= 0; i < breakpoints.length; i++) {
+ if (!breakpoints[i].isRegistered())
+ break;
markers[i]= breakpoints[i].getMarker();
if (markers[i] == null)
break;
}
- // We only offer undo support if all breakpoints have associated markers
+ // We only offer undo support if all breakpoints are registered and have associated markers
boolean allowUndo= markers.length == breakpoints.length;
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoints(breakpoints, !allowUndo);
if (allowUndo) {
+ for (int i= 0; i < markers.length; i++)
+ markers[i].setAttribute(DebugPlugin.ATTR_BREAKPOINT_IS_DELETED, true);
+
IAdaptable context= null;
if (shell != null) {
context= new IAdaptable() {

Back to the top