Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » org.eclipse.ui.menus vs. actionSets in Perspectives(Can perspectives be easily customized when using menus rather than action sets?)
org.eclipse.ui.menus vs. actionSets in Perspectives [message #767044] Fri, 16 December 2011 23:02 Go to next message
Charles Eutsler is currently offline Charles EutslerFriend
Messages: 13
Registered: July 2009
Junior Member
We are developing an RCP application where we will have a family of related tools. We envision that each of the tools will be represented in the application as separate perspectives with their own sets of menus and toolbars.

I mostly understand how the different perspectives can use the IPageLayout.addActionSet to contribute their specific sets of menus and toolbars.

But action sets are supposed to be a legacy mechanism and we're supposed to use the org.eclipse.ui.menus to create menus and toolbars.

I am having troubles understanding how menuContributions can be used to define menus and toolbars that are shown initially only in the perspectives that want them to be shown. It seems that toolbars and menus defined as menuContributions appear in all perspectives.

I've tried to make them hidden by using the hiddenMenuItem in the perspectiveExtensions extension point with the targetId set to "*". I've run into problems with that solution. First, I haven't figured how to programatically show the items in the perspectives' initial layout. Also, when I try to use the Customize Perspective dialog to display the initially hidden item in a perspective, the item is shown to be shown as checked in the Menu/Tool Bar Visibility tab when, in fact, the item is not displayed. To get it displayed I have to uncheck the item then recheck it.

So, I am wondering if there is a menuContribution mechanism along the lines of action sets that can be used to have our different perspectives to initially show different sets of menus and toolbars and allow them to be added to other perspectives.

The IPageLayout interface knows about action sets but doesn't deal with menu contributions as far as I can tell.
Re: org.eclipse.ui.menus vs. actionSets in Perspectives [message #769243 is a reply to message #767044] Wed, 21 December 2011 16:35 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

The similar pattern for commands and menu contributions is to use activeContexts and visibleWhen. If you define an empty actionSet for use with your perspective, you can use it in menu contributions to control visibility:

<command commandId="org.eclipse.ui.help.aboutAction"
   <visibleWhen>
      <with variable="activeContexts">
         <iterate operator="or">
            <equals value="my.action.set.id"/>
         </iterate>
      </with>
   </visibleWhen>
</command>


PW


Re: org.eclipse.ui.menus vs. actionSets in Perspectives [message #769312 is a reply to message #769243] Wed, 21 December 2011 19:28 Go to previous message
Charles Eutsler is currently offline Charles EutslerFriend
Messages: 13
Registered: July 2009
Junior Member
Thanks a lot! It's just what I was looking for.
Previous Topic:Catching next pressed events inside a JFace wizard
Next Topic:how can i sniff out eclipse http requests?
Goto Forum:
  


Current Time: Thu Dec 18 15:27:39 GMT 2014

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

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