In Eclipse RCP application I have a custom view and a drop-down command contributed into that view's toolbar:
<menuContribution
allPopups="false"
locationURI="toolbar:test.ui.views.MyView">
<command
commandId="test.ui.commands.Command1"
icon="icons/Command1.png"
id="test.ui.commands.Command1.dropdown"
label="Command 1"
style="pulldown">
</command>
</menuContribution>
Then, I have a couple of other commands contributed into the Command1 drop-down menu like this:
<menuContribution
allPopups="false"
locationURI="menu:test.ui.commands.Command1.dropdown">
<command
commandId="test.ui.commands.Command2"
label="Command 2"
style="push">
</command>
<command
commandId="test.ui.commands.Command3"
label="Command 3"
style="push">
</command>
</menuContribution>
Until now everything works fine, I can see the Command1 icon on the view's toolbar and when I click the drop-down symbol next to it, the menu shows up with the Command2 and Command3 commands - as expected.
Problem:
What I would like to achieve now is to show the drop-down menu not only after the user clicks the drop-down symbol next to the Command1 icon, but also after the user clicks the Command1 icon itself.
(for example, this is how the Open Console command works in the Console view's toolbar in Eclipse)
I guess I need to programmatically trigger displaying the Command1 drop-down menu from within the Command1 handler but I couldn't find any examples on how to do that.
Thanks in advance for any help!
I just asked the same question on Eclipse RCP forum and got immediate answer. The trick is to fire a fake event that will trigger the menu to display, here are the details:
http://www.eclipse.org/forums/index.php/t/488692/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With