问题
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
回答1:
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.
来源:https://stackoverflow.com/questions/13379789/how-to-access-jdt-static-icon-from-an-eclipse-plugin