Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Coolbar using Handler/Commands
Coolbar using Handler/Commands [message #1221987] Thu, 19 December 2013 03:39 Go to next message
Jack Kilian is currently offline Jack Kilian
Messages: 35
Registered: March 2012
Member
Hi folk,

I impl. Actions and use them in an ActionBarAdvisor.

How can I use in a RCP or RAP Coolbar Handler/Commands instead Actions?
Doing it with e.g. menu items is easy but I found nothing for the Coolbar.

thx jk
Re: Coolbar using Handler/Commands [message #1222071 is a reply to message #1221987] Thu, 19 December 2013 10:46 Go to previous message
Simon SSC is currently offline Simon SSC
Messages: 64
Registered: April 2012
Location: Germany
Member
Hi Jack,

which kind of coolbar do you mean?
The "Main"-Coolbar of the Eclipse RCP Application or a Coolbar, which you have created yourself?

Main Toolbar can be accessed like that:


In this example I add a toolbar to the main coolbar and then add a certain command to it.

   <extension
         point="org.eclipse.ui.menus">
      <menuContribution
            allPopups="false"
            locationURI="toolbar:org.eclipse.ui.main.toolbar">
         <toolbar
               id="toolbar"
               label="%toolbar">
            <command
                  commandId="your.command.id"
                  style="push"
                  tooltip="%your.command.tooltip">
            </command>
         </toolbar>
      </menuContribution>



For a "selfmade" Coolbar you should use the org.eclipse.ui.menus.IMenuService to fill the Coolbar with Commands:

IMenuService menuService = (IMenuService) PlatformUI.getWorkbench()
                    .getActiveWorkbenchWindow().getService(IMenuService.class);

CoolBarManager coolbarManager = new org.eclipse.jface.action.CoolBarManager();
coolbarManager.createControl(parent);
menuService.populateContributionManager(
                        coolbarManager,
                        "locationURI.of.your.menuContribution.which.contains.the.desired.command"); //$NON-NLS-1$


I hope this helps.
Otherwise do not hesitate to ask further questions Wink

Best regards,

Simon
Previous Topic:Eclipse Application performace issues Windows 8
Next Topic:SplashHandler progress monitor not showing or updating
Goto Forum:
  


Current Time: Fri Apr 18 19:33:59 EDT 2014

Powered by FUDForum. Page generated in 0.05257 seconds