Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to register form section toolbar?
How to register form section toolbar? [message #336974] Fri, 17 July 2009 17:09 Go to next message
Eric Jain is currently offline Eric JainFriend
Messages: 266
Registered: July 2009
Senior Member
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)?
Re: How to register form section toolbar? [message #336979 is a reply to message #336974] Fri, 17 July 2009 21:39 Go to previous messageGo to next message
Philipp Kursawe is currently offline Philipp KursaweFriend
Messages: 135
Registered: July 2009
Senior Member
Eric Jain wrote:
> 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
Re: How to register form section toolbar? [message #336980 is a reply to message #336979] Sat, 18 July 2009 00:32 Go to previous messageGo to next message
Eric Jain is currently offline Eric JainFriend
Messages: 266
Registered: July 2009
Senior Member
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)?
Re: How to register form section toolbar? [message #336983 is a reply to message #336980] Sat, 18 July 2009 10:35 Go to previous messageGo to next message
Philipp Kursawe is currently offline Philipp KursaweFriend
Messages: 135
Registered: July 2009
Senior Member
Eric Jain wrote:
> 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);
Re: How to register form section toolbar? [message #337005 is a reply to message #336983] Mon, 20 July 2009 19:01 Go to previous messageGo to next message
Eric Jain is currently offline Eric JainFriend
Messages: 266
Registered: July 2009
Senior Member
Philipp Kursawe wrote:
> 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)...
Re: How to register form section toolbar? [message #337009 is a reply to message #337005] Mon, 20 July 2009 23:22 Go to previous messageGo to next message
Eric Jain is currently offline Eric JainFriend
Messages: 266
Registered: July 2009
Senior Member
Eric Jain wrote:
> 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");
Re: How to register form section toolbar? [message #337013 is a reply to message #337009] Tue, 21 July 2009 06:14 Go to previous message
Philipp Kursawe is currently offline Philipp KursaweFriend
Messages: 135
Registered: July 2009
Senior Member
Eric Jain wrote:
> For the record:
>
> IMenuService service = (IMenuService)
> getSite().getService(IMenuService.class);
> service.populateContributionManager(toolbarManager, "section:foo");

Thats the one :) Good luck!
Previous Topic:Which setting files should/must/shouldn't be under version control?
Next Topic:JFace 3.3 TableViewer, DialogCellEditor, Tabhandling
Goto Forum:
  


Current Time: Fri Dec 27 02:13:11 GMT 2024

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

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

Back to the top