以编程方式更改eclipse RCP命令的图标 [英] Programatically change icon for a eclipse RCP command

查看:382
本文介绍了以编程方式更改eclipse RCP命令的图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在coolbar中有一个菜单下拉操作。它有3个子项组成一个无线电组。我想更改coolbar中显示的图标,当用户选择其中一个选项。



我已经google了,我应该看看:
org.eclipse.ui.commands.ICommandService.refreshElements(String,Map)

org.eclipse.ui.commands.IElementUpdater



它可能是正确的事情看看异常它没有足够的信息。

解决方案
>

Ok基本上如果你不想使用自定义控件,做什么是让你的处理程序(处理程序链接到特定的命令)实现IElementUpdater。当每个工具栏项被显示或点击(即如果用户在单选按钮上选择),方法:updateElement(UIElement元素,Map参数)被调用。
元素有一个setIcon()方法,这是我用来更改菜单下拉动作的图标。


I have a menu drop down action in the coolbar. It has 3 sub items that form a radio group. I would like to change the icon shown in the coolbar when the user selects one of these options.

I've googled and seen that I should look at: org.eclipse.ui.commands.ICommandService.refreshElements(String, Map) and org.eclipse.ui.commands.IElementUpdater

Its probably the right thing to look at exception its not enough information. One or two small code snippets will be excellent.

Thanks in advance.

解决方案

Ok basically if you don't want to use a "custom" control the what to do it is to have your handler (handler that is linked to the specific command) implement IElementUpdater. When every the toolbar item gets shown or clicked on (i.e if the user selects on the the radio buttons) the method: updateElement(UIElement element, Map parameters) gets called. The element has a setIcon() method and this is what i used to change the icon of the menu drop down action.

这篇关于以编程方式更改eclipse RCP命令的图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆