【问题标题】:How to remove RCP view icon?如何删除 RCP 视图图标?
【发布时间】:2012-07-02 22:54:03
【问题描述】:

在每个视图的 plugin.xml 中,我都有图标文本框。在视图标题的文本旁边显示图标。

我只想要没有图标的视图标题。 我该怎么做?

谢谢

【问题讨论】:

    标签: eclipse eclipse-plugin eclipse-rcp


    【解决方案1】:

    在扩展 ViewPart 的类中,您可以覆盖 getTitleImage 方法:

    @Override
    public Image getTitleImage() {
        return null;
    }
    

    然后您应该只获取视图标题中没有图标的文本。

    编辑 上面的代码适用于 Eclipse 4.1.2。对于 Eclipse 3.7.0,您可以使用空图像:

    @Override
    public Image getTitleImage() {
        return new Image(getSite().getShell().getDisplay(), new Rectangle(0, 0,
                1, 1));
    }
    

    【讨论】:

    • 谢谢尼克,我已经按照你的建议做了,但我得到了这个错误 [[null argument:A part's title image must be non-null]] 除了 null 之外,还有其他东西可以禁用图像吗?
    • 我已验证上述代码在 Eclipse 4.1.2 上有效。你用的是什么版本?
    猜你喜欢
    • 1970-01-01
    • 2016-11-10
    • 1970-01-01
    • 1970-01-01
    • 2011-05-31
    • 2013-05-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多