Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsHow to register form section toolbar?
https://www.eclipse.org/forums/index.php/mv/msg/110303/336974/#msg_336974
SectionPart part = ...
ToolBarManager manager = new ToolBarManager(SWT.FLAT);
ToolBar toolbar = manager.createControl(part.getSection());
manager.update(true);
part.getSection().setTextClient(toolbar);
Now is there a way to register this toolbar so items can be contributed
via the plugin.xml (perhaps similar to the way context menus can be
registered)?]]>Eric Jain2009-07-17T17:09:35-00:00Re: How to register form section toolbar?
https://www.eclipse.org/forums/index.php/mv/msg/110303/336979/#msg_336979
> I attached a toolbar to a section in a form like so:
>
> SectionPart part = ...
> ToolBarManager manager = new ToolBarManager(SWT.FLAT);
> ToolBar toolbar = manager.createControl(part.getSection());
> manager.update(true);
> part.getSection().setTextClient(toolbar);
>
> Now is there a way to register this toolbar so items can be contributed
> via the plugin.xml (perhaps similar to the way context menus can be
> registered)?
You have to do that yourself using the MenuManager.populate* method.
Don't forget to unpopulate and dispose your toolbar manager.
I use the menuContributions URI: section:id, where id is an id that your
section represents.
Phil]]>Philipp Kursawe2009-07-17T21:39:07-00:00Re: How to register form section toolbar?
https://www.eclipse.org/forums/index.php/mv/msg/110303/336980/#msg_336980
> You have to do that yourself using the MenuManager.populate* method.
Thanks; but where do I get the MenuManager from (I'm in an EditPart)?]]>Eric Jain2009-07-18T00:32:39-00:00Re: How to register form section toolbar?
https://www.eclipse.org/forums/index.php/mv/msg/110303/336983/#msg_336983
> Philipp Kursawe wrote:
>> You have to do that yourself using the MenuManager.populate* method.
>
> Thanks; but where do I get the MenuManager from (I'm in an EditPart)?
>
>
you can call getSite().getService(IMenuManager.class);]]>Philipp Kursawe2009-07-18T10:35:08-00:00Re: How to register form section toolbar?
https://www.eclipse.org/forums/index.php/mv/msg/110303/337005/#msg_337005
> you can call getSite().getService(IMenuManager.class);
Still having some trouble: The IMenuManager (from
org.eclipse.jface.action.*) doesn't have a "populate" method. There is a
"fill" method, but then how is the ID specified? Also, the code above is
returning null (this is in an RCP application)...]]>Eric Jain2009-07-20T19:01:08-00:00Re: How to register form section toolbar?
https://www.eclipse.org/forums/index.php/mv/msg/110303/337009/#msg_337009
> Still having some trouble: The IMenuManager (from
> org.eclipse.jface.action.*) doesn't have a "populate" method. There is a
> "fill" method, but then how is the ID specified? Also, the code above is
> returning null (this is in an RCP application)...
For the record:
IMenuService service = (IMenuService)
getSite().getService(IMenuService.class);
service.populateContributionManager(toolbarManager, "section:foo");]]>Eric Jain2009-07-20T23:22:01-00:00Re: How to register form section toolbar?
https://www.eclipse.org/forums/index.php/mv/msg/110303/337013/#msg_337013
> For the record:
>
> IMenuService service = (IMenuService)
> getSite().getService(IMenuService.class);
> service.populateContributionManager(toolbarManager, "section:foo");
Thats the one :) Good luck!]]>Philipp Kursawe2009-07-21T06:14:45-00:00