Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How do we add a combo control to the main toolbar and update it when a new editor is activated(In Eclipse RCP, how do we add a combo control to the main toolbar and update it when a new editor is activated)
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 Go to next message
ALOK MANJREKAR is currently offline ALOK MANJREKARFriend
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

Re: How do we add a combo control to the main toolbar and update it when a new editor is activated [message #1396711 is a reply to message #1389519] Tue, 08 July 2014 17:16 Go to previous message
Eclipse UserFriend
Your WorkbenchWindowControlContribution is provided the IWorkbenchWindow (see #getWorkbenchWindow()). Obtain its part service in your createControl() and listen and react to part changes.

Brian.
Previous Topic:Access view in other perspective.
Next Topic:Dynamically change icon on the toolbar
Goto Forum:
  


Current Time: Fri Apr 19 06:04:01 GMT 2024

Powered by FUDForum. Page generated in 0.01766 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top