Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Hide/Show MenuItems in a Menu
Hide/Show MenuItems in a Menu [message #530265] Thu, 29 April 2010 07:16 Go to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 10
Registered: February 2010
Junior Member
Is there a way to hide/show MenuItems inside a Menu?
Neither Menu provides something like menu.setVisible (int index_of_menu_item) nor MenuItem provides anything like menuitem.setVisible (boolean)

Thus, for menus whose contents change depending on the context, the code for creating menu is repeated over and over again (during each pop-up of the menu) which involves adding listeners for menu selection too.
This is quite inefficient I guess.

Simple hide/show mechanism will enable create-once-use-forever approach which will be very efficient.
Re: Hide/Show MenuItems in a Menu [message #530487 is a reply to message #530265] Thu, 29 April 2010 18:46 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

you're correct, removing menu items means disposing them. Adding one
back in the correct place involves creating the MenuItem with the
correct index.

In the eclipse Platform we use MenuManager and ContributionItems that
manage the logic of when to dispose and when to recreate MenuItems.
They come from org.eclipse.jface.

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/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Previous Topic:org.eclipse.swt.widgets.Text and Scroll bar
Next Topic:Wrong cell color return in Linux
Goto Forum:
  


Current Time: Fri Apr 26 19:40:21 GMT 2024

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

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

Back to the top