Sunday 15 July 2012

eclipse - How to display the label of an item on the drop-down menu -


In the ELLESPSE RCP application I have a custom view and drop-down command that has contributed to the toolbar of that view:

< P> ex> & lt; Menu All Distribution Popup = "Wrong" Location RII = "Toolbar: test.ui.views.MyView" & gt; & Lt; Command command Id = "test.ui.commands.Command1" id = "test.ui.commands.Command1.dropdown" label = "command1" style = "pulldown" & gt; & Lt; / Order & gt; & Lt; / MenuContribution & gt; After that, I have a few other commands given in the Command1 drop-down menu:
   & Lt; / Order & gt; & Lt; / MenuContribution & gt;   

So far everything works fine, I can see command1 label on the toolbar of the view and when I click on the drop-down icon next to it, then menu command 2 And command3 command - as expected.

Problem:

What I would like to achieve now, when I click on Command2 item, then display the label of command 2 in the drop-down menu drop-down Command1 of the label.

Thanks in advance for any help!

You must have your handler enabled for command 1 implementation org.eclipse.ui .commands.IElementUpdater and at the appropriate time, call org.eclipse.ui.commands.ICommandService.refreshElements (string, map) .

In your IElementUpdater you have a chance to set the label for UIElement (the main tool item).

No comments:

Post a Comment