From 28df400b4148dcb9e9762f0518af569226fd6d51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Thu, 2 Nov 2023 09:06:16 +0100 Subject: [PATCH] Deduplicate launch configs The same launch config might be returned by multiple LaunchShortcutExtension and is then shown twice. This simply filter items that where already seen to deduplicate such entries. Fix https://github.com/eclipse-platform/eclipse.platform/issues/527 --- .../eclipse/debug/ui/actions/ContextualLaunchAction.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ContextualLaunchAction.java b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ContextualLaunchAction.java index 5b5df03bc26..681fd428759 100644 --- a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ContextualLaunchAction.java +++ b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/actions/ContextualLaunchAction.java @@ -15,11 +15,13 @@ import java.util.ArrayList; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Set; import org.eclipse.core.expressions.Expression; import org.eclipse.core.expressions.IEvaluationContext; @@ -280,9 +282,12 @@ protected void fillMenu(Menu menu) { } } // now add collected launches + Set added = new HashSet<>(); for (Entry entry : launchConfigurations.entrySet()) { for (ILaunchConfiguration configuration : entry.getValue()) { - populateMenuItem(fMode, entry.getKey(), menu, configuration, accelerator++, null); + if (added.add(configuration)) { + populateMenuItem(fMode, entry.getKey(), menu, configuration, accelerator++, null); + } } }