Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Insert command toolbar button to action set(Learning new APIs...)
Insert command toolbar button to action set [message #520582] Fri, 12 March 2010 21:54 Go to next message
Eugene Ostroukhov is currently offline Eugene Ostroukhov
Messages: 66
Registered: July 2009
Member
What should I use as locationURI to insert a button to the debug toolbar (i.e. next to run/debug/profile)? Is it even possible using the org.eclipse.ui.menus extension point?

I can easily do it using actionSets extension point using toolbarPath="debug"
Re: Insert command toolbar button to action set [message #520663 is a reply to message #520582] Sat, 13 March 2010 22:40 Go to previous messageGo to next message
Sandip Chitale is currently offline Sandip Chitale
Messages: 27
Registered: July 2009
Location: California, USA
Junior Member
   <extension
         point="org.eclipse.ui.commands">
      <command
            defaultHandler="mypackage.MyHandler"
            id="my.command"
            name="My Command">
      </command>
   </extension>
   <extension
         point="org.eclipse.ui.menus">
      <menuContribution
            locationURI="toolbar:org.eclipse.ui.main.toolbar">
         <toolbar
               id="org.eclipse.debug.ui.launchActionSet">
         </toolbar>
      </menuContribution>
      <menuContribution
            locationURI="toolbar:org.eclipse.debug.ui.launchActionSet">
         <command
               commandId="my.command"
               icon="IMG_TOOL_UP"
               style="push">
            <visibleWhen
                  checkEnabled="true">
            </visibleWhen>
         </command>
      </menuContribution>
   </extension>


I was able to use the above to get my command inside the debug toolbar. The debug toolbar results from a action set defined in org.eclipse.debug.ui plugin. I found out the action set id that generates the debug toolbar using the Plug-in Spy functionality available in Eclipse PDE. I found out that it was org.eclipse.debug.ui.launchActionSet. So in my pluing.xml I created a toolbar with same id and then added my command to same toolbar. At this point my command appeared as the first command in the debug toolbar. I was not able to further control the position of my command. This is probably not something that is officially supported though. I am using Eclipse 3.5.2.

--
Sandip

[Updated on: Sat, 13 March 2010 22:43]

Report message to a moderator

Re: Insert command toolbar button to action set [message #520677 is a reply to message #520663] Sun, 14 March 2010 06:08 Go to previous messageGo to next message
Eugene Ostroukhov is currently offline Eugene Ostroukhov
Messages: 66
Registered: July 2009
Member
Thanks a lot.
Re: Insert command toolbar button to action set [message #520693 is a reply to message #520663] Sun, 14 March 2010 13:54 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Sandip Chitale wrote:

> I was able to use the above to get my command inside the debug toolbar.
> The debug toolbar results from a action set defined in
> org.eclipse.debug.ui plugin. I found out the action set id that
> generates the debug toolbar using the Plug-in Spy functionality
> available in Eclipse PDE. I found out that it was
> org.eclipse.debug.ui.launchActionSet. So in my pluing.xml I created a
> toolbar with same id and then added my command to same toolbar. At this
> point my command appeared as the first command in the debug toolbar. I
> was not able to further control the position of my command. This is
> probably not something that is officially supported though. I am using
> Eclipse 3.5.2.

I think you're fine. Menus and toolbars are always processed in this order:

1) programmatic contributions
2) menu contributions
3) legacy action contributions (like actionSets)

ActionSets can see menu contributions and get merged in, but not the
other way around.

PW



--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Insert command toolbar button to action set [message #521449 is a reply to message #520693] Wed, 17 March 2010 15:58 Go to previous messageGo to next message
Sandip Chitale is currently offline Sandip Chitale
Messages: 27
Registered: July 2009
Location: California, USA
Junior Member
Hi Paul,

Thanks for clarifying that.

Will it be possible to enhance the toolbar: location URI to address toolbars created by other plugins in the same way the toolbarpath attribute of the action element in classic actionSets extension point ? Or is it that the org.eclipse.ui.menus did not implemented the functionality that way intentionally? If that is not the case, I will go ahead and file an enhancement request for this.

As such the toolbar: location URI seems to really address the Coolbar and not the toolbar. That has always bothered me somewhat. In other words the toolbar:org.eclipse.ui.main.toolbar?after=additions really is specifying the location of the toolbar you are creating in the main coolbar. It is not very clear from the documentation that unlike the menu:, normally you are expected to create toolbar menucontribution inside and then create commands etc inside it. May be the documentation should be enhanced.

Regards,
Sandip
Re: Insert command toolbar button to action set [message #521481 is a reply to message #521449] Wed, 17 March 2010 17:19 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Sandip Chitale wrote:
> Hi Paul,
>
> Thanks for clarifying that.
>
> Will it be possible to enhance the toolbar: location URI to address
> toolbars created by other plugins

Yes, both toolbar and menu contributions from org.eclipse.ui.menus can
reference objects creates in o.e.ui.menus from other plugins.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Insert command toolbar button to action set [message #551703 is a reply to message #521481] Mon, 09 August 2010 09:13 Go to previous messageGo to next message
Eclipse User is currently offline Eclipse User
Messages: 34
Registered: July 2010
Member
Hello !

I have the same problem with the locationURI of my command
I want to put my command at the end of the 3 commands of the debug group and I've read that the equivalent of
toolbarPath="org.eclipse.debug.ui.launchActionSet/debug"
when using actions is simply :

locationURI="toolbar:org.eclipse.debug.ui.launchActionSet?after=debug"


Please help me to find the solution
and thanks so much in advance Very Happy
Re: Insert command toolbar after an action set toolbar [message #853747 is a reply to message #520693] Mon, 23 April 2012 09:47 Go to previous messageGo to next message
Sébastien  Gandon is currently offline Sébastien Gandon
Messages: 172
Registered: July 2009
Senior Member
Hello,
I know this is an old thread, but I am facing a location issue.
I'd like to add a toolbar after an actionSet contribution in the toolbar using an org.eclipse.ui.menus contribution.
I have tried
locationURI=toolbar:org.eclipse.ui.main.toolbar?after=another.actionSet


But this fails completly (nothing appears at all wherase without the "after=.." I see my toolbar).
Is it due to the order mentionned in the quoted mail below ?
if yes does this mean it is not possible to position a toolbar according to an actionSet ?
If so how to do it please?

Thanks.

SeB.

PS : i have found a few people trying to do so on web pages but not answer yet. Confused

Paul Webster wrote on Sun, 14 March 2010 14:54
Sandip Chitale wrote:

> I was able to use the above to get my command inside the debug toolbar.
> The debug toolbar results from a action set defined in
> org.eclipse.debug.ui plugin. I found out the action set id that
> generates the debug toolbar using the Plug-in Spy functionality
> available in Eclipse PDE. I found out that it was
> org.eclipse.debug.ui.launchActionSet. So in my pluing.xml I created a
> toolbar with same id and then added my command to same toolbar. At this
> point my command appeared as the first command in the debug toolbar. I
> was not able to further control the position of my command. This is
> probably not something that is officially supported though. I am using
> Eclipse 3.5.2.

I think you're fine. Menus and toolbars are always processed in this order:

1) programmatic contributions
2) menu contributions
3) legacy action contributions (like actionSets)

ActionSets can see menu contributions and get merged in, but not the
other way around.

PW



--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm

Re: Insert command toolbar after an action set toolbar [message #855039 is a reply to message #853747] Tue, 24 April 2012 13:24 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Yes, actionSets are processed last, so your o.e.ui.menus contribution cannot see it.

If you control the actionSet, you can create the same actionSet toolbar using o.e.ui.menus as mentioned by Sandip Chitale, and then the actionSet will be merged in.

PW


Re: Insert command toolbar after an action set toolbar [message #855046 is a reply to message #855039] Tue, 24 April 2012 13:32 Go to previous messageGo to next message
Sébastien  Gandon is currently offline Sébastien Gandon
Messages: 172
Registered: July 2009
Senior Member
thanks Paul for your answer,
but I do not want to merge actions but rather create a new toolbar after an action set toolbar.
I tried create a toolbar with o.e.ui.menus and add the action set in it without luck.
This looks like a bug to me does'nt it?
Re: Insert command toolbar after an action set toolbar [message #855057 is a reply to message #855046] Tue, 24 April 2012 13:44 Go to previous message
Paul Webster is currently offline Paul Webster
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

No, you need to create one toolbar for your actionSet then place your real toolbar after it, if you really want to have your toolbar after the actionSet toolbar. The actionSet itself will merge into the first toolbar.

The caveat: you have to place the actionSet toolbar created from o.e.ui.menus in the correct location.

PW


Previous Topic:Filtering action using in org.eclipse.ui.activities
Next Topic:How to get rid of unwanted menu contributions registered against MenuUtil.ANY_POPUP
Goto Forum:
  


Current Time: Tue Sep 23 18:42:36 GMT 2014

Powered by FUDForum. Page generated in 0.18603 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software