Question

I am working on an Eclipse RCP-based application, and we have decided that we do not want any of the menu items to display icons next to the text. The problem we are seeing is that the standard actions like Undo, Redo, Cut, Copy, Paste, and so on all display the default icons for the corresponding actions.

Is there any way to tell the action management infrastructure to ignore the icons? My brute force solution to this was to rebuild the SWT so that MenuItem.setImage() was a no-op, and then include our own copy of the SWT in the final product, but it seems like there should be a lighter-weight solution.

Was it helpful?

Solution

This turned out to be easier than I had hoped.

Create a subclass of org.eclipse.ui.application.ActionBarAdvisor. Override the method register like this:

protected void register(IAction action) {
    super.register(action);
    action.setImageDescriptor(null);
}

Then, create a subclass of org.eclipse.ui.application.WorkbenchWindowAdvisor that overrides createActionBarAdvisor:

public ActionBarAdvisor createActionBarAdvisor(IActionBarConfigurer configurer) {
    return new MyActionBarAdvisor(configurer);
}

That's it. All actions will no longer have icons.

OTHER TIPS

I believe you want to further examine going into the manifest and looking into org.eclipse.ui.views and seeing if there is anything in there for removing icons

What is the reason for not including icons? A lot of effort went into creating a standard interface, what would be the benefit of deviating from the standard? Do you think their omission increases usability?

Having said all that you could try contributing a fragment with some AspectJ around advice to intercept calls to setImage() and veto them.

You can do this by going to the extension tab in plugin.xml.add the extension org.eclipse.ui.menu (if not present).Right click create a new menu contribution.again right click and create a new menu.here u have the option to change the images with the ones saved in your icon folder in your class path

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top