Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Dynamic drop-down menu for a toolitem
Dynamic drop-down menu for a toolitem [message #329037] Tue, 10 June 2008 22:55 Go to next message
Asha Nair is currently offline Asha NairFriend
Messages: 1
Registered: July 2009
Junior Member
Hi,

I need to change the menu-items in the drop-down menu attached to a
toolitem dynamically based on a which editor is in focus. This can happen
at any time after the view creation. Right now I have code that creates
the menu items in the view part rather than through eclipse extensions. I
looked at some code that does it through extensions
http://wiki.eclipse.org/Menu_Contributions/Dropdown_Command , but the
menu-items are not dynamic. Is there a way to make the menu-items
dynamica, better still in the code itself?

Thanks,

Asha Nair
Re: Dynamic drop-down menu for a toolitem [message #329142 is a reply to message #329037] Fri, 13 June 2008 17:06 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

You can add a <dynamic/> element if you are using menu contributions.

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


Re: Dynamic drop-down menu for a toolitem [message #329147 is a reply to message #329142] Fri, 13 June 2008 18:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: agirija.cisco.com

Thanks for reply Paul.

No, I am not using contributions, but adding it up in the view itself. I
am creating a menu and attaching it as a drop-down to a toolitem in the
ToolBarManager. Is there a way to change the menu-items in the menu based
on certain conditions in this case?

Thanks,

Asha
Re: Dynamic drop-down menu for a toolitem [message #329168 is a reply to message #329147] Mon, 16 June 2008 11:52 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

So you've contributed a Action that is a DROPDOWN action? Then your
IMenuCreator is providing the SWT Menu, correct? Check out
http://www.eclipse.org/swt/snippets/ for an example of how to update a
Menu every time it is shown.

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:Snapshot of GLCanvas
Next Topic:extension points distribution
Goto Forum:
  


Current Time: Mon Jul 08 14:31:47 GMT 2024

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

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

Back to the top