Ok, so I have successfully added the combo control to the main toolbar of my eclipse RCP application using the following extension within one of my application's plugins.
<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="toolbar:org.eclipse.ui.main.toolbar">
<toolbar
id="com.company.module.toolbar"
label="Sample">
<control
class="com.company.module.ui.ComboToolbarContribution"
id="zoomControl">
</control>
</toolbar>
I have defined
public class ComboToolbarContribution extends
WorkbenchWindowControlContribution
and the above class returns a combo control that is pre-populated with values 100%, 200%, 300%, 400%
This toolbar is enabled for certain types of editors in my application using the visibleWhen clause on the toolbar extension.
Each editor in the application can support a different zoom level, so the content of the combo needs to be updated everytime an editor is activated to reflect the zoom level currently supported by it.
How do I update this combocontrol to reflect the value of the editor that is currently in focus or activated? Is there any hook available to do so?