Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » executing menu handler (org.eclipse.ui.handlers) for multiple selection?
executing menu handler (org.eclipse.ui.handlers) for multiple selection? [message #329936] Thu, 10 July 2008 21:22 Go to next message
Eclipse UserFriend
Originally posted by: iwtb.email.com

I'm adding a menu item to a pop-up menu (project context menu) using
org.eclipse.ui.menu extension and am having trouble having the
corresponding command execute when multiple projects are selected. I can
select the menu item with multiple projects, but the command only executes
for the first project. I tried including
<activeWhen> <count value="+"></count></activeWhen>
<enabledWhen> <count value="+"></count></enabledWhen>
to the org.eclipse.ui.handlers extension
and it did not help.
I thought this <enabledWhen><count .. Is equivalent to the enablesFor
attribute org.eclipse.ui.popupMenus had (in objectContribution->action),
but maybe I am wrong.
If any of you knows how to make this work, would you please let me know?
Thanks a bunch in advance.
Dana
Re: executing menu handler (org.eclipse.ui.handlers) for multiple selection? [message #330078 is a reply to message #329936] Mon, 14 July 2008 14:23 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

The handler will execute once per menu item selection.

The selection in the view (multiple projects, in your example) are
passed in the current selection variable as an ISelection that can be
downcast to an IStructuredSelection (always check before casting :-).
You can use HandlerUtil to extract it from the execution event.

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:Can't get 3.4 to pick-up newly added plug-ins
Next Topic:Ctrl-Right/Ctrl-Left no longer scroll horizontally in Navigator/Package Explorer
Goto Forum:
  


Current Time: Fri Nov 08 22:59:04 GMT 2024

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

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

Back to the top