From 6fc13be8dd95d4cf2ea5f03b6cb157f2d150597a Mon Sep 17 00:00:00 2001 From: Elsa Zacharia Date: Fri, 23 Oct 2026 11:59:35 +0530 Subject: [PATCH] Add option to configure different colors for custom breakpoint label Breakpoints with a custom label were always shown in hard-coded red. This commit adds a Custom breakpoint label color entry to the Colors and Fonts preference page, defaulting to red. This gives the user an option to choose a different color than RGB(255,0,0) --- debug/org.eclipse.debug.ui/plugin.properties | 2 ++ debug/org.eclipse.debug.ui/plugin.xml | 9 +++++++++ .../debug/internal/ui/IInternalDebugUIConstants.java | 4 ++++ .../internal/ui/views/launch/DebugElementHelper.java | 4 +++- .../debug/internal/ui/views/variables/VariablesView.java | 6 +++++- 5 files changed, 23 insertions(+), 2 deletions(-) diff --git a/debug/org.eclipse.debug.ui/plugin.properties b/debug/org.eclipse.debug.ui/plugin.properties index 2abd00240cb..984463e65d3 100644 --- a/debug/org.eclipse.debug.ui/plugin.properties +++ b/debug/org.eclipse.debug.ui/plugin.properties @@ -161,6 +161,8 @@ BreakpointTypesMenu.label=B&reakpoint Types VariablesView.name=Variables VariableTextFontDefinition.label=Variable text font VariableTextFontDefinition.description=Font to use for the label text of entries in the Variables, Registers, Breakpoints and Expression views as well as the Inspect Popup Dialog. +BreakpointLabelColor.label=Breakpoint label +BreakpointLabelColor.description=Font color used for breakpoints with custom labels in the Breakpoints view. StringVariablePreferencePage.name=String Substitution ToggleMemoryMonitorsPaneAction.name = &Toggle Memory Monitors Pane ToggleMemoryMonitorsPaneAction.tooltip = Toggle Memory Monitors Pane diff --git a/debug/org.eclipse.debug.ui/plugin.xml b/debug/org.eclipse.debug.ui/plugin.xml index de9a51ba88c..561b80209c5 100644 --- a/debug/org.eclipse.debug.ui/plugin.xml +++ b/debug/org.eclipse.debug.ui/plugin.xml @@ -3071,6 +3071,15 @@ M4 = Platform-specific fourth key %VariableTextFontDefinition.description + + + %BreakpointLabelColor.description + + diff --git a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java index 040b43956d3..1cdcdda3da3 100644 --- a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java +++ b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java @@ -380,6 +380,10 @@ public interface IInternalDebugUIConstants { */ String THEME_CONSOLE_COLOR_STD_ERR = "org.eclipse.debug.ui.console.stream.err"; //$NON-NLS-1$ + /** + * Theme color definition for the label of breakpoints with a custom label. + */ + String THEME_BREAKPOINT_LABEL_COLOR = "org.eclipse.debug.ui.BreakpointLabelColor"; //$NON-NLS-1$ /** * Boolean preference indicating if launch action should launch or terminate 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 7798cf93f66..be7bbf3c922 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 @@ -18,6 +18,7 @@ import org.eclipse.debug.core.model.Breakpoint; import org.eclipse.debug.internal.ui.DelegatingModelPresentation; +import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; import org.eclipse.debug.ui.IDebugModelPresentation; import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.jface.resource.ImageDescriptor; @@ -145,7 +146,8 @@ public static RGB getForeground(Object element, IDebugModelPresentation presenta if (element instanceof Breakpoint breakpoint) { if (breakpoint.getBreakpointLabel() != null) { - return new RGB(255, 0, 0); + RGB rgb = JFaceResources.getColorRegistry().getRGB(IInternalDebugUIConstants.THEME_BREAKPOINT_LABEL_COLOR); + return rgb != null ? rgb : new RGB(255, 0, 0); } return null; } diff --git a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java index 8752b4eb9d8..65706f3b38e 100644 --- a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java +++ b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/variables/VariablesView.java @@ -40,6 +40,7 @@ import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.DelegatingModelPresentation; import org.eclipse.debug.internal.ui.IDebugHelpContextIds; +import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; import org.eclipse.debug.internal.ui.LazyModelPresentation; import org.eclipse.debug.internal.ui.SWTFactory; import org.eclipse.debug.internal.ui.VariablesViewModelPresentation; @@ -422,6 +423,7 @@ public void dispose() { getSite().getWorkbenchWindow().removePerspectiveListener(this); DebugUIPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(this); JFaceResources.getFontRegistry().removeListener(this); + JFaceResources.getColorRegistry().removeListener(this); TreeModelViewer viewer = getVariablesViewer(); if (viewer != null) { viewer.removeModelChangedListener(this); @@ -489,7 +491,8 @@ public void propertyChange(PropertyChangeEvent event) { String propertyName= event.getProperty(); if (propertyName.equals(IDebugUIConstants.PREF_CHANGED_DEBUG_ELEMENT_COLOR) || propertyName.equals(IDebugUIConstants.PREF_CHANGED_VALUE_BACKGROUND) || - propertyName.equals(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT)) { + propertyName.equals(IDebugUIConstants.PREF_VARIABLE_TEXT_FONT) || + propertyName.equals(IInternalDebugUIConstants.THEME_BREAKPOINT_LABEL_COLOR)) { Viewer viewer = getViewer(); if (viewer == variablesViewer) { setVariablesViewerTreeFont(variablesViewer); @@ -510,6 +513,7 @@ public Viewer createViewer(Composite parent) { getModelPresentation(); DebugUIPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(this); JFaceResources.getFontRegistry().addListener(this); + JFaceResources.getColorRegistry().addListener(this); variablesViewer = createTreeViewer(fSashForm); fInputService = new ViewerInputService(variablesViewer, fRequester);