Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-ui-dev] How do we add a combo control to the main toolbar and update it when a new editor is activated

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.



--
View this message in context: http://eclipse.1072660.n5.nabble.com/How-do-we-add-a-combo-control-to-the-main-toolbar-and-update-it-when-a-new-editor-is-activated-tp168287.html
Sent from the Eclipse Platform - UI mailing list archive at Nabble.com.


Back to the top