Search code examples
eclipse-plugineclipse-jdt

How to access JDT "static" icon from an eclipse plugin?


I found out how to access some icons:

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

However, in ISharedImages are constants modifier icons like IMG_FIELD_PUBLIC and IMG_OBJS_PRIVATE etc., but I cannot find any for e.g. the static modifier.

I believe all of the icons in this list should somehow be accessible, but how? http://pic.dhe.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fref-156.htm


Solution

  • Unfortunatelly the only way I know if you use internal call. Add org.eclipse.jdt.ui as a dependency to your project. Then you will be able to use the JDT internal mechanism:

    JavaPluginImages.get(JavaPluginImages.IMG_OBJS_CLASS); // returns an Image
    

    I think with that you can use whichever icon you want.