Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.debug.ui/ui/org')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/DeleteBreakpointMarkersOperation.java55
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java9
2 files changed, 57 insertions, 7 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/DeleteBreakpointMarkersOperation.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/DeleteBreakpointMarkersOperation.java
new file mode 100644
index 000000000..1a1b87589
--- /dev/null
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/DeleteBreakpointMarkersOperation.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2020 Paul Pazderski and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Paul Pazderski - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.internal.ui.views.breakpoints;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.ui.ide.undo.DeleteMarkersOperation;
+
+/**
+ * Extension of the default undoable delete marker operation to additional
+ * update the 'breakpointIsDeleted' attribute.
+ */
+public class DeleteBreakpointMarkersOperation extends DeleteMarkersOperation {
+
+ /**
+ * Create an undoable operation that can delete the specified markers.
+ *
+ * @param markers the markers to be deleted
+ * @param name the name used to describe the operation that deletes the
+ * markers
+ */
+ public DeleteBreakpointMarkersOperation(IMarker[] markers, String name) {
+ super(markers, name);
+ }
+
+ @Override
+ protected void doExecute(IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws CoreException {
+ IMarker[] markers = getMarkers();
+ if (markers != null) {
+ for (IMarker marker : markers) {
+ marker.setAttribute(DebugPlugin.ATTR_BREAKPOINT_IS_DELETED, true);
+ }
+ }
+
+ super.doExecute(monitor, info);
+ }
+
+ // Note: do not update 'breakpointIsDeleted' on doUndo (i.e. don't set
+ // breakpointIsDeleted=false on undo). It is important that the recreated
+ // breakpoint has breakpointIsDeleted=true to recognize the recreation in later
+ // code.
+}
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 e934f3b93..f24c1c9f9 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
@@ -72,6 +72,7 @@ import org.eclipse.debug.internal.ui.memory.MemoryRenderingManager;
import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility;
import org.eclipse.debug.internal.ui.sourcelookup.SourceLookupUIUtils;
import org.eclipse.debug.internal.ui.stringsubstitution.SelectedResourceManager;
+import org.eclipse.debug.internal.ui.views.breakpoints.DeleteBreakpointMarkersOperation;
import org.eclipse.debug.ui.actions.IToggleBreakpointsTargetManager;
import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.debug.ui.contexts.IDebugContextManager;
@@ -101,7 +102,6 @@ import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.handlers.HandlerUtil;
-import org.eclipse.ui.ide.undo.DeleteMarkersOperation;
import org.eclipse.ui.ide.undo.WorkspaceUndoUtil;
@@ -326,11 +326,6 @@ public class DebugUITools {
DebugPlugin.getDefault().getBreakpointManager().removeBreakpoints(breakpoints, !allowUndo);
if (allowUndo) {
-
- for (IMarker marker : markers) {
- marker.setAttribute(DebugPlugin.ATTR_BREAKPOINT_IS_DELETED, true);
- }
-
IAdaptable context= null;
if (shell != null) {
context= new IAdaptable() {
@@ -346,7 +341,7 @@ public class DebugUITools {
}
String operationName= markers.length == 1 ? ActionMessages.DeleteBreakpointOperationName : ActionMessages.DeleteBreakpointsOperationName;
- IUndoableOperation deleteMarkerOperation= new DeleteMarkersOperation(markers, operationName);
+ IUndoableOperation deleteMarkerOperation = new DeleteBreakpointMarkersOperation(markers, operationName);
deleteMarkerOperation.removeContext(WorkspaceUndoUtil.getWorkspaceUndoContext());
deleteMarkerOperation.addContext(DebugUITools.getBreakpointsUndoContext());
IOperationHistory operationHistory= PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();

Back to the top