Toolbar pulldown "toggles" contribution [message #526191] |
Fri, 09 April 2010 04:00  |
Eclipse User |
|
|
|
Hello,
I am trying to implement a toggle dropdown menu from a toolbar through menu contributions.
I managed to have my control, my pulldown and the menu items in it (thanks to Paul Webster's older posts!)
Now I am trying to implement 2 things :
- The main toolbar icon changes according to the selected menu item
- The corresponding menu item get checked, unselecting any previously checked item
I am trying to do this through IElementUpdater implementation but I cannot make it work.
Here is what I did :
* 1 command dedicated for the "root" toolbar command pulldown contribution
* This command has a dedicated handler implementing IElementUpdater which tries to update the icon to the currently selected element
* Contributed commands appended to URI "menu:rootCmdId" with specific handlers implementing IElementUpdater
Handlers' "updateElement" method for non-root command get called after the dropdown command is selected. Calling setChecked here does nothing.
Root command handler "updateElement" method is never called. I would have expected it to be called after child menu item selection. In the child's handlers I don't know how to get access to this "root" UIElement to update its icon.
So I cannot change the toolbar icon at all after a selection in the pulldown menu.
If anyone could tell me what I am doing wrong that would be nice...
Thank you.
Christophe.
http://www.nextep-softwares.com
|
|
|
|
|
|
|
Re: Toolbar pulldown "toggles" contribution [message #527447 is a reply to message #526619] |
Thu, 15 April 2010 06:12  |
Eclipse User |
|
|
|
Thanks for this clarification.
Another thing related to this which seems weird :
- I force initialization of the view (mainly because this view register some listeners at creation time to show the view on specific events) containing the toggle through :
page.showView(DiffPreviewView.VIEW_ID, null, IWorkbenchPage.VIEW_CREATE);
- I trigger view creation (above code) in a PageListener.pageOpened(...) method
- The first time the workbench window page is opened, everything is fine
- If I close / open the perspective, the toggle button appears on another view icon and seems to be superposed with the view icon. This other view has nothing to do with this toggle / control / command definition.
- If I click on the view which should contain the toggle (which has been created but is not already shown), then the control goes to the right place and the superposed control disappears...
Is there something I am doing wrong or is this a bug ?
Thank you,
Christophe
http://www.nextep-softwares.com
|
|
|
Powered by
FUDForum. Page generated in 0.07447 seconds