diff --git a/debug/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java b/debug/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java
index 331208c6af2..837bb8fdd27 100644
--- a/debug/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java
+++ b/debug/org.eclipse.debug.core/core/org/eclipse/debug/core/model/Breakpoint.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2016 IBM Corporation and others.
+ * Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -45,7 +45,6 @@
public abstract class Breakpoint extends PlatformObject implements IBreakpoint, ITriggerPoint {
-
/**
* Creates a breakpoint.
*
@@ -61,6 +60,13 @@ public Breakpoint() {
*/
private volatile IMarker fMarker;
+ /**
+ * Attribute for custom labeling in breakpoints
+ *
+ * @since 3.23
+ */
+ private final String LABEL = "breakpointLabel"; //$NON-NLS-1$
+
/**
* @see IBreakpoint#setMarker(IMarker)
*/
@@ -384,4 +390,24 @@ public String toString() {
return builder.toString();
}
+ /**
+ * Returns the label associated with this breakpoint, or null
+ * if no specific label was defined.
+ *
+ * @since 3.23
+ */
+ public String getBreakpointLabel() {
+ return getMarker().getAttribute(LABEL, null);
+ }
+
+ /**
+ * Sets a new label for the breakpoint.
+ *
+ * @param labelValue provide by the user
+ * @since 3.23
+ */
+ public void setBreakpointLabel(String labelValue) throws CoreException {
+ setAttribute(LABEL, labelValue);
+ }
+
}
diff --git a/debug/org.eclipse.debug.ui/icons/full/elcl16/bp_label.png b/debug/org.eclipse.debug.ui/icons/full/elcl16/bp_label.png
new file mode 100644
index 00000000000..d87238840c9
Binary files /dev/null and b/debug/org.eclipse.debug.ui/icons/full/elcl16/bp_label.png differ
diff --git a/debug/org.eclipse.debug.ui/icons/full/elcl16/bp_label.svg b/debug/org.eclipse.debug.ui/icons/full/elcl16/bp_label.svg
new file mode 100644
index 00000000000..edf2530d65b
--- /dev/null
+++ b/debug/org.eclipse.debug.ui/icons/full/elcl16/bp_label.svg
@@ -0,0 +1,219 @@
+
+
+
+
diff --git a/debug/org.eclipse.debug.ui/icons/full/elcl16/bp_label@2x.png b/debug/org.eclipse.debug.ui/icons/full/elcl16/bp_label@2x.png
new file mode 100644
index 00000000000..b1c1d850113
Binary files /dev/null and b/debug/org.eclipse.debug.ui/icons/full/elcl16/bp_label@2x.png differ
diff --git a/debug/org.eclipse.debug.ui/plugin.properties b/debug/org.eclipse.debug.ui/plugin.properties
index f9935043514..c9c99de91ed 100644
--- a/debug/org.eclipse.debug.ui/plugin.properties
+++ b/debug/org.eclipse.debug.ui/plugin.properties
@@ -418,3 +418,5 @@ debug.core.component.label = Platform Debug Core
GroupLaunch.description=Launch several other configurations sequentially
prototype.decorator.label = Prototype Decorator
+breakpointLabel.label=Label
+breakpointLabel.tooltip=Provide a custom label to quickly identify breakpoint
diff --git a/debug/org.eclipse.debug.ui/plugin.xml b/debug/org.eclipse.debug.ui/plugin.xml
index 8bcbe226752..6d5df48d42a 100644
--- a/debug/org.eclipse.debug.ui/plugin.xml
+++ b/debug/org.eclipse.debug.ui/plugin.xml
@@ -1482,6 +1482,15 @@
enablesFor="+"
id="org.eclipse.debug.ui.breakpointsView.toolbar.remove">
+
+
{
+ tree.setText(current);
+ label.dispose();
+ inlineEditor.dispose();
+
+ });
+ inlineEditor.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.keyCode == SWT.ESC) {
+ tree.setText(current);
+ inlineEditor.dispose();
+ label.dispose();
+ } else if (e.keyCode == SWT.CR) {
+ String newLabel = inlineEditor.getText();
+ if (!newLabel.isEmpty() && !newLabel.equals(current)) {
+ try {
+ breakpoint.setBreakpointLabel(newLabel);
+ } catch (CoreException e1) {
+ DebugUIPlugin.log(e1);
+ }
+ } else if (newLabel.isEmpty()) {
+ try {
+ breakpoint.setBreakpointLabel(null); // Set to default
+ } catch (CoreException e2) {
+ DebugUIPlugin.log(e2);
+ }
+ }
+ inlineEditor.dispose();
+ label.dispose();
+ }
+ }
+ });
+ tree.setText(emptyString);
+
+ }
+
+ }
+ }
+ }
+
+ }
+
+ protected IStructuredSelection getSelection() {
+ return (IStructuredSelection) getView().getViewSite().getSelectionProvider().getSelection();
+ }
+
+ @Override
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ @Override
+ public void init(IViewPart view) {
+ setView(view);
+ }
+
+}
diff --git a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointLabelProvider.java b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointLabelProvider.java
index 7a45c1badc2..ecf6de71807 100644
--- a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointLabelProvider.java
+++ b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/model/elements/BreakpointLabelProvider.java
@@ -1,5 +1,5 @@
/*****************************************************************
- * Copyright (c) 2009, 2010 Texas Instruments and others
+ * Copyright (c) 2009, 2025 Texas Instruments and others
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -15,6 +15,7 @@
package org.eclipse.debug.internal.ui.model.elements;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.Breakpoint;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
@@ -31,6 +32,11 @@ public class BreakpointLabelProvider extends DebugElementLabelProvider {
@Override
protected String getLabel(TreePath elementPath, IPresentationContext presentationContext, String columnId, int columnIndex) throws CoreException {
if (columnIndex == 0) {
+ if (elementPath.getFirstSegment() instanceof Breakpoint breakpoint) {
+ if (breakpoint.getBreakpointLabel() != null) {
+ return breakpoint.getBreakpointLabel();
+ }
+ }
return super.getLabel(elementPath, presentationContext, columnId, columnIndex);
} else {
return IInternalDebugCoreConstants.EMPTY_STRING;
diff --git a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementHelper.java b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementHelper.java
index d10b0341ad2..95ca69e717d 100644
--- a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementHelper.java
+++ b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/launch/DebugElementHelper.java
@@ -16,16 +16,21 @@
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.debug.core.model.Breakpoint;
import org.eclipse.debug.internal.ui.DelegatingModelPresentation;
import org.eclipse.debug.ui.IDebugModelPresentation;
+import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.IColorProvider;
import org.eclipse.jface.viewers.IFontProvider;
+import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
/**
* Translates images, colors, and fonts into image descriptors, RGBs, and font
@@ -139,6 +144,20 @@ public static RGB getForeground(Object element, IDebugModelPresentation presenta
if (color != null) {
return color.getRGB();
}
+
+ if (element instanceof Breakpoint breakpoint) {
+ if (breakpoint.getBreakpointLabel() != null) {
+ final RGB[] rgb = new RGB[1];
+ Display.getDefault().syncExec(() -> {
+ Color redColor = Display.getDefault().getSystemColor(SWT.COLOR_RED);
+ rgb[0] = redColor.getRGB();
+ });
+ if (rgb[0] != null) {
+ return rgb[0];
+ }
+ }
+ return null;
+ }
return null;
}
@@ -217,7 +236,16 @@ public static FontData getFont(Object element, IDebugModelPresentation presentat
if (font != null) {
return font.getFontData()[0];
}
+ if (element instanceof Breakpoint breakpoint) {
+ if (breakpoint.getBreakpointLabel() != null) {
+ var fontNew = JFaceResources.getFontDescriptor(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT)
+ .getFontData()[0];
+ return new FontData(fontNew.getName(), fontNew.getHeight(), fontNew.getStyle() ^ SWT.BOLD);
+ }
+
+ }
return null;
+
}
/**