1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-19 15:05:36 +02:00

[253037] ClassCastException in SystemDynamicUserActionMenu, SystemDynamicCompileMenu

This commit is contained in:
Kevin Doyle 2008-12-03 01:44:43 +00:00
parent 70365fef23
commit dbb50116d7
2 changed files with 8 additions and 2 deletions

View file

@ -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];

View file

@ -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];