Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Multipage Header Toolbar-, Menu- Manager population
Multipage Header Toolbar-, Menu- Manager population [message #328910] Fri, 06 June 2008 14:45 Go to next message
Jan Kohnert is currently offline Jan KohnertFriend
Messages: 196
Registered: July 2009
Senior Member
Hello,

I'm using a SharedHeaderFormEditor with Commands assigned to its headers
ToolBar- and Menu-Managers. Each FormPage included inside
SharedHeaderFormEditor have their own toolbar and menu entrys.
The Eclipse MenuService is currently used to delegate the commands
definied with 'org.eclipse.ui.menus' to the managers.
At the moment my implementation is long winded and not felxible at all to
declarations from elsewhere. With other words I don'nt like my
implementation :)

Currently on each page change the following code is getting executed:

public void pageChanged(PageChangedEvent event) {
// only if this page is getting shown
if (event.getSelectedPage() == this){
// populating the toolbar
getHeaderToolBarManager().removeAll();

getMenuService().populateContributionManager((ToolBarManager )getHeaderToolBarManager(),
"toolbar:editors.one.header");
getHeaderToolBarManager().update(true);

// populating the menu
getHeaderMenuManager().removeAll();

getMenuService().populateContributionManager((MenuManager)ge tHeaderMenuManager(),
"menu:editors.one.header");
getHeaderMenuManager().update(true);

// layouting the header to get the toolbar fit.
getHeaderForm().getForm().getForm().getHead().layout(true);
}
}

I wonder if there are better ways to delegate to this managers.
Unfortunately I was not able to find anything helpfull yet :(

How can this be done a better way?
Thanks!
Re: Multipage Header Toolbar-, Menu- Manager population [message #328928 is a reply to message #328910] Fri, 06 June 2008 18:37 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Is the problem that you're having your Header toolbar switch as the page
switches (kinda the poor man's version of editor switching and the main
coolbar)?

First of all, you need to release any contributions that you populate,
certainly before you do a removeAll(). Otherwise you leak.

The pattern would be to populate the toolbar or menu once with all the
page contributions and have their visibility controlled by page
switching. But in 3.3 you would have to update the visibility of each
of the contribution items appropriately yourself during page switching.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Previous Topic:How to contribute a popup menu to Trim Area
Next Topic:Eclipse 3.4 and PDE: Cannot resolve installed plugins.
Goto Forum:
  


Current Time: Fri Jul 19 14:29:55 GMT 2024

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

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

Back to the top