diff --git a/debug/org.eclipse.debug.ui/plugin.properties b/debug/org.eclipse.debug.ui/plugin.properties index 3b76bbe23b5..84c0b135789 100644 --- a/debug/org.eclipse.debug.ui/plugin.properties +++ b/debug/org.eclipse.debug.ui/plugin.properties @@ -418,5 +418,7 @@ 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 +breakpointLabel.label= Label +breakpointLabel.tooltip= Provide a custom label to quickly identify breakpoint +breakpointLabelCommand = EditBreakpointLabel +breakpointLabelCommand.description = Opens inline editor to change breakpoint label \ No newline at end of file diff --git a/debug/org.eclipse.debug.ui/plugin.xml b/debug/org.eclipse.debug.ui/plugin.xml index 2ac20562d82..d0d3ddbace7 100644 --- a/debug/org.eclipse.debug.ui/plugin.xml +++ b/debug/org.eclipse.debug.ui/plugin.xml @@ -2065,6 +2065,10 @@ M4 = Platform-specific fourth key id="org.eclipse.debug.ui.commands.ToggleLineBreakpoint" name="%ActionDefinition.toggleLineBreakpoint.name"> + + @@ -3271,6 +3280,22 @@ M4 = Platform-specific fourth key + + + + + + + + + + + + + + diff --git a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointLabelAction.java b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointLabelAction.java index cb6704f0d41..6aac205528a 100644 --- a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointLabelAction.java +++ b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/breakpoints/BreakpointLabelAction.java @@ -89,6 +89,7 @@ public void run(IAction action) { Text inlineEditor = new Text(tree.getParent(), SWT.BORDER); inlineEditor.setBounds(bounds.x, bounds.y, bounds.width, bounds.height); inlineEditor.setText(current); + inlineEditor.selectAll(); inlineEditor.setFocus(); inlineEditor.addListener(SWT.FocusOut, event -> { diff --git a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointLabelCommandHandler.java b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointLabelCommandHandler.java new file mode 100644 index 00000000000..a9ac6445d6b --- /dev/null +++ b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointLabelCommandHandler.java @@ -0,0 +1,62 @@ +/******************************************************************************* + * Copyright (c) 2025 IBM Corporation 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.debug.internal.ui.views.breakpoints; + +import org.eclipse.core.commands.AbstractHandler; +import org.eclipse.core.commands.ExecutionEvent; +import org.eclipse.core.commands.ExecutionException; +import org.eclipse.debug.core.model.IBreakpoint; +import org.eclipse.debug.internal.ui.actions.breakpoints.BreakpointLabelAction; +import org.eclipse.debug.ui.IDebugUIConstants; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.ui.IViewPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.handlers.HandlerUtil; + +/** + * Default handler for Custom Breakpoint Label action + * + */ +public class BreakpointLabelCommandHandler extends AbstractHandler { + + /* + * (non-Javadoc) + * + * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent event) throws ExecutionException { + + ISelection rawSelection = HandlerUtil.getCurrentSelection(event); + if (!(rawSelection instanceof IStructuredSelection selection)) { + return null; + } + + Object element = selection.getFirstElement(); + if (!(element instanceof IBreakpoint)) { + return null; + } + + IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); + IViewPart view = page.findView(IDebugUIConstants.ID_BREAKPOINT_VIEW); + if (view != null) { + BreakpointLabelAction action = new BreakpointLabelAction(); + action.init(view); + action.run(null); + } + return null; + } +}