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 callorg.eclipse.ui.menus.UIElement.setIcon(ImageDescriptor). When you need to update the image, you callorg.eclipse.ui.commands.ICommandService.refreshElements(String, Map)to trigger the refresh and the call to your handler.