| Summary: | CCE thrown in RepositoryAction from invoking IEvaluationContext's getVariable(String) | ||
|---|---|---|---|
| Product: | [Technology] EGit | Reporter: | Remy Suen <remy.suen> |
| Component: | UI | Assignee: | Project Inbox <egit.ui-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | mathias.kinzler, pwebster |
| Version: | 0.9.0 | ||
| Target Milestone: | 0.9.0-M3 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
In eclipse we return IEvaluationContext.UNDEFINED_VARIABLE (or something to that effect) when variables are "null". In this case, if the context menu is not provided a selection, or if this code is called outside of a popup menu showing. PW (In reply to comment #1) > In eclipse we return IEvaluationContext.UNDEFINED_VARIABLE (or something to > that effect) when variables are "null". Mm...I actually just got the exception while working on EGit in 3.x. I have not been able to reproduce it at the moment though. I think there is probably still a source provider issue in 4.x but EGit should add an instanceof check to their code instead of arbitrarily downcasting. Please also fix the code in RepositoryActionHandler. Code review at http://egit.eclipse.org/r/#change,1412 First one is merged as 51fab2f07155099d6ee08986f6c1d8dc1f67b0af, but we need another round: http://egit.eclipse.org/r/#change,1419 Merged as 0f65928171227869936e05703709ec00e7ef3f89 |
Got this while using EGit. The code looks like this... IHandlerService hsr = (IHandlerService) PlatformUI.getWorkbench() .getActiveWorkbenchWindow().getService(IHandlerService.class); IEvaluationContext ctx = hsr.getCurrentState(); selection = (ISelection) ctx.getVariable(ISources.ACTIVE_MENU_SELECTION_NAME); java.lang.ClassCastException: java.lang.Object cannot be cast to org.eclipse.jface.viewers.ISelection at org.eclipse.egit.ui.internal.actions.RepositoryAction.getSelection(RepositoryAction.java:71) at org.eclipse.egit.ui.internal.actions.RepositoryAction.run(RepositoryAction.java:94) at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:251) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:724)