Using ISharedImages in plugin.xml

Eclipse provides a lot of images for general purpose, e.g. save, delete, edit, folders, etc. You can access these ImageDescriptors via

PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(SharedImages.IMAGE_ID);

However there is a more sophisticated way to create Entries in toolbars and/or menus. This is shown in a great tutorial by Lars Vogel here. You have now a command and a referencing menu extension. To use the Eclipse SharedImages you just put the ISharedImages constant in the icon field, like

icon: IMG_ETOOL_SAVEALL_EDIT

It works fine for me in Eclipse 3.6 Helios.  The article is based on https://bugs.eclipse.org/bugs/show_bug.cgi?id=246224

Keine Kommentare möglich.