Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Dynamic cacading menu items
Dynamic cacading menu items [message #663624] Tue, 05 April 2011 22:03 Go to next message
venk Missing name is currently offline venk Missing nameFriend
Messages: 12
Registered: March 2011
Junior Member
I would like to create dynamic cascading menu items as follows:
When the user hovers over menu item A, it shows dynamic sub menu items b1, b2 and b3. On hovering over b1, it will show dynamic sub menu items c1 and c2 (similarly for b2 and b3). Is it possible to create a dynamic submenu under a dynamic submenu item? If so, is there an example?

Thanks!
Re: Dynamic cacading menu items [message #663758 is a reply to message #663624] Wed, 06 April 2011 12:33 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 04/05/2011 06:03 PM, venk wrote:
> I would like to create dynamic cascading menu items as follows:
> When the user hovers over menu item A, it shows dynamic sub menu items
> b1, b2 and b3. On hovering over b1, it will show dynamic sub menu items
> c1 and c2 (similarly for b2 and b3). Is it possible to create a dynamic
> submenu under a dynamic submenu item? If so, is there an example?

Keep in mind that multiple cascading menus are a poor UX design pattern.

That being said, where are you trying to create them? Main menu? view
menu? context menu?

PW


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


Re: Dynamic cacading menu items [message #663929 is a reply to message #663758] Wed, 06 April 2011 20:28 Go to previous messageGo to next message
venk Missing name is currently offline venk Missing nameFriend
Messages: 12
Registered: March 2011
Junior Member
I am trying to create them in Menu.
Thanks!
Re: Dynamic cacading menu items [message #664084 is a reply to message #663929] Thu, 07 April 2011 12:48 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 04/06/2011 04:29 PM, venk wrote:
> I am trying to create them in Menu.

That wasn't one of the 3 choices I could identify, so you'll have to be
more descriptive :-)

Or do you mean you have an SWT Menu, and you'd like an SWT snippet?

PW

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


Re: Dynamic cacading menu items [message #664760 is a reply to message #664084] Mon, 11 April 2011 20:56 Go to previous messageGo to next message
venk Missing name is currently offline venk Missing nameFriend
Messages: 12
Registered: March 2011
Junior Member
Ok...This is what I wish to do.
I have added a menu under "Project". I am adding a new dynamic under the menu. Under dynamic I add a new class which extends CompoundContributionItem. This would look something like

org.eclipse.ui.menus
|
|==== menu:project?after=additions (menuContribution)
|
|==== <menu> (menu)
|
|==== <dynamic> (dynamic)
|
|==== <CompoundContributionCommand> (class)

I override getContributionItems() in my class which returns contribution items. Each of these items return other contribution items thus making it a dynamic cascading menu. I was wondering if there is a way to do it or if I could find a snippet somewhere.

Thanks for your help.
Re: Dynamic cacading menu items [message #664882 is a reply to message #664760] Tue, 12 April 2011 11:22 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

On 04/11/2011 04:56 PM, venk wrote:
> CompoundContributionItem. This would look something like
> org.eclipse.ui.menus
> |
> |==== menu:project?after=additions (menuContribution)
> |
> |==== <menu> (menu)
> |
> |==== <dynamic> (dynamic)
> |
> |==== <CompoundContributionCommand> (class)
>

From your CompoundContributionItem you can create MenuManagers and fill
them in with further CommandContributionItems or more MenuManager
(creating a cascading menu structure).

A MenuManager is an IContributionItem.

PW


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


Re: Dynamic cacading menu items [message #665280 is a reply to message #664882] Thu, 14 April 2011 06:16 Go to previous messageGo to next message
venk Missing name is currently offline venk Missing nameFriend
Messages: 12
Registered: March 2011
Junior Member
Thank you very much for your help! It worked.

I have one more question pertaining to this. If I want to change the style of menu item (from SWT_PUSH to SWT_CHECK), can I change it on the MenuManager? I am returning menu managers in getContributionItems. Is there any way to do it in my scenario?

Thanks!
Re: Dynamic cacading menu items [message #666733 is a reply to message #665280] Fri, 22 April 2011 02:03 Go to previous message
jim liu is currently offline jim liuFriend
Messages: 37
Registered: February 2011
Location: shanghai
Member
I do not think it works,from SWT_PUSH to SWT_CHECK is not property change,it is native resource change of OS

java eclipse Search
http://javafind.appspot.com/
Previous Topic:Completely lost.... any ideas? (Unable to launch application - errors attached)
Next Topic:Re-Exporting external library best practice
Goto Forum:
  


Current Time: Fri Mar 29 08:38:55 GMT 2024

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

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

Back to the top