How to access JDT “static” icon from an eclipse plugin?

陌路散爱 提交于 2019-12-08 02:56:37

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!