Skip to content

Commit 46e0c48

Browse files
committed
Add F2 shortcut for renaming breakpoints
Improve usability of custom breakpoint label by mapping the F2 key to rename breakpoints, aligning with the standard convention for renaming items across platforms.
1 parent adbf4a5 commit 46e0c48

File tree

3 files changed

+79
-2
lines changed

3 files changed

+79
-2
lines changed

debug/org.eclipse.debug.ui/plugin.properties

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,5 +418,7 @@ debug.core.component.label = Platform Debug Core
418418
GroupLaunch.description=Launch several other configurations sequentially
419419

420420
prototype.decorator.label = Prototype Decorator
421-
breakpointLabel.label=Label
422-
breakpointLabel.tooltip=Provide a custom label to quickly identify breakpoint
421+
breakpointLabel.label= Label
422+
breakpointLabel.tooltip= Provide a custom label to quickly identify breakpoint
423+
breakpointLabelCommand = EditBreakpointLabel
424+
breakpointLabelCommand.description = Opens inline editor to change breakpoint label

debug/org.eclipse.debug.ui/plugin.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2065,6 +2065,10 @@ M4 = Platform-specific fourth key
20652065
id="org.eclipse.debug.ui.commands.ToggleLineBreakpoint"
20662066
name="%ActionDefinition.toggleLineBreakpoint.name">
20672067
</command>
2068+
<command
2069+
id="org.eclipse.debug.ui.commands.BreakpointLabelCommand"
2070+
name="%breakpointLabelCommand"
2071+
description="%breakpointLabelCommand.description"/>
20682072
</extension>
20692073
<extension point="org.eclipse.ui.bindings">
20702074
<key
@@ -2250,6 +2254,11 @@ M4 = Platform-specific fourth key
22502254
contextId="org.eclipse.debug.ui.memory.abstractasynctablerendering"
22512255
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
22522256
sequence="M1+M2+,"/>
2257+
<key
2258+
commandId="org.eclipse.debug.ui.commands.BreakpointLabelCommand"
2259+
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
2260+
contextId="org.eclipse.ui.contexts.window"
2261+
sequence="F2"/>
22532262
</extension>
22542263

22552264
<extension point="org.eclipse.ui.commandImages">
@@ -3271,6 +3280,10 @@ M4 = Platform-specific fourth key
32713280
</iterate>
32723281
</activeWhen>
32733282
</handler>
3283+
<handler
3284+
commandId="org.eclipse.debug.ui.commands.BreakpointLabelCommand"
3285+
class="org.eclipse.debug.internal.ui.views.breakpoints.BreakpointLabelCommandHandler">
3286+
</handler>
32743287
</extension>
32753288
<extension
32763289
point="org.eclipse.ui.trace.traceComponents">
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 IBM Corporation and others.
3+
*
4+
* This program and the accompanying materials
5+
* are made available under the terms of the Eclipse Public License 2.0
6+
* which accompanies this distribution, and is available at
7+
* https://www.eclipse.org/legal/epl-2.0/
8+
*
9+
* SPDX-License-Identifier: EPL-2.0
10+
*
11+
* Contributors:
12+
* IBM Corporation - initial API and implementation
13+
*******************************************************************************/
14+
package org.eclipse.debug.internal.ui.views.breakpoints;
15+
16+
import org.eclipse.core.commands.AbstractHandler;
17+
import org.eclipse.core.commands.ExecutionEvent;
18+
import org.eclipse.core.commands.ExecutionException;
19+
import org.eclipse.debug.core.model.IBreakpoint;
20+
import org.eclipse.debug.internal.ui.actions.breakpoints.BreakpointLabelAction;
21+
import org.eclipse.debug.ui.IDebugUIConstants;
22+
import org.eclipse.jface.viewers.ISelection;
23+
import org.eclipse.jface.viewers.IStructuredSelection;
24+
import org.eclipse.ui.IViewPart;
25+
import org.eclipse.ui.IWorkbenchPage;
26+
import org.eclipse.ui.PlatformUI;
27+
import org.eclipse.ui.handlers.HandlerUtil;
28+
29+
/**
30+
* Default handler for Custom Breakpoint Label action
31+
*
32+
*/
33+
public class BreakpointLabelCommandHandler extends AbstractHandler {
34+
35+
/*
36+
* (non-Javadoc)
37+
*
38+
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
39+
*/
40+
@Override
41+
public Object execute(ExecutionEvent event) throws ExecutionException {
42+
43+
ISelection rawSelection = HandlerUtil.getCurrentSelection(event);
44+
if (!(rawSelection instanceof IStructuredSelection selection)) {
45+
return null;
46+
}
47+
48+
Object element = selection.getFirstElement();
49+
if (!(element instanceof IBreakpoint)) {
50+
return null;
51+
}
52+
53+
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
54+
IViewPart view = page.findView(IDebugUIConstants.ID_BREAKPOINT_VIEW);
55+
if (view != null) {
56+
BreakpointLabelAction action = new BreakpointLabelAction();
57+
action.init(view);
58+
action.run(null);
59+
}
60+
return null;
61+
}
62+
}

0 commit comments

Comments
 (0)