How do I access the toolbar item (org.eclipse.swt.widgets.ToolItem) from within the Activator?
I'm implementing a simple eclipse notification plugin that is supposed to change an icon in the toolbar if something of some nature happens. I made an extension to org.eclipse.ui.menus and the icon shows up nicely.
I thought of starting a poller thread in the Activator and have it poll every couple minutes and changing the icon accordingly.
The thread must have access to the ToolItem in order to call setImage(). How do I access the ToolItem to pass it on to the 开发者_如何学编程Thread?
Your handler must implement org.eclipse.ui.commands.IElementUpdater
. It can call org.eclipse.ui.menus.UIElement.setIcon(ImageDescriptor)
. When you need to update the image, you call org.eclipse.ui.commands.ICommandService.refreshElements(String, Map)
to trigger the refresh and the call to your handler.
精彩评论