From a752103b6d227e2e3c963fe9647dd73728537770 Mon Sep 17 00:00:00 2001 From: Sougandh S Date: Tue, 5 May 2026 12:49:26 +0530 Subject: [PATCH] Add active launch indicator to launch history menu Adds a visual indicator to launch configurations that are currently active in the launch history menu. --- .../actions/AbstractLaunchHistoryAction.java | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java index 5af5b2271ec..1c5d61e3749 100644 --- a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java +++ b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/AbstractLaunchHistoryAction.java @@ -23,6 +23,7 @@ import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationType; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; @@ -347,8 +348,12 @@ protected void fillMenu(Menu menu) { // Add favorites int accelerator = 1; + ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches(); for (ILaunchConfiguration launch : favoriteList) { LaunchAction action= new LaunchAction(launch, getMode()); + if (launches.length > 0 && checkIfLaunched(launch, launches)) { + action.setText(action.getText() + " \u2699"); //$NON-NLS-1$ + } addToMenu(menu, action, accelerator); accelerator++; } @@ -361,6 +366,9 @@ protected void fillMenu(Menu menu) { // Add history launches next for (ILaunchConfiguration launch : historyList) { LaunchAction action= new LaunchAction(launch, getMode()); + if (launches.length > 0 && checkIfLaunched(launch, launches)) { + action.setText(action.getText() + " \u2699"); //$NON-NLS-1$ + } addToMenu(menu, action, accelerator); accelerator++; } @@ -373,6 +381,22 @@ protected void fillMenu(Menu menu) { } } + /** + * Returns whether the given launch configuration has been launched. + * + * @param launchConfiguration the launch configuration + * @param launches the current active launches + * @return {@code true} if a matching launch exists, {@code false} otherwise + */ + private boolean checkIfLaunched(ILaunchConfiguration launchConfiguration, ILaunch[] launches) { + for (ILaunch launch : launches) { + if (launch.getLaunchConfiguration().equals(launchConfiguration) && !launch.isTerminated()) { + return true; + } + } + return false; + } + /** * Adds a separator to the given menu *