diff --git a/rse/plugins/org.eclipse.rse.useractions/src/org/eclipse/rse/internal/useractions/api/ui/compile/SystemDynamicCompileMenu.java b/rse/plugins/org.eclipse.rse.useractions/src/org/eclipse/rse/internal/useractions/api/ui/compile/SystemDynamicCompileMenu.java index 55fe89c6f17..d2d4248017f 100644 --- a/rse/plugins/org.eclipse.rse.useractions/src/org/eclipse/rse/internal/useractions/api/ui/compile/SystemDynamicCompileMenu.java +++ b/rse/plugins/org.eclipse.rse.useractions/src/org/eclipse/rse/internal/useractions/api/ui/compile/SystemDynamicCompileMenu.java @@ -8,6 +8,7 @@ * Xuan Chen (IBM) - [222470] initial contribution. * Kevin Doyle (IBM) - [239805] User Action/Compile menu's shouldn't be tied to IRemoteFile * Kevin Doyle (IBM) - [239700] Compile Commands are available on items it shouldn't + * Kevin Doyle (IBM) - [253037] ClassCastException in SystemDynamicUserActionMenu, SystemDynamicCompileMenu *********************************************************************************/ package org.eclipse.rse.internal.useractions.api.ui.compile; @@ -56,7 +57,9 @@ public class SystemDynamicCompileMenu extends CompoundContributionItem ISystemProfile[] activeProfiles = RSECorePlugin.getTheSystemRegistry().getActiveSystemProfiles(); IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); ISelection selection = window.getSelectionService().getSelection(); - Object firstSelection = ((IStructuredSelection) selection).getFirstElement(); + Object firstSelection = null; + if (selection instanceof IStructuredSelection) + firstSelection = ((IStructuredSelection) selection).getFirstElement(); if (firstSelection == null) { return new IContributionItem[0]; diff --git a/rse/plugins/org.eclipse.rse.useractions/src/org/eclipse/rse/internal/useractions/api/ui/compile/SystemDynamicCompilePromptMenu.java b/rse/plugins/org.eclipse.rse.useractions/src/org/eclipse/rse/internal/useractions/api/ui/compile/SystemDynamicCompilePromptMenu.java index eecfb1b6f04..269e7ca1230 100644 --- a/rse/plugins/org.eclipse.rse.useractions/src/org/eclipse/rse/internal/useractions/api/ui/compile/SystemDynamicCompilePromptMenu.java +++ b/rse/plugins/org.eclipse.rse.useractions/src/org/eclipse/rse/internal/useractions/api/ui/compile/SystemDynamicCompilePromptMenu.java @@ -7,6 +7,7 @@ * Contributors: * Xuan Chen (IBM) - [222470] initial contribution. * Kevin Doyle (IBM) - [239700] Compile Commands are available on items it shouldn't -- Modified SystemDynamicCompileMenu + * Kevin Doyle (IBM) - [253037] ClassCastException in SystemDynamicUserActionMenu, SystemDynamicCompileMenu *********************************************************************************/ package org.eclipse.rse.internal.useractions.api.ui.compile; @@ -55,7 +56,9 @@ public class SystemDynamicCompilePromptMenu extends CompoundContributionItem ISystemProfile[] activeProfiles = RSECorePlugin.getTheSystemRegistry().getActiveSystemProfiles(); IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); ISelection selection = window.getSelectionService().getSelection(); - Object firstSelection = ((IStructuredSelection) selection).getFirstElement(); + Object firstSelection = null; + if (selection instanceof IStructuredSelection) + firstSelection = ((IStructuredSelection) selection).getFirstElement(); if (firstSelection == null) { return new IContributionItem[0];