How to programmatically access JDT icons with an eclipse plugin?

eclipse-plugin

Solution

Just found it out: On my above code, instead of using `org.eclipse.ui.ISharedImages` (as returned by `workbench.getSharedImages()`, just use `org.eclipse.jdt.ui.ISharedImages`, which returns constants for jdt images.

Update:

The above gave me a NullPointerException. The following is working now:

ISharedImages images = JavaUI.getSharedImages();
Image image = images.getImage(ISharedImages.IMG_WHATEVER);

Problem

I'd like to use built-in JDT icons inside my plugin: http://help.eclipse.org/helios/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fref-icons.htm How can I access them from within my code? The following code seems to list some shared images, but only standard UI icons of eclise, not JDT specific (I need icons for private/public/... methods/fields in Java): ``` IWorkbench workbench = PlatformUI.getWorkbench(); ISharedImages images = workbench.getSharedImages(); Image image = images.getImage(ISharedImages.IMG_OBJ_FOLDER); ```

Original source