user2717061
user2717061

Reputation: 25

Eclipse rcp view remove icon

My requirement is to remove the title icons for all views but it seems impossible.

First i removed the references to the icons from extension point="org.eclipse.ui.views" in my plugin.xml file.

There is a similar question to this one where it is suggested to override getTitleImage() in the view that extends ViewPart so i did just that and i tryed 2 versions.

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

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

The result no matter which method i used is that some views don't display the icon and some do. For example the first view is always opened without the icon but the following views get the default icon. Also if i have save and restore enabled and restart the application while leaving some views open, the one that is selected doesn't have the icon while the rest do.

This is so frustrating, i just don't get why something so simple has to be so complicated to implement.

Upvotes: 1

Views: 504

Answers (1)

greg-449
greg-449

Reputation: 111142

I think the problem is views that have not yet been created (so getTitleImage has not been called). In that case the workbench part reference code uses the default image if there is nothing defined in the view definition.

If the above is correct creating an empty image icon file and defining that as the icon in the org.eclipse.ui.views extension in your plugin.xml should work.

Upvotes: 2

Related Questions