Skip to content

[Debug] Prompt when launching debug session with 'Skip All Breakpoints' enabled #2114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2017 IBM Corporation and others.
* Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -303,6 +303,11 @@ public class DebugUIMessages extends NLS {

public static String LaunchShortcutAction_combineLaunchShortcutName;

public static String skipBreakpointWarningTitle;
public static String skipBreakpointWarningLabel;
public static String skipBreakpointWarningToggle1;
public static String skipBreakpointButton1;

static {
// load message values from bundle file
NLS.initializeMessages(BUNDLE_NAME, DebugUIMessages.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2000, 2017 IBM Corporation and others.
# Copyright (c) 2000, 2025 IBM Corporation and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -287,4 +287,9 @@ WorkingDirectoryBlock_Exception_occurred_reading_configuration___15=Exception oc
##############################################################
ExpressionManagerContentProvider_1=Add new expression

LaunchShortcutAction_combineLaunchShortcutName={0} ({1})
LaunchShortcutAction_combineLaunchShortcutName={0} ({1})

skipBreakpointWarningTitle = Breakpoints set to skip
skipBreakpointWarningLabel = Breakpoints are disabled due to 'Skip All Breakpoints' being active. Debugger will continue without stopping.
skipBreakpointWarningToggle1 = Do not show this warning
skipBreakpointButton1 = Enable and Continue
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ public void initializeDefaultPreferences() {
prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_EXPRESSIONS, true);
prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_DISABLE_ALL_BREAKPOINTS, true);
prefs.setDefault(IDebugPreferenceConstants.PREF_PROMPT_ENABLE_ALL_BREAKPOINTS, true);
prefs.setDefault(IInternalDebugUIConstants.PREF_SKIP_ALL_BREAKPOINTS_PROMPT, true);

/**
* Context launching preferences. Appear on the the Launching preference page
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2017 IBM Corporation and others.
* Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -467,4 +467,11 @@ public interface IInternalDebugUIConstants {
*/
int BREAKPOINT_SORTING_ORDER_CREATION_TIME = 1;

/**
* Boolean preference prompting Skip All Breakpoints option is enabled on
* launching in debug mode
*
*/
String PREF_SKIP_ALL_BREAKPOINTS_PROMPT = IDebugUIConstants.PLUGIN_ID + ".DisableSkipAllBreakpointsOnLaunch"; //$NON-NLS-1$

}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ protected void createFieldEditors() {
addField(new BooleanFieldEditor(IDebugPreferenceConstants.PREF_PROMPT_REMOVE_ALL_TRIGGER_BREAKPOINTS, DebugPreferencesMessages.DebugPreferencePage_31, SWT.NONE, getFieldEditorParent()));
addField(new BooleanFieldEditor(IDebugPreferenceConstants.PREF_PROMPT_DISABLE_ALL_BREAKPOINTS,
DebugPreferencesMessages.DebugPreferencePage_32, SWT.NONE, getFieldEditorParent()));
addField(new BooleanFieldEditor(IInternalDebugUIConstants.PREF_SKIP_ALL_BREAKPOINTS_PROMPT,
DebugPreferencesMessages.DebugPreferencePage_PromptSkipBreakpoints, SWT.NONE, getFieldEditorParent()));

SWTFactory.createHorizontalSpacer(getFieldEditorParent(), 2);
ColorFieldEditor mem= new ColorFieldEditor(IDebugUIConstants.PREF_CHANGED_DEBUG_ELEMENT_COLOR, DebugPreferencesMessages.DebugPreferencePage_4, getFieldEditorParent());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2020 IBM Corporation and others.
* Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -217,6 +217,10 @@ public class DebugPreferencesMessages extends NLS {
public static String DebugPreferencePage_5;

public static String RunDebugPropertiesPage_0;
public static String LaunchingPreferencePage_43;

public static String skipBreakpointWarningTitle;

public static String DebugPreferencePage_PromptSkipBreakpoints;

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
###############################################################################
# Copyright (c) 2000, 2022 IBM Corporation and others.
# Copyright (c) 2000, 2025 IBM Corporation and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -53,6 +53,7 @@ DebugPreferencePage_31=&Prompt for confirmation when removing all triggerpoints
DebugPreferencePage_32=&Prompt for confirmation when disabling all breakpoints
DebugPreferencePage_5=Prompt for confirmation when deleting all e&xpressions
DebugPreferencePage_showValuesInline=Show debug values &inline on text editors (Experimental)
DebugPreferencePage_PromptSkipBreakpoints=Show warning when launching in debug mode with 'Skip Breakpoints' enabled

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

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

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2016 IBM Corporation and others.
* Copyright (c) 2004, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -52,6 +52,7 @@ public class LaunchingPreferencePage extends FieldEditorPreferencePage implement
private Button fLaunchLastIfNotLaunchable;
private Button fCheckParent;
private Button fTerminatAndRelaunch;
private Button fSkipAllBreakpointsPrompt;

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

fTerminatAndRelaunch = SWTFactory.createCheckButton(group, DebugPreferencesMessages.LaunchingPreferencePage_42, null, false, 1);
fSkipAllBreakpointsPrompt = SWTFactory.createCheckButton(group,
DebugPreferencesMessages.LaunchingPreferencePage_43, null, true, 1);

// initialize the buttons
boolean value = getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_USE_CONTEXTUAL_LAUNCH);
Expand Down Expand Up @@ -201,6 +204,8 @@ protected void performDefaults() {
fLaunchLastIfNotLaunchable.setEnabled(value);
value = getPreferenceStore().getDefaultBoolean(IInternalDebugUIConstants.PREF_TERMINATE_AND_RELAUNCH_LAUNCH_ACTION);
fTerminatAndRelaunch.setSelection(value);
value = getPreferenceStore().getDefaultBoolean(IInternalDebugUIConstants.PREF_SKIP_ALL_BREAKPOINTS_PROMPT);
fSkipAllBreakpointsPrompt.setSelection(value);
super.performDefaults();
}

Expand All @@ -210,6 +215,8 @@ public boolean performOk() {
getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_LAUNCH_PARENT_PROJECT, fCheckParent.getSelection());
getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_LAUNCH_LAST_IF_NOT_LAUNCHABLE, fLaunchLastIfNotLaunchable.getSelection());
getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_TERMINATE_AND_RELAUNCH_LAUNCH_ACTION, fTerminatAndRelaunch.getSelection());
getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_SKIP_ALL_BREAKPOINTS_PROMPT,
fSkipAllBreakpointsPrompt.getSelection());
return super.performOk();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2021 IBM Corporation and others.
* Copyright (c) 2000, 2025 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -92,6 +92,7 @@
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
Expand Down Expand Up @@ -974,6 +975,14 @@ public static void launch(final ILaunchConfiguration configuration, final String
} catch (CoreException e) {
DebugUIPlugin.log(e);
}
boolean breakpointsDisabled = DebugPlugin.getDefault().getBreakpointManager().isEnabled();
boolean showWarningPrompt = DebugUIPlugin.getDefault().getPreferenceStore()
.getBoolean(IInternalDebugUIConstants.PREF_SKIP_ALL_BREAKPOINTS_PROMPT);
if (!breakpointsDisabled && showWarningPrompt && mode.contains("debug")) { //$NON-NLS-1$
SkipBreakpointsWarning showWarning = new SkipBreakpointsWarning(DebugUIPlugin.getShell());
Display display = DebugUIPlugin.getStandardDisplay();
display.syncExec(() -> showWarning.open());
}
if (launchInBackground) {
DebugUIPlugin.launchInBackground(configuration, mode);
} else {
Expand Down Expand Up @@ -1372,5 +1381,5 @@ public static ILaunchConfiguration getLaunchConfiguration(ILaunchConfigurationDi
}
return null;
}

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/*******************************************************************************
* 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.ui;

import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.internal.ui.DebugUIMessages;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

/**
* Provides warning prompt dialog
*
* @since 3.19
*/
public class SkipBreakpointsWarning extends Dialog {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you have just implemented MessageDialogWithToggle again?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But MessageDialogWithToggle supports only 1 toggle option, so created a custom one

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need two options? Just warn and user can enable or disable "skip breakpoints" after that if needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this approach would help the user quickly disable the option if needed. But I can go with your suggestion

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also you could provide a push button for the disable disabled action so that there is no expectation that the check state might be persisted like the don’t ask again check box.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also you could provide a push button for the disable disabled action so that there is no expectation that the check state might be persisted like the don’t ask again check box

You mean remove the checkbox and add a "disable" button right ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Just keep in mind that the double negative on disable the disable all is also a potential point of confusion. Enable Breakpoints might be better. The opinions of others would be welcome.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@merks
How about this ?
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that seems fine (to me).


Button disableWarning;

Button enableBreakppints;

protected SkipBreakpointsWarning(Shell parentShell) {
super(parentShell);
}

@Override
protected void configureShell(Shell newShell) {
super.configureShell(newShell);
newShell.setText(DebugUIMessages.skipBreakpointWarningTitle);
}
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
GridLayout layout = new GridLayout(1, true);
layout.marginTop = 10;
layout.marginLeft = 10;
layout.marginRight = 10;
layout.verticalSpacing = 10;

container.setLayout(layout);
Label messageLabel = new Label(container, SWT.WRAP);
messageLabel.setText(DebugUIMessages.skipBreakpointWarningLabel);
GridData messageData = new GridData(SWT.FILL, SWT.CENTER, false, false);
messageData.widthHint = 500;
messageLabel.setLayoutData(messageData);

disableWarning = new Button(container, SWT.CHECK);
disableWarning.setText(DebugUIMessages.skipBreakpointWarningToggle1);

GridData data = new GridData(SWT.NONE);
data.verticalIndent = 20;
data.horizontalAlignment = GridData.BEGINNING;
disableWarning.setLayoutData(data);
return container;
}

@Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
enableBreakppints = createButton(parent, IDialogConstants.YES_ID, DebugUIMessages.skipBreakpointButton1, false);
createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
}

@Override
protected void buttonPressed(int buttonId) {
if (IDialogConstants.OK_ID == buttonId) {
disableWarning();
okPressed();
} else if (IDialogConstants.CANCEL_ID == buttonId) {
cancelPressed();
} else if (IDialogConstants.YES_ID == buttonId) {
disableWarning();
DebugPlugin.getDefault().getBreakpointManager().setEnabled(true);
okPressed();
}
}

@Override
protected Point getInitialSize() {
return new Point(580, 200);
}

@Override
public boolean close() {
disableWarning.dispose();
enableBreakppints.dispose();
return super.close();
}

private void disableWarning() {
if (disableWarning.getSelection()) {
DebugUIPlugin.getDefault().getPreferenceStore()
.setValue(IInternalDebugUIConstants.PREF_SKIP_ALL_BREAKPOINTS_PROMPT, false);
}
}

}
Loading