Summary: | [spy] toolbar and menu action contributions | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] PDE | Reporter: | Willian Mitsuda <wmitsuda> | ||||||
Component: | UI | Assignee: | Chris Aniszczyk <caniszczyk> | ||||||
Status: | RESOLVED FIXED | QA Contact: | |||||||
Severity: | enhancement | ||||||||
Priority: | P3 | CC: | caniszczyk, contact, KetanPadegaonkar, kjdoyle, markus.kell.r, pwebster | ||||||
Version: | 3.4 | Keywords: | noteworthy | ||||||
Target Milestone: | 3.5 M7 | ||||||||
Hardware: | PC | ||||||||
OS: | Windows Vista | ||||||||
Whiteboard: | |||||||||
Attachments: |
|
Description
Willian Mitsuda
2007-11-14 17:07:21 EST
Yes, I had code that does exactly this in the incubator in the old spy. I haven't had time to graduate and migrate some of the code because it was messy and not 100% working. http://dev.eclipse.org/viewcvs/index.cgi/pde-incubator/spy/plugins/org.eclipse.pde.ui.spy/ Check that project out, and use that spy. When you launch the spy, you'll notice an icon in the spy's toolbar manager that looks like a menu icon. Click that, and it will do a Display.addFilter() and hook into your next selection. Once you select something like a toolbar contribution, it should come back with information about it. Give it a whirl and any comments you have are valuable. I'm trying to find time to graduate the code in M4 or M5 but product work is hurting at the moment. Any help is appreciated. (In reply to comment #1) > Any help is appreciated. Hey, I volunteer ! ;) I'm tinkering with some code that does a lot of this, I plan on dropping code in M6 if it's stable enough. There's other bugs open Ben :) Oh ok ;) I checked out code from the incubator ; did you make some enhancements since december ? ya, one of my workspaces has the code cleaned up to work with the code outside the incubator and did a ton of cleanup. The incubator code was ugly :) (In reply to comment #5) > The incubator code was ugly :) Yap, definitely! ;))) ...Well, let's find another bug ... :) not for 3.4, work will probably be done in PDE incubator for 3.5 Created attachment 128852 [details]
org.eclipse.pde.runtime.patch
This is what happens when I get bored on the plane... extremely hackish first cut of how I envision things working...
Hey Paul, let's chat about this one this week sometime. Or we can do it at EclipseCon :) I released a first cut of this functionality for the next i-build. This way people can start to toy with it and we can evolve it before M7 ships. There are still cases where we don't get enough information back (ie., given a command, how do I get the associated handler and all that good stuff), we can open separate bugs for this.
> 20090316
At EclipseCon, I'll spend some quality time with Paul to polish this up a bit as he understands the action/command hierarchy hell better than I do :) Looking forward to it! :-) PW Oh, to toy with the functionality, alt+shift+f2... you should see a "spy cursor" come up. The next action you do should be intercepted via a clever display filter... the spy should popup with relevant information. Paul, a question for you. Given a command, how do I get the handler? I have some code like this... else if (item instanceof CommandContributionItem) { // TODO... this is hard... CommandContributionItem contributionItem = (CommandContributionItem) item; ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); Command command = service.getCommand(contributionItem.getCommand().getId()); If I attempt to get a handler, it's going to be a proxy of course. The command is also not the command that someone wrote, looks to be a proxy object itself. Any options besides reflection or hitting the registry? From CommandContributionItem you should be able to go: Command cmd = cci.getCommand().getCommand(); IHandler h = cmd.getHandler(); You'll either have a programmatic handler (usually coming from a view's createPartControl(*)) or the HandlerProxy. The HandlerProxy is an internal class, but I can provide a getConfigurationElement() on it that should return the IConfigurationElement. As for the command itself, we throw away those IConfigurationElements in CommandPersistence, so finding a plugin that contributed a command involves searching the registry (and command can be defined programmaticly, although the platform doesn't do it) PW Created attachment 130006 [details]
Some poking at menu IDs
|