| Summary: | Command.getHandler return WorkbenchHandlerServiceHandler instead of mine | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Jonathan CLAUDE <nahtanoj.work> |
| Component: | UI | Assignee: | Platform-UI-Inbox <Platform-UI-Inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | psuzzi |
| Version: | 4.4.2 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | stalebug | ||
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
Hi all, Switching our product from eclipse 3.6 to eclipse 4.4, I find a regression on our popup menus. We get some actions we should not have on some tree items. We have our own implementation of org.eclipse.core.commands.AbstractHandler which override method isEnabled(). What we do when a tree item is selected is something like that : commandService = (ICommandService) getWorkbench().getAdapter(ICommandService.class) Command command = commandService.getCommand(cmdId); IHandler handler = command.getHandler(); if (handler instanceOf MyHandler) { ((MyHandler) handler).setEnabled(false); //to disable the command } It used to work in eclipse 3.x but not anymore with eclipse 4.4.2 because instead of MyHandler, I have an instance of WorkbenchHandlerServiceHandler. I have found a workaround right now but I would like something cleaner if exists to avoid going into internal package of eclipse. What I do to get my own instance of Handler : IEclipseContext eclipseContext = (IEclipseContext) activeWorkbench.getService(IEclipseContext.class); Object obj = HandlerServiceImpl.lookUpHandler(eclipseContext, cmdId); if (obj instanceof E4HandlerProxy) { E4HandlerProxy e4HandlerProxy = (E4HandlerProxy) obj; IHandler activeHandler = e4HandlerProxy.getHandler(); if (activeHandler instanceof MyHandler) { final MyHandler dHandler = (MyHandler) activeHandler; ((MyHandler) dHandler).setEnabled(enabled); } }