How do we add a combo control to the main toolbar and update it when a new editor is activated [message #1389519] |
Fri, 27 June 2014 23:41 |
ALOK MANJREKAR Messages: 15 Registered: May 2012 |
Junior Member |
|
|
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>
</menuContribution>
</extension>
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?
I know that I can trap the partActivated event triggered by the PartListener. But how do I access this control from within the main toolbar of the application within the implementation of the event handling?
The eclipse version I am developing against is 4.2.2
Please let me know in case anyone of you have any idea on how to go about this.
[Updated on: Sat, 28 June 2014 00:05] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.01766 seconds