From 8df564e147fd1c0ffd0decae47a21207b9fb3759 Mon Sep 17 00:00:00 2001 From: Elsa Zacharia Date: Thu, 23 Apr 2026 01:01:20 +0530 Subject: [PATCH] Disable "Stop in Main" checkbox in Run config This commit disabled the "Stop in Main" option as it is irrelevant in Run configuration and rename the option to "Suspend in Main" Fixes: https://github.com/eclipse-jdt/eclipse.jdt.debug/issues/934 --- .../ui/launchConfigurations/JavaMainTab.java | 17 ++++++++++++----- .../debug/ui/launcher/LauncherMessages.java | 2 +- .../ui/launcher/LauncherMessages.properties | 4 ++-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaMainTab.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaMainTab.java index 0da9ba8eb0..b399ce3c5f 100644 --- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaMainTab.java +++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/debug/ui/launchConfigurations/JavaMainTab.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2023 IBM Corporation and others. + * Copyright (c) 2005, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -24,7 +24,9 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.internal.ui.SWTFactory; +import org.eclipse.debug.ui.ILaunchConfigurationDialog; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IJavaModel; import org.eclipse.jdt.core.IJavaProject; @@ -105,8 +107,11 @@ protected void createMainTypeExtensions(Composite parent) { fConsiderInheritedMainButton = SWTFactory.createCheckButton(parent, LauncherMessages.JavaMainTab_22, null, false, 2); fConsiderInheritedMainButton.addSelectionListener(getDefaultListener()); - fStopInMainCheckButton = SWTFactory.createCheckButton(parent, LauncherMessages.JavaMainTab_St_op_in_main_1, null, false, 1); - fStopInMainCheckButton.addSelectionListener(getDefaultListener()); + ILaunchConfigurationDialog dialog = getLaunchConfigurationDialog(); + if (dialog != null && ILaunchManager.DEBUG_MODE.equals(dialog.getMode())) { + fStopInMainCheckButton = SWTFactory.createCheckButton(parent, LauncherMessages.JavaMainTab_Suspend_In_Main, null, false, 1); + fStopInMainCheckButton.addSelectionListener(getDefaultListener()); + } } @Override @@ -231,7 +236,7 @@ public void performApply(ILaunchConfigurationWorkingCopy config) { mapResources(config); // attribute added in 2.1, so null must be used instead of false for backwards compatibility - if (fStopInMainCheckButton.getSelection()) { + if (fStopInMainCheckButton != null && fStopInMainCheckButton.getSelection()) { config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_STOP_IN_MAIN, true); } else { @@ -315,7 +320,9 @@ private void updateStopInMainFromConfig(ILaunchConfiguration config) { stop = config.getAttribute(IJavaLaunchConfigurationConstants.ATTR_STOP_IN_MAIN, false); } catch (CoreException e) {JDIDebugUIPlugin.log(e);} - fStopInMainCheckButton.setSelection(stop); + if (fStopInMainCheckButton != null) { + fStopInMainCheckButton.setSelection(stop); + } } } diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LauncherMessages.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LauncherMessages.java index ef34e7d001..ef867bc653 100644 --- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LauncherMessages.java +++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LauncherMessages.java @@ -87,7 +87,7 @@ public class LauncherMessages extends NLS { public static String JavaMainTab_E_xt__jars_6; public static String JavaMainTab_Main_cla_ss__4; public static String JavaMainTab_Main_type_not_specified_16; - public static String JavaMainTab_St_op_in_main_1; + public static String JavaMainTab_Suspend_In_Main; public static String JavaMainTab_19; public static String JavaMainTab_20; public static String JavaMainTab_21; diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LauncherMessages.properties b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LauncherMessages.properties index c0b051d71d..330aadc353 100644 --- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LauncherMessages.properties +++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/launcher/LauncherMessages.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2000, 2022 IBM Corporation and others. +# Copyright (c) 2000, 2026 IBM Corporation and others. # # This program and the accompanying materials # are made available under the terms of the Eclipse Public License 2.0 @@ -78,7 +78,7 @@ JavaMainTab__Main_19=Main JavaMainTab_E_xt__jars_6=Includ&e system libraries when searching for a main class JavaMainTab_Main_cla_ss__4=&Main class: JavaMainTab_Main_type_not_specified_16=Main type not specified -JavaMainTab_St_op_in_main_1=St&op in main +JavaMainTab_Suspend_In_Main=Suspend in main JavaMainTab_19=Illegal project name: {0} JavaMainTab_20=Project {0} does not exist JavaMainTab_21=Project {0} is closed