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; }