Skip to content

Commit 2f03f42

Browse files
committed
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.
1 parent 879c3bd commit 2f03f42

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LinkPrototypeAction.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,14 @@ protected boolean updateSelection(IStructuredSelection selection) {
107107
// Enable action only if launch configuration(s) of the same type
108108
// is(are) selected and the launch configuration type allows prototypes
109109
Collection<ILaunchConfigurationType> launchConfigurationTypes = new HashSet<>();
110+
ILaunchConfigurationType type = null;
110111
for (Object object : selection.toList()) {
111-
if (object instanceof ILaunchConfiguration) {
112-
if (((ILaunchConfiguration) object).isPrototype()) {
112+
if (object instanceof ILaunchConfiguration launchConfig) {
113+
if (launchConfig.isPrototype()) {
113114
return false;
114115
} else {
115-
ILaunchConfigurationType type = null;
116116
try {
117-
type = ((ILaunchConfiguration) object).getType();
117+
type = launchConfig.getType();
118118
} catch (CoreException e) {
119119
DebugUIPlugin.log(e.getStatus());
120120
}
@@ -128,8 +128,13 @@ protected boolean updateSelection(IStructuredSelection selection) {
128128
return false;
129129
}
130130
}
131-
if (launchConfigurationTypes.size() == 1) {
132-
return launchConfigurationTypes.iterator().next().supportsPrototypes();
131+
132+
if (launchConfigurationTypes.size() == 1 && type != null) {
133+
try {
134+
return type.getPrototypes().length > 0;
135+
} catch (CoreException e) {
136+
DebugUIPlugin.log(e);
137+
}
133138
}
134139
return false;
135140
}

0 commit comments

Comments
 (0)