Skip to content

Commit 7ae8b24

Browse files
committed
Prompt when launching debug session with 'Skip All Breakpoints' enabled
This commit adds a warning prompt when User launch application in debug mode with `Skip All Breakpoints` enabled
1 parent 401d483 commit 7ae8b24

10 files changed

+165
-9
lines changed

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2017 IBM Corporation and others.
2+
* Copyright (c) 2000, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -303,6 +303,11 @@ public class DebugUIMessages extends NLS {
303303

304304
public static String LaunchShortcutAction_combineLaunchShortcutName;
305305

306+
public static String skipBreakpointWarningTitle;
307+
public static String skipBreakpointWarningLabel;
308+
public static String skipBreakpointWarningToggle1;
309+
public static String skipBreakpointButton1;
310+
306311
static {
307312
// load message values from bundle file
308313
NLS.initializeMessages(BUNDLE_NAME, DebugUIMessages.class);

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIMessages.properties

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
###############################################################################
2-
# Copyright (c) 2000, 2017 IBM Corporation and others.
2+
# Copyright (c) 2000, 2025 IBM Corporation and others.
33
#
44
# This program and the accompanying materials
55
# are made available under the terms of the Eclipse Public License 2.0
@@ -287,4 +287,9 @@ WorkingDirectoryBlock_Exception_occurred_reading_configuration___15=Exception oc
287287
##############################################################
288288
ExpressionManagerContentProvider_1=Add new expression
289289

290-
LaunchShortcutAction_combineLaunchShortcutName={0} ({1})
290+
LaunchShortcutAction_combineLaunchShortcutName={0} ({1})
291+
292+
skipBreakpointWarningTitle = Breakpoints set to skip
293+
skipBreakpointWarningLabel = Breakpoints are disabled due to 'Skip All Breakpoints' being active. Debugger will continue without stopping.
294+
skipBreakpointWarningToggle1 = Do not show this warning
295+
skipBreakpointButton1 = Enable and Continue

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public void initializeDefaultPreferences() {
5656
prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_EXPRESSIONS, true);
5757
prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_DISABLE_ALL_BREAKPOINTS, true);
5858
prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_ENABLE_ALL_BREAKPOINTS, true);
59+
prefs.setDefault(IInternalDebugUIConstants.PREF_SKIP_ALL_BREAKPOINTS_PROMPT, true);
5960

6061
/**
6162
* Context launching preferences. Appear on the the Launching preference page

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/IInternalDebugUIConstants.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2017 IBM Corporation and others.
2+
* Copyright (c) 2000, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -467,4 +467,11 @@ public interface IInternalDebugUIConstants {
467467
*/
468468
int BREAKPOINT_SORTING_ORDER_CREATION_TIME = 1;
469469

470+
/**
471+
* Boolean preference prompting Skip All Breakpoints option is enabled on
472+
* launching in debug mode
473+
*
474+
*/
475+
String PREF_SKIP_ALL_BREAKPOINTS_PROMPT = IDebugUIConstants.PLUGIN_ID + ".DisableSkipAllBreakpointsOnLaunch"; //$NON-NLS-1$
476+
470477
}

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencePage.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ protected void createFieldEditors() {
6767
addField(new BooleanFieldEditor(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_TRIGGER_BREAKPOINTS, DebugPreferencesMessages.DebugPreferencePage_31, SWT.NONE, getFieldEditorParent()));
6868
addField(new BooleanFieldEditor(IDebugPreferenceConstants.PREF_PROMPT_DISABLE_ALL_BREAKPOINTS,
6969
DebugPreferencesMessages.DebugPreferencePage_32, SWT.NONE, getFieldEditorParent()));
70+
addField(new BooleanFieldEditor(IInternalDebugUIConstants.PREF_SKIP_ALL_BREAKPOINTS_PROMPT,
71+
DebugPreferencesMessages.DebugPreferencePage_PromptSkipBreakpoints, SWT.NONE, getFieldEditorParent()));
7072

7173
SWTFactory.createHorizontalSpacer(getFieldEditorParent(), 2);
7274
ColorFieldEditor mem= new ColorFieldEditor(IDebugUIConstants.PREF_CHANGED_DEBUG_ELEMENT_COLOR, DebugPreferencesMessages.DebugPreferencePage_4, getFieldEditorParent());

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2020 IBM Corporation and others.
2+
* Copyright (c) 2000, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -217,6 +217,10 @@ public class DebugPreferencesMessages extends NLS {
217217
public static String DebugPreferencePage_5;
218218

219219
public static String RunDebugPropertiesPage_0;
220+
public static String LaunchingPreferencePage_43;
220221

222+
public static String skipBreakpointWarningTitle;
223+
224+
public static String DebugPreferencePage_PromptSkipBreakpoints;
221225

222226
}

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
###############################################################################
2-
# Copyright (c) 2000, 2022 IBM Corporation and others.
2+
# Copyright (c) 2000, 2025 IBM Corporation and others.
33
#
44
# This program and the accompanying materials
55
# are made available under the terms of the Eclipse Public License 2.0
@@ -53,6 +53,7 @@ DebugPreferencePage_31=&Prompt for confirmation when removing all triggerpoints
5353
DebugPreferencePage_32=&Prompt for confirmation when disabling all breakpoints
5454
DebugPreferencePage_5=Prompt for confirmation when deleting all e&xpressions
5555
DebugPreferencePage_showValuesInline=Show debug values &inline on text editors (Experimental)
56+
DebugPreferencePage_PromptSkipBreakpoints=Show warning when launching in debug mode with 'Skip Breakpoints' enabled
5657

5758
LaunchingPreferencePage_1=&Build (if required) before launching
5859
LaunchingPreferencePage_2=Save required dirty editors before launching
@@ -95,6 +96,7 @@ LaunchingPreferencePage_40=Launch Operation
9596
LaunchingPreferencePage_41=La&unch the previously launched application
9697
LaunchingPreferencePage_confirm_0=Prompt for confirmation when removin&g a configuration from the launch history
9798
LaunchingPreferencePage_42=Termin&ate and relaunch while launching (Press 'Shift' to toggle during launch from menu and toolbar)
99+
LaunchingPreferencePage_43=Show prompt to indicate whether skip all breakpoints feature is enabled or not on Debug launch
98100

99101
ProcessPropertyPage_Command_Line__1=Co&mmand Line:
100102
ProcessPropertyPage_0=Run-&at time:
@@ -171,3 +173,4 @@ DefaultLaunchConfigurationsPropertiesPage_9=Delete selected launch configuration
171173
DefaultLaunchConfigurationsPropertiesPage_11=Select Configuration Type
172174
DefaultLaunchConfigurationsPropertiesPage_12=&Select the type of configuration to create:
173175
RunDebugPropertiesPage_0=There was a problem trying to edit {0}
176+

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/LaunchingPreferencePage.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2004, 2016 IBM Corporation and others.
2+
* Copyright (c) 2004, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -52,6 +52,7 @@ public class LaunchingPreferencePage extends FieldEditorPreferencePage implement
5252
private Button fLaunchLastIfNotLaunchable;
5353
private Button fCheckParent;
5454
private Button fTerminatAndRelaunch;
55+
private Button fSkipAllBreakpointsPrompt;
5556

5657
/**
5758
* The default constructor
@@ -171,6 +172,8 @@ public void widgetSelected(SelectionEvent e) {
171172
fLaunchLastIfNotLaunchable = SWTFactory.createRadioButton(space, DebugPreferencesMessages.LaunchingPreferencePage_41);
172173

173174
fTerminatAndRelaunch = SWTFactory.createCheckButton(group, DebugPreferencesMessages.LaunchingPreferencePage_42, null, false, 1);
175+
fSkipAllBreakpointsPrompt = SWTFactory.createCheckButton(group,
176+
DebugPreferencesMessages.LaunchingPreferencePage_43, null, true, 1);
174177

175178
// initialize the buttons
176179
boolean value = getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH);
@@ -201,6 +204,8 @@ protected void performDefaults() {
201204
fLaunchLastIfNotLaunchable.setEnabled(value);
202205
value = getPreferenceStore().getDefaultBoolean(IInternalDebugUIConstants.PREF_TERMINATE_AND_RELAUNCH_LAUNCH_ACTION);
203206
fTerminatAndRelaunch.setSelection(value);
207+
value = getPreferenceStore().getDefaultBoolean(IInternalDebugUIConstants.PREF_SKIP_ALL_BREAKPOINTS_PROMPT);
208+
fSkipAllBreakpointsPrompt.setSelection(value);
204209
super.performDefaults();
205210
}
206211

@@ -210,6 +215,8 @@ public boolean performOk() {
210215
getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_LAUNCH_PARENT_PROJECT, fCheckParent.getSelection());
211216
getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_LAUNCH_LAST_IF_NOT_LAUNCHABLE, fLaunchLastIfNotLaunchable.getSelection());
212217
getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_TERMINATE_AND_RELAUNCH_LAUNCH_ACTION, fTerminatAndRelaunch.getSelection());
218+
getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_SKIP_ALL_BREAKPOINTS_PROMPT,
219+
fSkipAllBreakpointsPrompt.getSelection());
213220
return super.performOk();
214221
}
215222

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugUITools.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2021 IBM Corporation and others.
2+
* Copyright (c) 2000, 2025 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -92,6 +92,7 @@
9292
import org.eclipse.swt.custom.BusyIndicator;
9393
import org.eclipse.swt.graphics.Color;
9494
import org.eclipse.swt.graphics.Image;
95+
import org.eclipse.swt.widgets.Display;
9596
import org.eclipse.swt.widgets.Shell;
9697
import org.eclipse.ui.IEditorInput;
9798
import org.eclipse.ui.IEditorPart;
@@ -974,6 +975,14 @@ public static void launch(final ILaunchConfiguration configuration, final String
974975
} catch (CoreException e) {
975976
DebugUIPlugin.log(e);
976977
}
978+
boolean breakpointsDisabled = DebugPlugin.getDefault().getBreakpointManager().isEnabled();
979+
boolean showWarningPrompt = DebugUIPlugin.getDefault().getPreferenceStore()
980+
.getBoolean(IInternalDebugUIConstants.PREF_SKIP_ALL_BREAKPOINTS_PROMPT);
981+
if (!breakpointsDisabled && showWarningPrompt && mode.contains("debug")) { //$NON-NLS-1$
982+
SkipBreakpointsWarning showWarning = new SkipBreakpointsWarning(DebugUIPlugin.getShell());
983+
Display display = DebugUIPlugin.getStandardDisplay();
984+
display.syncExec(() -> showWarning.open());
985+
}
977986
if (launchInBackground) {
978987
DebugUIPlugin.launchInBackground(configuration, mode);
979988
} else {
@@ -1372,5 +1381,5 @@ public static ILaunchConfiguration getLaunchConfiguration(ILaunchConfigurationDi
13721381
}
13731382
return null;
13741383
}
1375-
13761384
}
1385+
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
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.ui;
15+
16+
import org.eclipse.debug.core.DebugPlugin;
17+
import org.eclipse.debug.internal.ui.DebugUIMessages;
18+
import org.eclipse.debug.internal.ui.DebugUIPlugin;
19+
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
20+
import org.eclipse.jface.dialogs.Dialog;
21+
import org.eclipse.jface.dialogs.IDialogConstants;
22+
import org.eclipse.swt.SWT;
23+
import org.eclipse.swt.graphics.Point;
24+
import org.eclipse.swt.layout.GridData;
25+
import org.eclipse.swt.layout.GridLayout;
26+
import org.eclipse.swt.widgets.Button;
27+
import org.eclipse.swt.widgets.Composite;
28+
import org.eclipse.swt.widgets.Control;
29+
import org.eclipse.swt.widgets.Label;
30+
import org.eclipse.swt.widgets.Shell;
31+
32+
/**
33+
* Provides warning prompt dialog
34+
*
35+
* @since 3.19
36+
*/
37+
public class SkipBreakpointsWarning extends Dialog {
38+
39+
Button disableWarning;
40+
41+
Button enableBreakppints;
42+
43+
protected SkipBreakpointsWarning(Shell parentShell) {
44+
super(parentShell);
45+
}
46+
47+
@Override
48+
protected void configureShell(Shell newShell) {
49+
super.configureShell(newShell);
50+
newShell.setText(DebugUIMessages.skipBreakpointWarningTitle);
51+
}
52+
@Override
53+
protected Control createDialogArea(Composite parent) {
54+
Composite container = (Composite) super.createDialogArea(parent);
55+
GridLayout layout = new GridLayout(1, true);
56+
layout.marginTop = 10;
57+
layout.marginLeft = 10;
58+
layout.marginRight = 10;
59+
layout.verticalSpacing = 10;
60+
61+
container.setLayout(layout);
62+
Label messageLabel = new Label(container, SWT.WRAP);
63+
messageLabel.setText(DebugUIMessages.skipBreakpointWarningLabel);
64+
GridData messageData = new GridData(SWT.FILL, SWT.CENTER, false, false);
65+
messageData.widthHint = 500;
66+
messageLabel.setLayoutData(messageData);
67+
68+
disableWarning = new Button(container, SWT.CHECK);
69+
disableWarning.setText(DebugUIMessages.skipBreakpointWarningToggle1);
70+
71+
GridData data = new GridData(SWT.NONE);
72+
data.verticalIndent = 20;
73+
data.horizontalAlignment = GridData.BEGINNING;
74+
disableWarning.setLayoutData(data);
75+
return container;
76+
}
77+
78+
@Override
79+
protected void createButtonsForButtonBar(Composite parent) {
80+
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
81+
enableBreakppints = createButton(parent, IDialogConstants.YES_ID, DebugUIMessages.skipBreakpointButton1, false);
82+
createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
83+
}
84+
85+
@Override
86+
protected void buttonPressed(int buttonId) {
87+
if (IDialogConstants.OK_ID == buttonId) {
88+
if (disableWarning.getSelection()) {
89+
DebugUIPlugin.getDefault().getPreferenceStore()
90+
.setValue(IInternalDebugUIConstants.PREF_SKIP_ALL_BREAKPOINTS_PROMPT, false);
91+
}
92+
okPressed();
93+
} else if (IDialogConstants.CANCEL_ID == buttonId) {
94+
cancelPressed();
95+
} else if (IDialogConstants.YES_ID == buttonId) {
96+
DebugPlugin.getDefault().getBreakpointManager().setEnabled(true);
97+
okPressed();
98+
}
99+
}
100+
101+
@Override
102+
protected Point getInitialSize() {
103+
return new Point(580, 200);
104+
}
105+
106+
@Override
107+
public boolean close() {
108+
disableWarning.dispose();
109+
enableBreakppints.dispose();
110+
return super.close();
111+
}
112+
113+
}

0 commit comments

Comments
 (0)