Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Toolbar and Menu action work differently
Toolbar and Menu action work differently [message #329449] Tue, 24 June 2008 20:55 Go to next message
Eclipse UserFriend
Originally posted by: spbgamer.yahoo.com

I have an action defined in my plugin.xml like this:

<action
class="someclass"
helpContextId="contextId"
icon="images/image.gif"
id="action1"
label="action label"
menubarPath="mainMenu/slot2"
style="pulldown"
toolbarPath="MyToolBar"
tooltip="tooltip">

<selection
name="*"
class="org.eclipse.core.resources.IResource">
</selection>
</action>

The action shows up just fine in the toolbar and in the menu. The toolbar
icon has the drop down arrow next to it and it gets populated by the
getMenu() method in someclass. The action in the menu has the submenu
arrow next to it. But, when I pass over my action in the menu the submenu
is not displayed. The getMenu() method in someclass is not called.

Am I doing something wrong? How does the submenu get populated?
Shouldn't getMenu() be called in this instance as well?

Thanks,
Steve
Re: Toolbar and Menu action work differently [message #329472 is a reply to message #329449] Wed, 25 June 2008 14:20 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Steve Barbieri wrote:
>
> Am I doing something wrong? How does the submenu get populated?
> Shouldn't getMenu() be called in this instance as well?

Do you implement org.eclipse.ui.IWorkbenchWindowPulldownDelegate2? Does
it work at all if you don't include the toolbarPath (simply make it a
menu item)?

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: Toolbar and Menu action work differently [message #329485 is a reply to message #329472] Wed, 25 June 2008 20:40 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: spbgamer.yahoo.com

Paul,
No, I did not implement org.eclipse.ui.IWorkbenchWindowPulldownDelegate2,
only org.eclipse.ui.IWorkbenchWindowPulldownDelegate. After implementing
IWorkbenchWindowPulldownDelegate2, my getMenu(Menu arg0) method is called
and the submenu is created. Thanks a lot. It seems that getMenu(Menu
arg0) is only called the first time I access the submenu, though. I need
to dynamically build the submenu contents based on artifacts in my
project. The action is similar to an "Open" action. The submenu should
list the artifacts in my project that the action can open. You can add
and remove these artifacts, thus making the submenu contents dynamic. Is
this a limitation of the submenu? I tried it with the action included in
the toolbar and menu and then with the action just contained in the menu.
getMenu(Menu arg0) was only called once in both cases.

Thanks again for the reply. I don't think I would have thought of
IWorkbenchWindowPulldownDelegate2 without your help.

Steve
Re: Toolbar and Menu action work differently [message #329517 is a reply to message #329485] Thu, 26 June 2008 17:56 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

"Dynamicness" in SWT involves adding a SWT event listener on SWT.Show
(or one of the MenuListeners) so that you can dispose and recreate the
MenuItems that you need.

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:Show next page after finish button was clicked
Next Topic:TabbedPropertyList
Goto Forum:
  


Current Time: Tue Jul 16 16:31:43 GMT 2024

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

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

Back to the top