作为产品导出后,图像不会出现在RCP应用程序中 [英] Images are not appearing in RCP application after exporting as a product

查看:197
本文介绍了作为产品导出后,图像不会出现在RCP应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个RCP应用程序,其中我添加了一些图像作为图标。以下方法是在按钮上添加图标的方法:

  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();
}
}
}

其中,



按钮按钮 - >我需要添加图标的按钮,

显示d - >当前显示,

捆绑包 - > FrameworkUtil.getBundle(getClass()) ;,

字符串路径 - >图标的路径(例如 - /icons/expandall.gif)



所有图像都存储在根项目文件夹下的图标文件夹中。



注意:在图标文件夹的整个项目中,我没有其他任何参考。

解决方案

您是否添加了图标在你的build.properties?您必须打开plugin.xml,转到构建选项卡,然后检查二进制构建部分中的图标文件夹,以指示此文件夹将捆绑在您的RCP应用程序或插件中。



希望有所帮助。


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.

解决方案

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.

这篇关于作为产品导出后,图像不会出现在RCP应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆