|Programmatically add Buttons to Toolbar during runtime [message #646194]
||Wed, 22 December 2010 10:53
| Hauke Fuhrmann
Registered: July 2009
Dear RCP folks,|
I try to add Buttons programmatically during runtime to the Toolbar. Is
there a common way to do this? I cannot do it statically by giving
menuContributions in the plugin.xml.
My first try:
Added a "dynamic" menuContribution in my plugin.xml and implemented a
ContributionItem. I first tried to use CompoundContributionItem, but
this seems only to support menus and no toolbars.
Hence, I subclassed CompoundContributionItem and implemented
fill(ToolBarManager) instead of fill(MenuManager).
Is this a right way to do it?
Still I need to create the required CommandContributionItem objects.
However, I don't know how to create the corresponding Command
programmatically. API says I should use the CommandManager to
instantiate a Command. How do I get that manager?
Powered by FUDForum
. Page generated in 0.01501 seconds