From 5a4fc73fbd4a30fde43cb2346c06319acc3cdc30 Mon Sep 17 00:00:00 2001 From: sougandhs Date: Tue, 28 Oct 2025 17:36:04 +0530 Subject: [PATCH] Do not enable Link Prototypes if there are no prototypes This commit disables Link Prototypes from launch configurations context if there are no prototypes defined launch type. --- .../LinkPrototypeAction.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LinkPrototypeAction.java b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LinkPrototypeAction.java index e8d2a6619d5..ee2ba1e3030 100644 --- a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LinkPrototypeAction.java +++ b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LinkPrototypeAction.java @@ -107,14 +107,14 @@ protected boolean updateSelection(IStructuredSelection selection) { // Enable action only if launch configuration(s) of the same type // is(are) selected and the launch configuration type allows prototypes Collection launchConfigurationTypes = new HashSet<>(); + ILaunchConfigurationType type = null; for (Object object : selection.toList()) { - if (object instanceof ILaunchConfiguration) { - if (((ILaunchConfiguration) object).isPrototype()) { + if (object instanceof ILaunchConfiguration launchConfig) { + if (launchConfig.isPrototype()) { return false; } else { - ILaunchConfigurationType type = null; try { - type = ((ILaunchConfiguration) object).getType(); + type = launchConfig.getType(); } catch (CoreException e) { DebugUIPlugin.log(e.getStatus()); } @@ -128,8 +128,13 @@ protected boolean updateSelection(IStructuredSelection selection) { return false; } } - if (launchConfigurationTypes.size() == 1) { - return launchConfigurationTypes.iterator().next().supportsPrototypes(); + + if (launchConfigurationTypes.size() == 1 && type != null) { + try { + return type.getPrototypes().length > 0; + } catch (CoreException e) { + DebugUIPlugin.log(e); + } } return false; }