title: How to add a button to the main toolbar in Eclipse programmatically
body: <p>I've a question. I cannot find the way, how to add buttons to main toolbar programmatically. My problem is, that I've the task to dynamically (based on XML configuration file) build menus and toolbar. I found how to add a menu item programmatically, but not toolbar button. </p>
  
  <p>Tutorials mostly show how to create buttons and menus using plugin descriptor (plugin.xml), but not how to do it programatically. It seems, that it is out of bounds of Eclipse plugin philosophy.</p>
  
  <p>I've just found <a href="http://www.eclipse.org/forums/index.php/t/202213/" rel="nofollow">this</a>:</p>
  
  <blockquote>
    <p>There might be layout problems with this approach. I also don't
    believe the framework will try and re-create your dynamic item except
    at random toolbarmanager updates. With Menus they can be updated on an
    SWT.Show event, which is why CompoundContributionItem only applies to
    Menus.</p>
  </blockquote>
  
  <p>What shall I do? Can I say <em>Sorry, there is no way to build toolbar dynamically. I can do it just for menus</em>? Collegue says, that it must be possible, but he does neither know how.</p>