I manage to add a combo box on the IToolBarManager following the code listed bellow. Now does anybody has any idea how to access the combo box that is created inside the IContributionItem from oustide that scope?
Kind Regards,
Kyriakos
IToolBarManager mgr = this.getViewSite().getActionBars().getToolBarManager();
IContributionItem comboCI = new ControlContribution("test") {
protected Control createControl(Composite parent) {
final Combo c = new Combo(parent, SWT.READ_ONLY);
c.add("one");
c.add("two");
c.add("three");
c.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
c.add("four");
}
});
return c;
}
};
mgr.add(comboCI);
Put the combo variable inside ControlContribution class or IContributionItem interface and create a get method.
This way, you don’t need to declare it inside the anonymous class.
And you can call
Obviously, the IContributionItem interface need to have getCombo() method