[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] Combo box in the workbench toolbar/coolbar

Hello,

I am trying to add a Combo Box to the workbench toolbar/coolbar without success. I have tried the following code in both the: ApplicationActionBarAdvisor - fillCoolBar() and on th postWindowOpen() method in ApplicationWorkBenchWindowAdvisor.

protected void fillCoolBar(ICoolBarManager coolBar)
   {
      IContributionItem comboItem = new ControlContribution("type")
      {
         protected Control createControl(Composite parent)
         {
            Composite panel = new Composite(parent, SWT.NONE);
            panel.setLayout(new RowLayout());
            panel.setBounds(0, 0, 50, 10);

            Label label = new Label(panel, SWT.NONE);
            label.setText("Select Graph Type:");

            Combo dataType = new Combo(panel, SWT.BORDER);
            dataType.add("Hello");

            return label;
         }
      };

      coolBar.setLockLayout(false);
      coolBar.add(comboItem);
      coolBar.update(true);
   }

This will work if I add it to the Workbench status bar .. but not the coolbar. I suspect it is because I am contributing commands to the toolbar using the new command framework in org.eclipse.ui and applying menus and commands using the plugin.xml. It seems to be overwriting what I place on the cool bar.

Can anyone advise me how to programmatically add the combo box after the plugin.xml contributed items and if possible how to specifically position it between specific items on the toolbar.

Cheers...

Anthony