Images are not appearing in RCP application after exporting as a product

谁说胖子不能爱 提交于 2019-12-23 05:40:17

问题


I have a RCP application, in which I have added some images as icons. The below method is the method for adding icons on the buttons:

public static void setIconForButton(Button button, Display d, Bundle bundle, String path) {
    InputStream is = null;
    try {
        is = FileLocator.openStream(bundle, new Path(path), false);
        Image image = new Image(d, is);
        button.setImage(image);
    } catch (IOException e1) {
        e1.printStackTrace();
    } finally {
        try {
            if (is != null) {
                is.close();
            }
        } catch (Exception e1) {
            e1.printStackTrace();
        }
    }
}

where,

Button button --> the button on which I need to add icons,
Display d --> current display,
Bundle bundle --> FrameworkUtil.getBundle(getClass());,
String path --> path of the icon.(for example - /icons/expandall.gif)

All the images are stored in icons folder which is directly under the root project folder.

Note: I have no other references anywhere else in the whole project of the icons folder.


回答1:


Have you added icons in your build.properties ? You must open plugin.xml for instance, go to the build tab, and then check for the "icons" folder in the "Binary Build" section to indicates this folder will be bundled in your RCP application or plugin.

Hope that helps.



来源:https://stackoverflow.com/questions/35038375/images-are-not-appearing-in-rcp-application-after-exporting-as-a-product

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