I cannot get this to work so I thought it might be a wise idea posting over here...
I have a context menu in SWT (actually its an Eclipse plugin). It's a cascaded menu, so it expands as soon as you hover over a certain entry...
My problem is, that I want to attach a small icon to the menu but I struggle with that!
Code: ....
manager.add(new Separator());
// icon for the "change color" menu
ImageDescriptor icon = ImageDescriptor.createFromFile(null,
"icons/palette_brush.png");
// submenu
MenuManager colorMenu = new MenuManager("Menu", icon, null);
// Actions
colorMenu.add(someAction);
// add the action to the submenu
manager.add(colorMenu);
....
My problem is, that the new MenuManager can either be called with 2 Arguments (no attached image) or 3 (with attached image). The image should be passed along as ImageDescriptor.
The question basically is:
"How can I get an Imagedescriptor off an image?"
Maybe it's an stupid mistake - but I cannot get an ImageDescriptor from an image file. I have an *.png icon ready to use, but I struggle incorporating this.
If anyone could help out with a snippet, that would get me an ImageDescriptor from an image file this would be soo awesome!
Best regards!
MenuManager Documentation:
MenuManager Docu