Toolbar and Menu action work differently [message #329449] |
Tue, 24 June 2008 20:55 |
Eclipse User |
|
|
|
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 #329485 is a reply to message #329472] |
Wed, 25 June 2008 20:40 |
Eclipse User |
|
|
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03032 seconds