From: Patrick W. <pat...@ny...> - 2008-07-17 17:33:13
|
FYI. I contacted a guy from the Eclipse developer team to see if we could do this correctly. The way we are using the menu extension (we have two examples) and adding into the team menu is a bit of a hack. I'm surprised it works really. I think we may need to hold off using them, or provide our own menu "Git" instead of "Team". The problem is they haven't translated the Team menu definition to the new way yet, and don't plan to until 3.5 he says. I think we have three options, and my vote is for the third. 1. We create a Git menu and forgoe the Team one. 2. We use our dirty little hack,. 3. We use mappings to make our UI Actions a "GenericCommandDelegate" to just call Commands when executed. http://wiki.eclipse.org/Platform_Command_Framework#Using_an_IActionDelegate_ to_execute_a_command With the third we can define our commands and handlers all independent of the ui and add key bindings and stuff. Then we just have a compatibility layer where we create the UI pieces with IActionDelegates which automatically map themselves to the command with a parameter. This way we don't have to double up on actions and commands, and in the future we can convert to the menu extension. Any thoughts? -- Patrick From: Paul Webster [mailto:Pau...@ca...] Sent: Thursday, July 17, 2008 10:27 AM To: Patrick Winters Subject: Re: Team MenuContributions I normally answer questions like this in the newsgroup, but I'll save you some time :-) You've hit on the only solution in 3.3. Menus are built with programmatic additions first (the ones the view itself provides), followed by menu contributions, followed by legacy action contributions (which is where the Team menu is coming from). Menu contributions cannot see legacy action contributions (which cannot see each other, a fundamental problem with action contributions). The problem in 3.3 is that if you provide the Team menu as a menu contribution, then you also need to provide a similar group structure or risk changing contribution order. In 3.5 we hope to convert the Team menu to a menu contribution, which would allow a locationURI="popup:team.main" to work (and then there should only be one menu contribution for Team). I swiped this definition from the org.eclipse.team.ui object contribution definition: <objectContribution objectClass="org.eclipse.core.resources.mapping.ResourceMapping" adaptable="true" id="org.eclipse.team.ui.ResourceContributions"> <menu label="%TeamGroupMenu.label" path="additions" id="team.main"> <separator name="group1"> </separator> <separator name="group2"> </separator> <separator name="group3"> </separator> <separator name="group4"> </separator> <separator name="group5"> </separator> <separator name="group6"> </separator> <separator name="group7"> </separator> <separator name="group8"> </separator> <separator name="group9"> </separator> <separator name="group10"> </separator> <separator name="targetGroup"> </separator> <separator name="projectGroup"> </separator> </menu> </objectContribution> If you have any other questions, please direct them to the eclipse.platform newsgroup - http://www.eclipse.org/newsgroups/ Paul Webster Eclipse Platform UI Committer IBM Rational Canada "Patrick Winters" <pat...@ny...> wrote on 07/17/2008 02:26:39 AM: > Paul, > I'm sorry to bother you but my hours of frustration have led me to the > source. I'm developing a plug-in to provide Git support in Eclipse 3.3, and > I'm trying to use the org.eclipse.ui.menu extension. I need to get my > commands into the Team context menu, but can't seem to figure out how to > formulate a locationURI. > I have something that hacks its way in, but I don't like it. > > <extension > point="org.eclipse.ui.menus"> > <menuContribution > locationURI="popup:org.eclipse.ui.popup.any?after=additions"> > <menu > id="team.main" > label="Team"> > <command > commandId="edu.nyu.cs.gitclipse.ui.commitCommand" > id="edu.nyu.cs.gitclipse.ui.menus.commitCommand"> > </command> > ... > > By setting my menu id like this, it will actually insert the commands into > the Team menupath; but this is incorrect and complicates things for me > greatly. Do you think you could help? |