Skip to content

Commit 610d419

Browse files
SougandhSiloveeclipse
authored andcommitted
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 22ad862 commit 610d419

File tree

8 files changed

+45
-7
lines changed

8 files changed

+45
-7
lines changed

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

Lines changed: 5 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,10 @@ 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+
306310
static {
307311
// load message values from bundle file
308312
NLS.initializeMessages(BUNDLE_NAME, DebugUIMessages.class);

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

Lines changed: 6 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,8 @@ 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

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
@@ -57,6 +57,7 @@ public void initializeDefaultPreferences() {
5757
prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_EXPRESSIONS, true);
5858
prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_DISABLE_ALL_BREAKPOINTS, true);
5959
prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_ENABLE_ALL_BREAKPOINTS, true);
60+
prefs.setDefault(IInternalDebugUIConstants.PREF_SKIP_ALL_BREAKPOINTS_PROMPT, true);
6061

6162
/**
6263
* 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
@@ -457,4 +457,11 @@ public interface IInternalDebugUIConstants {
457457
*/
458458
int BREAKPOINT_SORTING_ORDER_CREATION_TIME = 1;
459459

460+
/**
461+
* Boolean preference prompting Skip All Breakpoints option is enabled on
462+
* launching in debug mode
463+
*
464+
*/
465+
String PREF_SKIP_ALL_BREAKPOINTS_PROMPT = IDebugUIConstants.PLUGIN_ID + ".DisableSkipAllBreakpointsOnLaunch"; //$NON-NLS-1$
466+
460467
}

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: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ public class DebugPreferencesMessages extends NLS {
218218

219219
public static String RunDebugPropertiesPage_0;
220220

221+
public static String DebugPreferencePage_PromptSkipBreakpoints;
221222

222223
public static String ConsoleDefaultElapsedTimeFormat;
223224

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ DebugPreferencePage_31=&Prompt for confirmation when removing all triggerpoints
5757
DebugPreferencePage_32=&Prompt for confirmation when disabling all breakpoints
5858
DebugPreferencePage_5=Prompt for confirmation when deleting all e&xpressions
5959
DebugPreferencePage_showValuesInline=Show debug values &inline on text editors (Experimental)
60+
DebugPreferencePage_PromptSkipBreakpoints=Prompt when launching application in debug mode with 'Skip Breakpoints' enabled
6061

6162
LaunchingPreferencePage_1=&Build (if required) before launching
6263
LaunchingPreferencePage_2=Save required dirty editors before launching
@@ -175,3 +176,4 @@ DefaultLaunchConfigurationsPropertiesPage_9=Delete selected launch configuration
175176
DefaultLaunchConfigurationsPropertiesPage_11=Select Configuration Type
176177
DefaultLaunchConfigurationsPropertiesPage_12=&Select the type of configuration to create:
177178
RunDebugPropertiesPage_0=There was a problem trying to edit {0}
179+

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

Lines changed: 20 additions & 3 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
@@ -52,6 +52,7 @@
5252
import org.eclipse.debug.core.model.ISourceLocator;
5353
import org.eclipse.debug.internal.core.IConfigurationElementConstants;
5454
import org.eclipse.debug.internal.ui.DebugPluginImages;
55+
import org.eclipse.debug.internal.ui.DebugUIMessages;
5556
import org.eclipse.debug.internal.ui.DebugUIPlugin;
5657
import org.eclipse.debug.internal.ui.DefaultLabelProvider;
5758
import org.eclipse.debug.internal.ui.DelegatingModelPresentation;
@@ -81,6 +82,8 @@
8182
import org.eclipse.debug.ui.memory.IMemoryRenderingManager;
8283
import org.eclipse.debug.ui.sourcelookup.ISourceContainerBrowser;
8384
import org.eclipse.debug.ui.sourcelookup.ISourceLookupResult;
85+
import org.eclipse.jface.dialogs.IDialogConstants;
86+
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
8487
import org.eclipse.jface.preference.IPreferenceStore;
8588
import org.eclipse.jface.resource.ImageDescriptor;
8689
import org.eclipse.jface.viewers.ISelection;
@@ -947,7 +950,8 @@ public static void reLaunch(final ILaunchConfiguration configuration, final Stri
947950
* @since 3.12
948951
*/
949952
public static void launch(final ILaunchConfiguration configuration, final String mode, boolean isShift) {
950-
if (DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_TERMINATE_AND_RELAUNCH_LAUNCH_ACTION) != isShift) {
953+
IPreferenceStore preferenceStore = getPreferenceStore();
954+
if (preferenceStore.getBoolean(IInternalDebugUIConstants.PREF_TERMINATE_AND_RELAUNCH_LAUNCH_ACTION) != isShift) {
951955
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
952956
ILaunch[] launches = launchManager.getLaunches();
953957
for (ILaunch iLaunch : launches) {
@@ -974,6 +978,19 @@ public static void launch(final ILaunchConfiguration configuration, final String
974978
} catch (CoreException e) {
975979
DebugUIPlugin.log(e);
976980
}
981+
boolean breakpointsDisabled = DebugPlugin.getDefault().getBreakpointManager().isEnabled();
982+
boolean showWarningPrompt = preferenceStore
983+
.getBoolean(IInternalDebugUIConstants.PREF_SKIP_ALL_BREAKPOINTS_PROMPT);
984+
if (!breakpointsDisabled && showWarningPrompt && ILaunchManager.DEBUG_MODE.equals(mode)) {
985+
MessageDialogWithToggle dialog = MessageDialogWithToggle.openOkCancelConfirm(
986+
DebugUIPlugin.getShellForModalDialog(), DebugUIMessages.skipBreakpointWarningTitle,
987+
DebugUIMessages.skipBreakpointWarningLabel, DebugUIMessages.skipBreakpointWarningToggle1, false,
988+
preferenceStore, IInternalDebugUIConstants.PREF_SKIP_ALL_BREAKPOINTS_PROMPT);
989+
if (dialog.getReturnCode() != IDialogConstants.OK_ID) {
990+
return;
991+
}
992+
}
993+
977994
if (launchInBackground) {
978995
DebugUIPlugin.launchInBackground(configuration, mode);
979996
} else {
@@ -1372,5 +1389,5 @@ public static ILaunchConfiguration getLaunchConfiguration(ILaunchConfigurationDi
13721389
}
13731390
return null;
13741391
}
1375-
13761392
}
1393+

0 commit comments

Comments
 (0)